MaxGUI: submenu/canvas problem..

BlitzMax Forums/BlitzMax Beginners Area/MaxGUI: submenu/canvas problem..

Hi,
I mixed the canvas and menu examples.
If i open submenus, it draws them over the canvas.

The problem:
It looks like the first menu opened is drawn IN the canvas, not over the canvas.
If i switch to other menus without activating the canvas again (without mouseclick), all menus open and close as they should.
The submenu opened first, closes too, but parts of that menu are still visible in that inactive canvas.

Tried it with canvas and menu in separate windows, with same result.

Any ideas?

Redraw the canvas when you get the EVENT_GADGETPAINT event?

Perhaps a hook for gadgetpaint would help here. Should receive that hook call the instant the canvas needs a redraw...

Thank you,
thats the loop:


'Create Window and Menu with submenu...blabla
'....
'....


UpdateWindowMenu(window[0])

CreateTimer 60

While Not KeyDown(key_escape)
WaitEvent       'pollevent..same problem

Select EventID()

Case event_timertick
 If g<>Null RedrawGadget Testcanvas

Case event_gadgetpaint
 Local g=CanvasGraphics(Testcanvas)
 SetGraphics g

Rem  same problem without drawing operations
 SetLineWidth 5
 Local t=MilliSecs()
 DrawLine 0,0,120*Cos(t),120*Sin(t)
 DrawLine 0,0,80*Cos(t/60),80*Sin(t/60)
 Flip
 Cls
end rem 

Case Event_Windowclose
 If EventSource()=Window[0] Then End

Case Event_MenuAction
 Select EventData()
  Case Menu_Exit 
   End
  Case Menu_Map
   TestCanvas=CreateCanvas(1,20,GadgetWidth(window[0]),GadgetHeight(window[0])-150,window[0])
 End Select

End Select
Wend



How would such a hook look like?
It smells a little like a bug because all other submenus opened after the first one behave as they should.
Its only the first submenu/menu opened while having a canvas activ.
If MaxGUI refreshes the window automaticaly if i open and close menus, why it misses the first menu and draws that thing in my canvas where it stays until i reactivate that canvas?

I'm not going to answer that question because I don't know, I havn't actually had a chance to use Max 1.12 or MaxGUI yet. But for an example on hooks, I will point you to the help files - from index, go tutorials and articles, maxgui overview, event hook based rendering.

Kind of hidden, as skidracer said.

Strike, "event hook based rendering" solved it.
Well, you could say now "rtfm"...

In Home->MaxGUI, what about to enhance this

BRL.MaxGUI: Functions Modinfo Source
to
BRL.MaxGUI: Functions Modinfo Source Overview

GUI works fine now.
Thank you.