Lazarus

Free Pascal => Beginners => Topic started by: Luciano Andress Martini on November 06, 2018, 07:40:54 pm

Title: Balloonhint or Popupnotifier are on white text with white background (solved)
Post by: Luciano Andress Martini on November 06, 2018, 07:40:54 pm
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...



Title: Re: Balloonhint is openning with text white, background white and i cant change it
Post by: Handoko on November 06, 2018, 07:47:08 pm
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).
Title: Re: Balloonhint is openning with text white, background white and i cant change it
Post by: Luciano Andress Martini on November 07, 2018, 02:54:15 pm
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.

Title: Re: Balloonhint is openning with text white, background white and i cant change it
Post by: wp on November 07, 2018, 04:07:56 pm
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:
Test and report back.
Title: Re: Balloonhint is openning with text white, background white and i cant change it
Post by: Luciano Andress Martini on November 07, 2018, 06:01:01 pm
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.
Title: Re: Balloonhint is openning with text white, background white and i cant change it
Post by: bonmario on November 07, 2018, 06:17:02 pm
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
Title: Re: Balloonhint is openning with text white, background white and i cant change it
Post by: Luciano Andress Martini on November 07, 2018, 06:33:08 pm
I think yes, because i am using tpopupnotifier now instead of baloonhint.
Title: Re: Balloonhint is openning with text white, background white and i cant change it
Post by: wp on November 07, 2018, 06:41:47 pm
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.
Title: Re: Balloonhint is openning with text white, background white and i cant change it
Post by: bonmario on November 07, 2018, 07:40:52 pm
Ok, thanks
TinyPortal © 2005-2018