[Tired Brain]-CanvasGadget in a called procedure
Posted: Wed Jan 11, 2017 12:06 am
Hi all,
I'm struggling with a simple code, I've just created a procedure calling a canvas gadget
I call it 2 times but I only see the result of the first call
Here is the simple code:
and the result:

I really don't get it, what's wrong with the code?
Thanks for your help
I'm struggling with a simple code, I've just created a procedure calling a canvas gadget
I call it 2 times but I only see the result of the first call

Here is the simple code:
Code: Select all
Procedure.i CanvasTextGadget(id.i, x.i, y.i, width.i, height.i, text.s = "")
CanvasGadget(id, x, y, width, height, #PB_Canvas_Keyboard)
If StartDrawing(CanvasOutput(id))
DrawingMode(#PB_2DDrawing_Default)
Box(x, y, width, height, $202020)
DrawText(x, y, text, $A0A0A0, $202020)
StopDrawing()
EndIf
EndProcedure
If OpenWindow(0, 400, 200, 600, 400, "Canvas Text Gadget", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)
CanvasTextGadget(0, 0, 0, 200, 20, "Font Loaded")
CanvasTextGadget(1, 10, 40, 150, 40, "Another text")
Repeat
If WaitWindowEvent() = #PB_Event_CloseWindow
End
EndIf
ForEver
EndIf

I really don't get it, what's wrong with the code?
Thanks for your help
