Is ther a way to have canvas, working correctly while animating.
I am trying to adopt the code from this thread:
http://www.blitzmax.com/Community/posts.php?topic=78597#881924
it doesn't seem to work with animation.
If I change the hook to a timer it does not update the menu properly as in the mentioned thread. Is there a way to solve this problem? I did a forum search and I couldn't find anything to help me.
Any help would be appreciated.
this is the original code with animation included:
but does not work
I am trying to adopt the code from this thread:
http://www.blitzmax.com/Community/posts.php?topic=78597#881924
it doesn't seem to work with animation.
If I change the hook to a timer it does not update the menu properly as in the mentioned thread. Is there a way to solve this problem? I did a forum search and I couldn't find anything to help me.
Any help would be appreciated.
this is the original code with animation included:
Import MaxGui.Drivers SuperStrict Local Style:Int = WINDOW_TITLEBAR | WINDOW_MENU | WINDOW_CLIENTCOORDS Local MyWindow:TGadget Local filemenu:TGadget Local editmenu:TGadget Local helpmenu:TGadget Global canvas:TGadget MyWindow=CreateWindow("Max GUI App.", 112,84,800,600,Null,Style) filemenu=CreateMenu("&File ",0,WindowMenu(MyWindow)) CreateMenu "&New",101,filemenu,KEY_N,MODIFIER_COMMAND CreateMenu "&Open file",102,filemenu,KEY_O,MODIFIER_COMMAND CreateMenu "&Close file",103,filemenu,KEY_C,MODIFIER_COMMAND CreateMenu"",0,filemenu CreateMenu "&Save",104,filemenu,KEY_S,MODIFIER_COMMAND CreateMenu"",0,filemenu CreateMenu "&Open bitmap image",105,filemenu,KEY_I,MODIFIER_COMMAND CreateMenu"",0,filemenu CreateMenu "&Exit",106,fileMenu,KEY_F4,MODIFIER_COMMAND editmenu=CreateMenu("&Edit ",0,WindowMenu(MyWindow)) CreateMenu "Cu&t",107,editmenu,KEY_X,MODIFIER_COMMAND CreateMenu "&Copy",108,editmenu,KEY_C,MODIFIER_COMMAND CreateMenu "&Paste",109,editmenu,KEY_V,MODIFIER_COMMAND helpmenu=CreateMenu("&Help ",0,WindowMenu(MyWindow)) CreateMenu "&About",110,helpmenu canvas=CreateCanvas(0,0,800,640,MyWindow) UpdateWindowMenu MyWindow AddHook EmitEventHook , MyHook While True WaitEvent Select EventID() Case EVENT_MENUACTION Select EventData() Case 106 End Case 110 Notify "About stuff here" End Select End Select Wend Function MyHook:Object(iId:Int,tData:Object,tContext:Object) Local Event:TEvent=TEvent(tData) If event = Null Return Null If (Event.ID = EVENT_GADGETPAINT) Or (Event.ID = EVENT_WINDOWSIZE) Or (Event.ID = EVENT_WINDOWMOVE) Or (Event.ID = Event_AppResume) Then 'ReDraw the canvas when requested (GadgetPaint) or when the window was moved, sized, resumed.. ReDraw() End If Return tData End Function Function ReDraw() 'Call the ReDraw every time you want to update the canvas SetGraphics CanvasGraphics (canvas) SetViewport 0,0,GadgetWidth(canvas),GadgetHeight(canvas) Cls Local t:Long=MilliSecs()/100 DrawLine 400,300,400+120*Cos(t),300+120*Sin(t) DrawLine 400,300,400+80*Cos(t/60),300+80*Sin(t/60) Flip End Function
but does not work