is there an error in the help file
BlitzMax Forums/MaxGUI Module/is there an error in the help file
| ||
I've just installed BM 1.41 and BMGUI141 on win7 proffessional 32bit, rebuilt the docs, and i'm going through the source code in the help file For maxgui overview, when i copy / paste this section of code from it and try to run it , it comes up with this error message Compile Error: Unable to convert from 'TGraphics' to 'Int' here is the output from the output window of Blitxmax Building untitled1 Compiling:untitled1.bmx Compile Error: Unable to convert from 'TGraphics' to 'Int' [C:/BlitzMax/tmp/untitled1.bmx;31;6] Build Error: failed to compile C:/BlitzMax/tmp/untitled1.bmx Process complete here is the code i copy/pasted ' createcanvas.bmx Strict Import MaxGUI.Drivers Global GAME_WIDTH=320 Global GAME_HEIGHT=240 ' create a centered window with client size GAME_WIDTH,GAME_HEIGHT Local wx=(GadgetWidth(Desktop())-GAME_WIDTH)/2 Local wy=(GadgetHeight(Desktop())-GAME_HEIGHT)/2 Local window:TGadget=CreateWindow("My Canvas",wx,wy,GAME_WIDTH,GAME_HEIGHT,Null,WINDOW_TITLEBAR|WINDOW_CLIENTCOORDS) ' create a canvas for our game Local canvas:TGadget=CreateCanvas(0,0,320,240,window) ' create an update timer CreateTimer 60 While WaitEvent() Select EventID() Case EVENT_TIMERTICK RedrawGadget canvas Case EVENT_GADGETPAINT Local g=CanvasGraphics(canvas) SetGraphics g SetOrigin 160,120 SetLineWidth 5 Cls Local t=MilliSecs() DrawLine 0,0,120*Cos(t),120*Sin(t) DrawLine 0,0,80*Cos(t/60),80*Sin(t/60) Flip Case EVENT_WINDOWCLOSE FreeGadget canvas End Case EVENT_APPTERMINATE End End Select Wend Can anyone help me here |
| ||
When I run that code the IDE highlights the line: Local g=CanvasGraphics(canvas) and complains about converting TGraphics to Int. The help say CanvasGraphics returns a TGraphics object. The variable g has the default datatype of Int. So I blindly made the following change: Local g:TGraphics=CanvasGraphics(canvas) and all is well. Alternatively you could not use Strict mode, but you're better off getting used to it. |
| ||
Well, SuperStrict would have complained about the line in question to begin with :-) |
| ||
thanks ;) Can this be fixed in the manual ;) |