Try something like this
To handle the canvas (which I have taken out to make the program simpler) you have to trap an EVENT_GADGETPAINT as well.
See my tutorial to understand how eventhook works.
Function MyHook:Object( id:Int,data:Object,context:Object ) Local ev:TEvent=TEvent(data) If ev.source=Win And ev.id=EVENT_WINDOWSIZE SetGadgetShape win,0,0,640,480 End If Return Data End Function Global win:TGadget win=CreateWindow( "A window!",0,0,640,480, Null, WINDOW_TITLEBAR | WINDOW_RESIZABLE ) AddHook EmitEventHook,MyHook While True WaitEvent Wend
To handle the canvas (which I have taken out to make the program simpler) you have to trap an EVENT_GADGETPAINT as well.
See my tutorial to understand how eventhook works.