Recent

Author Topic: Black background on object's inspector combobox options  (Read 6408 times)

bpranoto

  • Full Member
  • ***
  • Posts: 134
Black background on object's inspector combobox options
« on: November 01, 2020, 12:24:06 pm »
I just installed lazarus 2.0.10/fpc 3.2.0

In the form's object inspector if I click the dropdown button of a property which is a combobox, the options displayed have a black on black color so the unhilited texts are invisible.

Please see the screenshot attached.

O/S: Linux ubuntu 18.04

What is the configuration option to fix it?


Sieben

  • Sr. Member
  • ****
  • Posts: 310
Re: Black background on object's inspector combobox options
« Reply #1 on: December 01, 2020, 09:45:51 pm »
Just want to raise this once more, because it is in fact sort of annoying and it does not seem to be fixed with trunk either. There has also been a bug report one and a half year ago:

https://bugs.freepascal.org/view.php?id=35375

though it is a bit misleading in that it mentions DBComboBox.

I can confirm this for Linux Ubuntu 16.04 / GTK2 as well, and as well did not find any settings yets to correct this with IDE / Objectinspector options.
Lazarus 2.2.0, FPC 3.2.2, .deb install on Ubuntu Xenial 32 / Gtk2 / Unity7

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Black background on object's inspector combobox options
« Reply #2 on: December 01, 2020, 11:47:41 pm »
Hi!

Some people might think this is not fair, BUT:

Numer One in "This does not work - that does not work" is the rotten Apple. No discussion now.
But Numer Two is allways Ubuntu.

Based on Debian. Debian does not know nothing about desktops and is always too late with fixing errors. It is a good and stable server system. Point.

Ubuntu is know to be full of errors especialy concerning the desktop.

There are so many Linux around which bevave well, have knowledge about different desktops and cause less trouble with fpc/Lazarus.

In Germany Ubuntu is often used in school because it fits to the knowledge of the teachers.
But schools out forever. Become adult and use some other Linux.
I avoid name dropping.
It's about the problems of Ubuntu.

I have never seen such a dropdown-black-box like above.
With a lot of different Linux and Lazarus - even Debian.

So change your Linux-OS.
Not to start a  flame-war.
Just to reduce the problems.

Winni

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Black background on object's inspector combobox options
« Reply #3 on: December 02, 2020, 12:37:53 am »
I have never seen such a dropdown-black-box like above.
With a lot of different Linux and Lazarus - even Debian.

So change your Linux-OS.

I have never seen it in any Ubuntu system either, and I've been using quite a lot of them with quite a lot of differents desktops (Ubuntu, Xubuntu Lubuntu, Kubuntu, ...) since 2006 and I've heard of all kind of weird problems with other distros, so no: it's not fair.

This really seems to be just a weird iteraction between the system's theme and Lazarus widgetset, probably agravated by the use of Unity in Ubuntu 16. One small test you could perform would be to see if it also happens if you restart in a gnome-fallback session or if you update to, say, Ubuntu 18. Or change your theme; way easier than changing to another distro ;)
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

Zoran

  • Hero Member
  • *****
  • Posts: 1829
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: Black background on object's inspector combobox options
« Reply #4 on: December 02, 2020, 11:56:36 am »
But... Changing the development distribution or desktop manager will not solve that, when you put a combo box on a form, you don't know if the bug will appear in your application on your user's desktop.


Sieben

  • Sr. Member
  • ****
  • Posts: 310
Re: Black background on object's inspector combobox options
« Reply #5 on: December 04, 2020, 09:16:01 pm »
Quote from: Zoran
But... Changing the development distribution or desktop manager will not solve that, when you put a combo box on a form, you don't know if the bug will appear in your application on your user's desktop.

It does not seem to be a bug with the component or widgetset - a standard TComboBox or TDBComboBox will draw correct with white text on black background. Had another look today and the problem seems to be due to the last line of this piece of code in TOICustomPropertyGrid.ValueComboBoxDrawItem in ObjectInspector.pp:

