ContainerGadget gadgets background color...
- Joakim Christiansen
- Addict
- Posts: 2452
- Joined: Wed Dec 22, 2004 4:12 pm
- Location: Norway
- Contact:
ContainerGadget gadgets background color...
When you create a ContainerGadget and set its background color I think all the gadgets created inside it then should also use the same background color. Else you have to manually set them all which creates messy code and is much work... (I would actually call this a bug)
And when you create the ContainerGadget inside a PanelGadget which has a white background color (default) I think the ContainerGadget should use that background color too instead of the gray window background color.
Would be nice if you made this so, that would make PureBasic easier to work with!
And when you create the ContainerGadget inside a PanelGadget which has a white background color (default) I think the ContainerGadget should use that background color too instead of the gray window background color.
Would be nice if you made this so, that would make PureBasic easier to work with!
I like logic, hence I dislike humans but love computers.
Following that back to a logical conclusion then, creategadgetlist() should have a background colour assigned to it and all child gadgets should inherit the parents settings.
Which is basically what you are saying.
I second your idea.
Edit. Perhaps all gadgets should by default inherit the parent colours unless you use a flag to suppress it.
Which is basically what you are saying.
I second your idea.
Edit. Perhaps all gadgets should by default inherit the parent colours unless you use a flag to suppress it.
Re: ContainerGadget gadgets background color...
> When you create a ContainerGadget and set its background color I think
> all the gadgets created inside it then should also use the same background
> color
Maybe as an optional flag, but not by default. I for one like my gadgets in
a ContainerGadget to have their own colors, regardless of what color the
container has.
But this can be easily done as a coding method. What I mean is: all your
gadgets inside the container are numbered numerically, right? Well, they
should be, if you're a good coder.
So if the container was gadget #1,
then the gadgets inside would be #2 to #9 (for example), so to set all their
background color to the same as #1 (the container) you'd just use a loop:
> I would actually call this a bug
No, it's not. Not by any stretch of the imagination.
> all the gadgets created inside it then should also use the same background
> color
Maybe as an optional flag, but not by default. I for one like my gadgets in
a ContainerGadget to have their own colors, regardless of what color the
container has.
But this can be easily done as a coding method. What I mean is: all your
gadgets inside the container are numbered numerically, right? Well, they
should be, if you're a good coder.

then the gadgets inside would be #2 to #9 (for example), so to set all their
background color to the same as #1 (the container) you'd just use a loop:
Code: Select all
c=GetGadgetColor(#1,#PB_Gadget_BackColor)
For gad = #2 To #9
SetGadgetColor(gad,#PB_Gadget_BackColor,c)
Next
No, it's not. Not by any stretch of the imagination.
Last edited by PB on Mon Apr 23, 2007 12:43 pm, edited 1 time in total.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.
Re: ContainerGadget gadgets background color...
I agree.PB wrote:Maybe as an optional flag, but not by default.
That would make it workable with old and new code and to the coders preference.
Dare2 cut down to size
- Joakim Christiansen
- Addict
- Posts: 2452
- Joined: Wed Dec 22, 2004 4:12 pm
- Location: Norway
- Contact:
Re: ContainerGadget gadgets background color...
The Frame3DGadget text background gets gray when inside a white container gadget. If you like that and think it looks cool, fine, but in my head; that's a bug.PB wrote:> I would actually call this a bug
No, it's not. Not by any stretch of the imagination.
And btw, if you had inserted it in a panel gadget (which has a white background color) then it also gets a white background for the text!
Last edited by Joakim Christiansen on Mon Apr 23, 2007 1:42 pm, edited 2 times in total.
I like logic, hence I dislike humans but love computers.
Re: ContainerGadget gadgets background color...
Hmm, but we were discussing ContainerGadgets, not Frame3DGadgets. 

I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.
- Joakim Christiansen
- Addict
- Posts: 2452
- Joined: Wed Dec 22, 2004 4:12 pm
- Location: Norway
- Contact:
Re: ContainerGadget gadgets background color...
And the gadgets inside it, I have some Frame3DGadgets inside mine.PB wrote:Hmm, but we were discussing ContainerGadgets, not Frame3DGadgets.
I like logic, hence I dislike humans but love computers.
Re: ContainerGadget gadgets background color...
Okay then. 

I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.
- Joakim Christiansen
- Addict
- Posts: 2452
- Joined: Wed Dec 22, 2004 4:12 pm
- Location: Norway
- Contact:
Here is an example to demonstrate what I mean:
And if you comment away the SetGadgetColor line the container gets a gray color, but since it's inside a white panel I think it should be white too.
Code: Select all
OpenWindow(0,0,0,200,150,"Hell yeah",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
CreateGadgetList(WindowID(0))
PanelGadget(0,5,5,190,140)
AddGadgetItem(0,0,"Panel1")
TextGadget(3,50,10,100,20,"Text gadget 1")
ContainerGadget(1,10,40,165,65,#PB_Container_Flat)
SetGadgetColor(1,#PB_Gadget_BackColor,#White)
TextGadget(2,40,20,100,20,"Text gadget 2")
CloseGadgetList()
CloseGadgetList()
Repeat:Until WaitWindowEvent() = #PB_Event_CloseWindow
I like logic, hence I dislike humans but love computers.
This would be a nice idea, but there is a problem:
What do you do, if you have got a checkbox in your container? Checkboxes can't be colored (background-color)
IMHO this feature can't be realized until Fred makes us able to color all gadgets.[/code]
What do you do, if you have got a checkbox in your container? Checkboxes can't be colored (background-color)

IMHO this feature can't be realized until Fred makes us able to color all gadgets.[/code]
PB 4.30
Code: Select all
onErrorGoto(?Fred)
- Joakim Christiansen
- Addict
- Posts: 2452
- Joined: Wed Dec 22, 2004 4:12 pm
- Location: Norway
- Contact:
I know what you mean: You don't want "tons of code" that would be neccessary to color all gadgets in a container.
But this is not possible, as I and Trond said. If it is not possible to change the color of a single checkboxgadget, it is also not possible to change the color of a checkboxgadget (and some other gadgets) via a containergadget.
But this is not possible, as I and Trond said. If it is not possible to change the color of a single checkboxgadget, it is also not possible to change the color of a checkboxgadget (and some other gadgets) via a containergadget.
PB 4.30
Code: Select all
onErrorGoto(?Fred)
However to carry that logic to it's conclusion is to say that because we cannot colour backgrounds for checkboxes via PB then we may as well not have setgadgetcolor.
This would have an option that allows gadgets to "inherit" the bg colour of their containing box (container or scrollarea or whatever). We would still need to do our callback checks on the oddball gadgets, however less effort and less source code required for the support gadgets.
Still reckon its a good idea.
This would have an option that allows gadgets to "inherit" the bg colour of their containing box (container or scrollarea or whatever). We would still need to do our callback checks on the oddball gadgets, however less effort and less source code required for the support gadgets.
Still reckon its a good idea.
Dare2 cut down to size