Page 3 of 3

Re: Clearing a CanvasGadget

Posted: Thu Sep 19, 2019 3:27 pm
by marcoagpinto
#NULL wrote:It sounded to me as if you would draw and then clear, both in a single drawing block, that's why I asked. But just clear and draw makes sense though :) . Any reason why you don't use a screen?
I can't use a screen because it has a GUI :) with a toolbar, status bar and menus.

Re: Clearing a CanvasGadget

Posted: Thu Sep 19, 2019 3:34 pm
by #NULL
You can use a windowed screen in combination with other gui controls. The Doc for OpenWindowedScreen() even has examples for this.

Re: Clearing a CanvasGadget

Posted: Fri Sep 20, 2019 7:18 pm
by Josh
Josh wrote:
marcoagpinto wrote:@Fred:
Could you implement a function in PB to clear a canvas?
ClearCanvasGadget(gadget, colour)
This is already implemented and is called SetGadgetColor() :mrgreen:
Look at my posting from 17.01.2019 20:47 in this thread.
I think there's a problem in Pb. Try the following code with and without the MessageRequester line

Code: Select all

OpenWindow   (0, 0, 0, 600, 600, "Test")
CanvasGadget (0, 0, 0, 500, 500)

;MessageRequester ("", "")

StartDrawing (CanvasOutput(0))
  DrawText (10, 10, "TEST", #Yellow, #Blue)
StopDrawing ()

SetGadgetColor (0, #PB_Gadget_BackColor, #Yellow)


Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow

Re: Clearing a CanvasGadget

Posted: Sat Sep 21, 2019 8:15 am
by #NULL
Josh wrote:I think there's a problem in Pb. Try the following code with and without the MessageRequester line
Can you explain what you get? I don't see anything unusual, but I'm on Linux.

Re: Clearing a CanvasGadget

Posted: Sat Sep 21, 2019 1:29 pm
by RASHAD

Code: Select all

OpenWindow   (0, 0, 0, 600, 600, "Test")
CanvasGadget (0, 0, 0, 500, 500)

MessageRequester ("", "")

StartDrawing (CanvasOutput(0))
  DrawText (10, 10, "TEST", #Yellow, #Blue)
StopDrawing ()

HideGadget(0,1)
SetGadgetColor (0, #PB_Gadget_BackColor, #Yellow)
HideGadget(0,0)


Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow