canvas

BlitzMax Forums/BlitzMax Programming/canvas

@tonyg:

Here's a minimum sample to show the problem:
Function DoSomething(canvas:TGadget)
	SetGraphics CanvasGraphics(canvas)
	Cls
	DrawText "Hello :)",10,10
End Function

Local win1:TGadget
Local win2:TGadget
Local can1:TGadget
Local can2:TGadget

win1=CreateWindow("Window 1",60,60,100,100,Null,WINDOW_TITLEBAR|WINDOW_CLIENTCOORDS)
win2=CreateWindow("Window 2",200,60,100,100,Null,WINDOW_TITLEBAR|WINDOW_CLIENTCOORDS)

can1=CreateCanvas(0,0,100,100,win1)
can2=CreateCanvas(0,0,100,100,win2)

DoSomething can1
DoSomething can2
FreeGadget can2
DoSomething can1

If you run the program, it goes splat in the final DoSomething can1.

@assari,
Your tutorial is good - however, from what I could see you keep the canvas' open at all times, whereas this problem seems to be related to closing a canvas.

Neil