Forum > Designer

Black background on object's inspector combobox options

<< < (2/3) > >>

Sieben:

--- 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.

--- End quote ---

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  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---    FontColor := ValueComboBox.Canvas.Font.Color;    ValueComboBox.Canvas.Font.Assign(FDefaultValueFont);    if odSelected in State then      ValueComboBox.Canvas.Font.Color := FontColor    else      ValueComboBox.Canvas.Font.Color := clWindowText; 
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...

wp:
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  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.Paintbox1Paint(Sender: TObject);begin  with Paintbox1 do  begin    Canvas.Brush.Color := clWindow;    Canvas.FillRect(0, 0, Width, Height);    Canvas.Pen.Color := clWindowText;    Canvas.Line(0, 0, Width,Height);    Canvas.Line(0, Height, Width, 0);  end;end;

Sieben:
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.

wp:
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:
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. 

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version