Code: Pascal  [Select][+][-]
  1.     FontColor := ValueComboBox.Canvas.Font.Color;
  2.     ValueComboBox.Canvas.Font.Assign(FDefaultValueFont);
  3.     if odSelected in State then
  4.       ValueComboBox.Canvas.Font.Color := FontColor
  5.     else
  6.       ValueComboBox.Canvas.Font.Color := clWindowText;
  7.  

which results in black on black with every theme that uses black as background color for combobox dropdowns. Changing that to clHighLightText at least fixes the problems with my setup here, but is not a general solution, of course...
« Last Edit: December 06, 2020, 09:36:11 pm by Sieben »
Lazarus 2.2.0, FPC 3.2.2, .deb install on Ubuntu Xenial 32 / Gtk2 / Unity7

wp

  • Hero Member
  • *****
  • Posts: 11853
Re: Black background on object's inspector combobox options
« Reply #6 on: December 04, 2020, 10:58:15 pm »
What's wrong with clWindowText? It is the color provided by the widgetset/themeServices for text on a window background painted in color clWindow. In bright themes, clWindow is bright (usually white), and clWindowText is dark (usually black). But in dark themes, clWindow is dark and clWindowText is bright.

I just checked it on a Mint VM - see following code and attached screenshots. So, nothing wrong with the cited piece of code.

Code: Pascal  [Select][+][-]
  1. procedure TForm1.Paintbox1Paint(Sender: TObject);
  2. begin
  3.   with Paintbox1 do
  4.   begin
  5.     Canvas.Brush.Color := clWindow;
  6.     Canvas.FillRect(0, 0, Width, Height);
  7.     Canvas.Pen.Color := clWindowText;
  8.     Canvas.Line(0, 0, Width,Height);
  9.     Canvas.Line(0, Height, Width, 0);
  10.   end;
  11. end;

Sieben

  • Sr. Member
  • ****
  • Posts: 310
Re: Black background on object's inspector combobox options
« Reply #7 on: December 04, 2020, 11:18:16 pm »
Please have a look at the picture the original OP provided with his first post. That's what's wrong with it. Problem is, this apparently isn't really a 'dark theme' - just the menu background and the background of dropdowns are black. So clWindowText on this theme is black as well and this results in black on black.
Lazarus 2.2.0, FPC 3.2.2, .deb install on Ubuntu Xenial 32 / Gtk2 / Unity7

wp

  • Hero Member
  • *****
  • Posts: 11853
Re: Black background on object's inspector combobox options
« Reply #8 on: December 05, 2020, 01:32:39 am »
OK. Since this seems to be a buggy theme you should fix the colors in Tools > Options > Object Inspector > Color > Background/Highlight Font Color/Property Name/etc  instead of editing the font color in the Lazarus object inspector sources.

Sieben

  • Sr. Member
  • ****
  • Posts: 310
