Setting Canvas background color

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
ken_anthony
User
User
Posts: 77
Joined: Thu Jun 20, 2013 5:41 am
Location: Springerville AZ USA

Setting Canvas background color

Post by ken_anthony »

I always search for the answer before asking questions but only found...

SetGadgetAttribute

But could not find the attribute constant required to set the background color anywhere.

So forgive me for asking, but could somebody tell me the proper constant? Thanks.
User avatar
Demivec
Addict
Addict
Posts: 4261
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: Setting Canvas background color

Post by Demivec »

ken_anthony wrote:I always search for the answer before asking questions but only found...

SetGadgetAttribute

But could not find the attribute constant required to set the background color anywhere.

So forgive me for asking, but could somebody tell me the proper constant? Thanks.
The canvas gadget doesn't have a background attribute, you can draw it yourself with a Box().
User avatar
Bisonte
Addict
Addict
Posts: 1308
Joined: Tue Oct 09, 2007 2:15 am

Re: Setting Canvas background color

Post by Bisonte »

Background Color of a Canvas ? with SetGadgetAttribute ?

Never saw that. Normally its like

Code: Select all

StartDrawing(CanvasOutput(Gadget))
Box(0, 0, OutputWidth(), OutputHeight(), Color)
StopDrawing()
PureBasic 6.21 (Windows x64) | Windows 11 Pro | AsRock B850 Steel Legend Wifi | R7 9800x3D | 64GB RAM | RTX 5080 | ThermaltakeView 270 TG ARGB | build by vannicom​​
English is not my native language... (I often use DeepL.)
ken_anthony
User
User
Posts: 77
Joined: Thu Jun 20, 2013 5:41 am
Location: Springerville AZ USA

Re: Setting Canvas background color

Post by ken_anthony »

That worked. Well, after I figured out why it wasn't working since I resized from zero to the parent height and width (it's always something, isn't it?)

Thanks a huge bunch.

ken
User avatar
Demivec
Addict
Addict
Posts: 4261
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: Setting Canvas background color

Post by Demivec »

Your welcome. :)
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: Setting Canvas background color

Post by PB »

> SetGadgetAttribute()

The command for setting gadget colors is SetGadgetColor().
When you look up this command in the Help manual, you'll
see that the canvas gadget doesn't support this command.

Also, when you look up the canvas gadget in the Help manual,
you'll see a list of attibutes (constants) that it supports. There
is no attribute for setting the color, for this or any other gadget.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
bobobo
Enthusiast
Enthusiast
Posts: 206
Joined: Mon Jun 09, 2003 8:30 am

Re: Setting Canvas background color

Post by bobobo »

a Canvas ist a thing to draw on , nearly like in real life, where you can buy colored canvases. :D
사십 둘 .
ken_anthony
User
User
Posts: 77
Joined: Thu Jun 20, 2013 5:41 am
Location: Springerville AZ USA

Re: Setting Canvas background color

Post by ken_anthony »

Thank you all. I'm very impressed by the responses I've received. You are certainly a good group of people.
Post Reply