Recent

Author Topic: [CLOSED] Laz 2.0.6: "Dirty" colors for TPanel  (Read 370 times)

wittbo

  • Full Member
  • ***
  • Posts: 108
[CLOSED] Laz 2.0.6: "Dirty" colors for TPanel
« on: February 18, 2020, 09:07:19 am »
Recently I found, that the color for a panel (TPanel) isn't as brilliant as it should be. It's only a problem for TPanel, not for other components: white is not white but light grey, lime and red are a little bit darker. Lime and red are not critical, but white should be white for every component.
This behaviour is reproducable on Laz 2.0.6 only, 2.0.2 was quite OK.
« Last Edit: February 26, 2020, 02:16:35 pm by wittbo »
-wittbo-
MBAir with MacOS 10.14.6 / Lazarus 2.0.6
iMac with MacOS 10.13.6 / Lazarus 2.0.2

wittbo

  • Full Member
  • ***
  • Posts: 108
Re: Laz 2.0.6: "Dirty" colors for TPanel
« Reply #1 on: February 18, 2020, 10:01:24 am »
Just found some workaround. Create a small paint procedure, which fills the canvas of the panel with the panel.color, and save it in the OnPaint notifyevent of the panel. Works except for the caption of the panel, all derived objects are drawn as expected.

Code: Pascal  [Select][+][-]
  1. procedure TForm1.PanelPaint(Sender: TObject);
  2. begin
  3.    with TPanel(Sender) do begin
  4.       Canvas.Brush.Color := Color;
  5.       Canvas.Fillrect (0,0,Width,Height)
  6.    end;
  7. end;
  8.  
  9.  
-wittbo-
MBAir with MacOS 10.14.6 / Lazarus 2.0.6
iMac with MacOS 10.13.6 / Lazarus 2.0.2

wittbo

  • Full Member
  • ***
  • Posts: 108
Re: Laz 2.0.6: "Dirty" colors for TPanel
« Reply #2 on: February 18, 2020, 10:14:31 am »
Just found the bug:

It has to do with the property bevelcolor of the panel: if it is clDefault, then the color of the panel is such dirty. If you choose clNone or any other color as bevelcolor, then the panel color is crystal clear as expected.

I will report this defect in the bugtracker.
-wittbo-
MBAir with MacOS 10.14.6 / Lazarus 2.0.6
iMac with MacOS 10.13.6 / Lazarus 2.0.2

zeljko

  • Hero Member
  • *****
  • Posts: 1139
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Laz 2.0.6: "Dirty" colors for TPanel
« Reply #3 on: February 18, 2020, 11:12:47 am »
Just found the bug:

It has to do with the property bevelcolor of the panel: if it is clDefault, then the color of the panel is such dirty. If you choose clNone or any other color as bevelcolor, then the panel color is crystal clear as expected.

I will report this defect in the bugtracker.

That's not bug. You should use GetColorResolvingParent and in that case clDefault returns real sys color value.

wittbo

  • Full Member
  • ***
  • Posts: 108
Re: Laz 2.0.6: "Dirty" colors for TPanel
« Reply #4 on: February 18, 2020, 01:06:36 pm »
? I never heard form this routine and why is could be necessary. Does this mean, that i have to set the color of the control explicitly in the code (perhaps on create) like: 
myPanel.Color := GetColorResolvingParent  ?

I cannot believe that, because:
1.  Lazarus 2.0.2 (and maybe earlier versions) did not show this behaviour reported by me.
2.  The color of the panel background (myPanel.Color) is influenced by the color of the bevel surrounding the panel (myPanel.Bevelcolor). What has the background color to do with the bevelcolor?
-wittbo-
MBAir with MacOS 10.14.6 / Lazarus 2.0.6
iMac with MacOS 10.13.6 / Lazarus 2.0.2

 

TinyPortal © 2005-2018