Re: Black background on object's inspector combobox options
« Reply #9 on: December 05, 2020, 02:09:17 am »
Been there, tried that but - as stated in my first post here (Reply#1) - couldn't find any combination of settings that would fix this. However, the buggy theme works for standard comboboxes. And it is the default theme of a standard install. 
Lazarus 2.2.0, FPC 3.2.2, .deb install on Ubuntu Xenial 32 / Gtk2 / Unity7

Sieben

  • Sr. Member
  • ****
  • Posts: 310
Re: Black background on object's inspector combobox options
« Reply #10 on: December 07, 2020, 10:19:09 pm »
Tried to get some more info on this - the buggy theme apparently is Unity7 which came with Ubuntu Xenial and will, after all I've read, sort of fade away with it. What I don't know, however, is whether there are similar desktop designs which feature a 'bright' theme with dark combobox dropdowns or menus. So the questions is whether it's worth to put effort in this. On the other hand Xenial might be around for some more time than it's supported for afaik it's the last 32bit Ubuntu distribution.

Btw, this is what the colorbox in the IDE settings looks like, and this time the standard LCL TColorBox is affected as well:
Lazarus 2.2.0, FPC 3.2.2, .deb install on Ubuntu Xenial 32 / Gtk2 / Unity7

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: Black background on object's inspector combobox options
« Reply #11 on: December 08, 2020, 10:29:38 am »
I guess it could be fixed by a new setting for IDE ComboBoxes somewhere. A patch would be applied.
I set issue :
 https://bugs.freepascal.org/view.php?id=34240
related to issue :
 https://bugs.freepascal.org/view.php?id=35375
although they are a little different.
#34240 is about a custom drawn CheckBox made for OI. Both are related to themes.
People who use different themes and these issues bother, please provide patches to fix them.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Sieben

  • Sr. Member
  • ****
  • Posts: 310
Re: Black background on object's inspector combobox options
« Reply #12 on: December 08, 2020, 02:30:41 pm »
As for the OI combobox issue - which is the most annoying imo - I still think it should be possible to somehow test the background of the dropdown for 'brightness' and set Font.Color to either clWindowText or clHighLightText accordingly in the OnDrawItem handler of objectinspector.pp as posted above in Reply #5 and without introducing new color settings. I'd post a suggestion if I weren't such a noob when it comes to graphics. Maybe someone more knowledgeable might jump in...?

The TColorBox issue is a bit different, however. While the standard LCL TComboBox draws ok, TColorBox doesn't. This is not just an IDE issue, but a LCL one. A similar approach as suggested above should fix this too, but imo would have to be done in TColorBox.DrawItem method. Should I file another report on this one and relate it to #35375...?
« Last Edit: December 08, 2020, 02:35:49 pm by Sieben »
Lazarus 2.2.0, FPC 3.2.2, .deb install on Ubuntu Xenial 32 / Gtk2 / Unity7

szlbz

  • New Member
  • *
  • Posts: 20
Re: Black background on object's inspector combobox options
« Reply #13 on: May 28, 2022, 02:22:10 pm »
I just installed lazarus 2.0.10/fpc 3.2.0

In the form's object inspector if I click the dropdown button of a property which is a combobox, the options displayed have a black on black color so the unhilited texts are invisible.

Please see the screenshot attached.

O/S: Linux ubuntu 18.04

What is the configuration option to fix it?

open /lcl/include/customcombobox.inc
Code: Pascal  [Select][+][-]
  1. procedure TCustomComboBox.DrawItem(Index: Integer; ARect: TRect;
  2.   State: TOwnerDrawState);
  3. begin
  4.   //TControlCanvas(FCanvas).UpdateTextFlags;
  5.   {$ifdef linux}
  6.   FCanvas.FillRect(ARect);//Add this line
  7.   {$endif}
  8.   if Assigned(FOnDrawItem) then
  9.     FOnDrawItem(Self, Index, ARect, State)
  10.   else
  11.   begin
  12.     if not (odBackgroundPainted in State) then
  13.       FCanvas.FillRect(ARect);
  14.     InternalDrawItem(Self, FCanvas, ARect, Items[Index])
  15.   end;
  16. end;
  17.  

After modification, the problems of Object Inspector and combobox and colorbox are solved。
« Last Edit: May 28, 2022, 02:34:01 pm by szlbz »

AlexTP

  • Hero Member
  • *****
  • Posts: 2383
    • UVviewsoft
Re: Black background on object's inspector combobox options
« Reply #14 on: May 28, 2022, 02:30:02 pm »
@szlbz
Is this a patch for LCL which is always needed? If so we need it in the bugtracker.

But it must be not {$ifdef linux} but {$ifdef LCLgtk2}. Because BSD systems use the same GTK2.
« Last Edit: May 28, 2022, 02:33:01 pm by AlexTP »

 

TinyPortal © 2005-2018