ContainerGadget gadgets background color...

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Joakim Christiansen
Addict
Addict
Posts: 2452
Joined: Wed Dec 22, 2004 4:12 pm
Location: Norway
Contact:

ContainerGadget gadgets background color...

Post 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!
I like logic, hence I dislike humans but love computers.
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post 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.
Dare
Addict
Addict
Posts: 1965
Joined: Mon May 29, 2006 1:01 am
Location: Outback

Post 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.
Dare2 cut down to size
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: ContainerGadget gadgets background color...

Post 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.
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.
Dare
Addict
Addict
Posts: 1965
Joined: Mon May 29, 2006 1:01 am
Location: Outback

Re: ContainerGadget gadgets background color...

Post 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.
Dare2 cut down to size
User avatar
Joakim Christiansen
Addict
Addict
Posts: 2452
Joined: Wed Dec 22, 2004 4:12 pm
Location: Norway
Contact:

Re: ContainerGadget gadgets background color...

Post 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!
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.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: ContainerGadget gadgets background color...

Post by PB »

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.
User avatar
Joakim Christiansen
Addict
Addict
Posts: 2452
Joined: Wed Dec 22, 2004 4:12 pm
Location: Norway
Contact:

Re: ContainerGadget gadgets background color...

Post by Joakim Christiansen »

PB wrote:Hmm, but we were discussing ContainerGadgets, not Frame3DGadgets. :)
And the gadgets inside it, I have some Frame3DGadgets inside mine.
I like logic, hence I dislike humans but love computers.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: ContainerGadget gadgets background color...

Post by PB »

Okay then. :)
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
Joakim Christiansen
Addict
Addict
Posts: 2452
Joined: Wed Dec 22, 2004 4:12 pm
Location: Norway
Contact:

Post 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.
I like logic, hence I dislike humans but love computers.
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post 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) :P
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)
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post 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.
User avatar
Joakim Christiansen
Addict
Addict
Posts: 2452
Joined: Wed Dec 22, 2004 4:12 pm
Location: Norway
Contact:

Post by Joakim Christiansen »

What I say makes very much sense if you understand what I mean. :lol:
I like logic, hence I dislike humans but love computers.
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post 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.
PB 4.30

Code: Select all

onErrorGoto(?Fred)
Dare
Addict
Addict
Posts: 1965
Joined: Mon May 29, 2006 1:01 am
Location: Outback

Post 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.
Dare2 cut down to size
Post Reply