Page 1 of 2
ContainerGadget gadgets background color...
Posted: Mon Apr 23, 2007 10:30 am
by Joakim Christiansen
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!
Posted: Mon Apr 23, 2007 10:49 am
by Derek
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.
Posted: Mon Apr 23, 2007 10:51 am
by Dare
Derek wrote: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.
That sounds like it could be handy.
Re: ContainerGadget gadgets background color...
Posted: Mon Apr 23, 2007 12:36 pm
by PB
> 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:
Code: Select all
c=GetGadgetColor(#1,#PB_Gadget_BackColor)
For gad = #2 To #9
SetGadgetColor(gad,#PB_Gadget_BackColor,c)
Next
> I would actually call this a bug
No, it's not. Not by any stretch of the imagination.
Re: ContainerGadget gadgets background color...
Posted: Mon Apr 23, 2007 12:41 pm
by Dare
PB wrote:Maybe as an optional flag, but not by default.
I agree.
That would make it workable with old and new code and to the coders preference.
Re: ContainerGadget gadgets background color...
Posted: Mon Apr 23, 2007 1:31 pm
by Joakim Christiansen
PB wrote:> I would actually call this a bug
No, it's not. Not by any stretch of the imagination.
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.
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!
Re: ContainerGadget gadgets background color...
Posted: Mon Apr 23, 2007 1:40 pm
by PB
Hmm, but we were discussing ContainerGadgets, not Frame3DGadgets.

Re: ContainerGadget gadgets background color...
Posted: Mon Apr 23, 2007 1:41 pm
by Joakim Christiansen
PB wrote:Hmm, but we were discussing ContainerGadgets, not Frame3DGadgets.

And the gadgets inside it, I have some Frame3DGadgets inside mine.
Re: ContainerGadget gadgets background color...
Posted: Mon Apr 23, 2007 1:43 pm
by PB
Okay then.

Posted: Sat Apr 28, 2007 7:10 pm
by Joakim Christiansen
Here is an example to demonstrate what I mean:
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
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.
Posted: Sat Apr 28, 2007 7:44 pm
by AND51
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]
Posted: Sun Apr 29, 2007 10:42 am
by Trond
It's not possible to change the background colour of a panel, so saying that you want the same behaviour when you change the background colour of a containergadget as you get when you change the colour of a panel doesn't make any sense.
Posted: Sun Apr 29, 2007 11:08 am
by Joakim Christiansen
What I say makes very much sense if you understand what I mean.

Posted: Sun Apr 29, 2007 11:16 am
by AND51
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.
Posted: Sun Apr 29, 2007 12:16 pm
by Dare
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.