Recent

Author Topic: Panel background color different than other components  (Read 11071 times)

Alloc

  • New Member
  • *
  • Posts: 17
Panel background color different than other components
« on: June 17, 2016, 06:01:08 pm »
Hi,

got a little tool with a GUI that I ported to Linux. It makes use of some TPanels and while functionality is ok the panels have a different background than the rest of the UI stuff, even though everything has Color set to clDefault.
Attached a screenshot. You can see the normal background color on the left/bottom/right border of the window or stuff that isn't a panel. Panels have a way darker gray as background, as one can see on the big areas in the lower part of the window.

Is there anything I can do to fix this so I get the same color for everything? Or can I somehow set a TGroupBox to not have a visible border (as the group boxes don't suffer that issue)?

Regards,
Chris
« Last Edit: June 17, 2016, 06:32:49 pm by Alloc »

ezlage

  • Guest
Re: Panel background color different than other components
« Reply #1 on: June 17, 2016, 06:20:19 pm »
Please, attach screenshots!  :D

Alloc

  • New Member
  • *
  • Posts: 17
Re: Panel background color different than other components
« Reply #2 on: June 17, 2016, 06:33:32 pm »
Err, yeah ... this is why my mail client always reminds me to check attachments when I used words like "attach*"  :-[

ezlage

  • Guest
Re: Panel background color different than other components
« Reply #3 on: June 17, 2016, 06:51:43 pm »
Try to change the property Panel.ParentColor from False to True or from True to False.

If not work, try at runtime: Panel.Color:=Form.Color;
« Last Edit: June 17, 2016, 06:53:41 pm by ezlage »

Alloc

  • New Member
  • *
  • Posts: 17
Re: Panel background color different than other components
« Reply #4 on: June 17, 2016, 06:53:29 pm »
Doesn't change anything. I see it updates the panel's color to what is set on the parent (e.g. when I set the panel's color to blue and then enable ParentColor it switches back to clDefault), but it doesn't have any impact on the color (still the darker gray) :(

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Panel background color different than other components
« Reply #5 on: June 17, 2016, 06:54:34 pm »
Well, attach your form's .lfm, so we can see what's wrong. GTK2 panels display clDefault fine here.

ezlage

  • Guest
Re: Panel background color different than other components
« Reply #6 on: June 17, 2016, 06:57:13 pm »
So, try to change the property GROUPBOX.ParentColor from False to True or from True to False.
And/Or Panel.Color:=GROUPBOX.Color; (runtime)

In this case, the parent of the Panel is the GroupBox "Game start options".
« Last Edit: June 17, 2016, 07:02:15 pm by ezlage »

Alloc

  • New Member
  • *
  • Posts: 17
Re: Panel background color different than other components
« Reply #7 on: June 17, 2016, 06:59:16 pm »
Attached another form, same issue (the form in the screenshot includes an image so is unnecessarily big for this issue ;) )

Could it be related to the DE? Using XFCE on an Xubuntu 15.10 over here.


@ezlage: No change either. Also re-checked all components and they are all set to clDefault.

ezlage

  • Guest
Re: Panel background color different than other components
« Reply #8 on: June 17, 2016, 07:04:53 pm »
And if you design the form without Panels?

You can use Anchoring to align components.

Alloc

  • New Member
  • *
  • Posts: 17
Re: Panel background color different than other components
« Reply #9 on: June 17, 2016, 07:18:52 pm »
This might work (though I especially fear the dynamicly created components in the lower box) ... but at least it would require a few updates  :o
But if there's no way to get this fixed without switching away from panels I might look into that as a solution.

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Panel background color different than other components
« Reply #10 on: June 17, 2016, 08:40:08 pm »
Your .lfm shoehorned into a new form shows panels with clDefault for me (GTK2 on Mint).
I removed all the event handlers except OnCreate.
Perhaps XFCE has some quirks?
« Last Edit: June 17, 2016, 08:42:44 pm by howardpc »

Alloc

  • New Member
  • *
  • Posts: 17
Re: Panel background color different than other components
« Reply #11 on: June 18, 2016, 02:23:39 pm »
Yeah, wouldn't be surprised if it's either XFCE or the GTK theming (not even using the default Xubuntu XFCE theme ;) ).

I will look into the anchoring method of defining the layout, if I don't have to use the TPanels it seems like it would look fine.

Alloc

  • New Member
  • *
  • Posts: 17
Re: Panel background color different than other components
« Reply #12 on: June 19, 2016, 01:19:42 am »
Ok, changed to anchoring. Requires a bit more code (as I can't simply add controls and have them placed by childsizing) but other than that it's working fine :)
Thanks ezlage for that hint.

hrittich

  • Newbie
  • Posts: 1
Re: Panel background color different than other components
« Reply #13 on: December 05, 2017, 08:57:10 pm »
This is a Bug in LCL. See here. The bug report contains a patch.

You can use the following workaround. If you assign to your form the color clForm, the Panels get the correct color.
« Last Edit: December 05, 2017, 09:01:10 pm by hrittich »

 

TinyPortal © 2005-2018