Recent

Author Topic: Balloonhint or Popupnotifier are on white text with white background (solved)  (Read 5218 times)

Luciano Andress Martini

  • New Member
  • *
  • Posts: 43
Good afternoon i am trying to make balloonhint to open in the right color.

I am using gnome on debian 9, it always open white and with text white, how do i change the text and the hint box color?

The same occurs if i try popup notifier...



« Last Edit: November 08, 2018, 06:27:46 pm by Luciano Andress Martini »

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
You can change hint color by using TApplicationProperties component, it usually can be found on the "Additional" component tab (the second tab from the left).

Luciano Andress Martini

  • New Member
  • *
  • Posts: 43
It does not make any effect. The text is still white with the box in white.

I am able to change the box color to black and this solves the bug on Debian, but if then the application runs in Windows or in another Linux distribution, then i will have black box with black text.

If i am able to force some text and background colors it will be lots better!

The workaround that i found for now is to use tpopupnotifier with background as clMedGray, that looks like good with white or black text, but i think this is not a real solution.

« Last Edit: November 07, 2018, 03:10:28 pm by Luciano Andress Martini »

wp

  • Hero Member
  • *****
  • Posts: 11858
Which kind of BalloonHint do you mean? The one which opens with TPopupNotifier or the one which opens from TTrayIcon? Or another one? Please be more specific.

[EDIT]
Studying the code of TTrayIcon I get the impression that it uses a TPopupNotifier to display the BalloonHint. Can you confirm this? I don't have much experience with these components, but it seems to me that TPopupNotifier should have a property to control the fonts of the Text and the Title.

[EDIT-2]
Something else which I don't understand: You write in the first post that you have white text on white background. Why white? According to the sources, the background color of the hint window should be $00DCFFFF which is some pale yellow. Hard-coding this value seems to be a bug in my opinion. I think the correct value should be clInfoBk since the text and title labels of the hint window have the text color clInfoText - these two colors are a matching pair and the widgetset should make sure that there is sufficient contrast always.

[EDIT-3]
I don't want to wait for the answer. Using $DCFFFF as hint windows background color is certainly wrong and shows for me on Linux/gtk2 a similar symptom as reported: In this widgetset clInfoText is a bright text color, and together with the pale yellow background color this results in almost inivisible text.  Defaulting Color to clInfoBk, however, results in bright text on dark background. Switching to Linux/qt or Windows I get black text on pale yellow background, because the colors clInfoBk and clInfoText are different now, but it is a legible combination again.

Therefore, I applied this fix to Lazarus trunk. If you do not use trunk you can fix it easily by yourself:
  • Open the unit popupnotifier.pas in folder "lcl" of you Lazarus installation
  • Near line 245, in TNotifierForm.Create, you'll find the instruction "Color := $DCFFFF". Replace it by "Color := clInfoBk;".
  • Recompile the IDE ("Tools" > "Build Lazarus with profile..."
  • After a while Lazarus restarts and should have the fix built-in.
Test and report back.
« Last Edit: November 07, 2018, 05:35:49 pm by wp »

Luciano Andress Martini

  • New Member
  • *
  • Posts: 43
Solved!

Thank you that's fine, it is working now (Using the proposed solution in [EDIT-3])!
The answers says that it solves for QT or Win32, i am using GTK2 here, so i think it is very portable.

The full solution by user wp was:
    Open the unit popupnotifier.pas in folder "lcl" of you Lazarus installation
    Near line 245, in TNotifierForm.Create, you'll find the instruction "Color := $DCFFFF". Replace it by "Color := clInfoBk;".
    Recompile the IDE ("Tools" > "Build Lazarus with profile..."
    After a while Lazarus restarts and should have the fix built-in.

The quick solution (for popupnotifier) was:
    Change background to clInfoBk in popupnotifier - that is compatible with Windows themes or Linux, including QT or GTK.
« Last Edit: November 09, 2018, 12:40:33 pm by Luciano Andress Martini »

bonmario

  • Sr. Member
  • ****
  • Posts: 346
Therefore, I applied this fix to Lazarus trunk. If you do not use trunk you can fix it easily by yourself:


I'm wrong or this solves also this issue?
https://bugs.freepascal.org/view.php?id=32248

Thanks in advance, Mario

Luciano Andress Martini

  • New Member
  • *
  • Posts: 43
I think yes, because i am using tpopupnotifier now instead of baloonhint.

wp

  • Hero Member
  • *****
  • Posts: 11858
Thank you thats fine, it is working now!
OK. I'll request back-porting to Laz v2.0RC3 then.

@bonmario: I think it should solve the poor text visibility. The feature request, however, is about adding a property for changing the text color. I think this is a good idea, and I assigned the bugreport to myself and will implement this - it is not difficult. I'd like to go a step further and add standard Font properties for Text and Title which gives the user further control.

bonmario

  • Sr. Member
  • ****
  • Posts: 346
Ok, thanks

 

TinyPortal © 2005-2018