Canvas Refresh when resizing a window

BlitzMax Forums/BlitzMax GUI Programming/Canvas Refresh when resizing a window

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Hi there,

I have the following program:
SuperStrict

Local MyWindow:TGadget=CreateWindow("Canvas Example", 200,200,320,240)
Local MyCanvas:TGadget=CreateCanvas(0,0,ClientWidth(MyWindow),ClientHeight(MyWindow),MyWindow)
SetGadgetLayout MyCanvas,EDGE_ALIGNED,EDGE_ALIGNED,EDGE_ALIGNED,EDGE_ALIGNED
Repeat
  WaitEvent()
  Select EventID()
  Case EVENT_WINDOWCLOSE
     End
  Case EVENT_GADGETPAINT
    SetGraphics CanvasGraphics (MyCanvas)
	Cls
    DrawRect  20,20,50,80
    Flip
   End Select
Forever


Problem is: when I resize I have garbage on the bottom and on the right of the canvas... I think the real canvas zone is not resized but I am not able to tweak this program to make it work....

Can somebody help me?

thanks in advance.