Clearing a CanvasGadget

Just starting out? Need help? Post your questions and find answers here.
User avatar
marcoagpinto
Addict
Addict
Posts: 1045
Joined: Sun Mar 10, 2013 3:01 pm
Location: Portugal
Contact:

Re: Clearing a CanvasGadget

Post 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.
#NULL
Addict
Addict
Posts: 1497
Joined: Thu Aug 30, 2007 11:54 pm
Location: right here

Re: Clearing a CanvasGadget

Post by #NULL »

You can use a windowed screen in combination with other gui controls. The Doc for OpenWindowedScreen() even has examples for this.
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

Re: Clearing a CanvasGadget

Post 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
sorry for my bad english
#NULL
Addict
Addict
Posts: 1497
Joined: Thu Aug 30, 2007 11:54 pm
Location: right here

Re: Clearing a CanvasGadget

Post 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.
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4946
Joined: Sun Apr 12, 2009 6:27 am

Re: Clearing a CanvasGadget

Post 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
Egypt my love
Post Reply