Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2020-08

TextHint in TComboBox

14 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Juha Manninen

Regarding issue :
https://bugs.freepascal.org/view.php?id=30682

I added TextHint to TComboBox in r63731. QT5 now works with native TextHint, GTK2 with emulated one.
Native support for Win32 is not implemented yet. Somebody please implement it. Other widgetsets that natively support this feature for TComboBox, should also be updated.

I have a question about TextHint support of TEdit in Win32. The widgetset binding code tests EmulatedTextHintShowing and calls CreateEmulatedTextHintFont from generic LCL code.
Does it mean it actually emulates the feature inside the binding code instead of using a native feature?
It should not be needed as the emulated TextHint works purely in LCL code level. Same thing with QT4 binding code. It also uses emulated TextHint specific stuff. Is it needed?

TextHint in TMemo works only with widgetset's native support. It works with QT5 but not with GTK2.
The emulation for TMemo turned out to be tricky. It may never be implemented, unless somebody provides a patch of course.

Regards,
Juha

Reply by email

Ondrej Pokorny
to Juha Manninen
Juha Manninen wrote
TextHint in TMemo works only with widgetset's native support. It works with QT5 but not with GTK2. The emulation for TMemo turned out to be tricky. It may never be implemented, unless somebody provides a patch of course.

If I am not mistaken, TEdit has TextHint-emulation for WidgetSets without native support. There is no reason why the same emulation shouldn't work with TMemo.

Ondrej

Reply by email

Juha Manninen
to Ondrej Pokorny
PM Ondrej Pokorny wrote
If I am not mistaken, TEdit has TextHint-emulation for WidgetSets without native support. There is no reason why the same emulation shouldn't work with TMemo.

It does not. Actually it never worked. Nobody has tested it maybe because TMemo.TextHint was not published.
The native support eg. with LCL-QT5 does work.
What happened so far:
The emulated TEdit.TextHint was not updated always. I fixed it : https://bugs.freepascal.org/view.php?id=37506
Then I simplified the code in r63725 which broke TMemo's behavior : https://bugs.freepascal.org/view.php?id=37553
Then I realized that emulated TMemo.TextHint never worked and disabled it completely in r63726.
You can test by reverting it. I believe it can be fixed somehow. I will be happy if you take a r63726 ------
function TCustomMemo.CanShowEmulatedTextHint: Boolean; begin
- Result :=
- Assigned(Lines) // CM_EXIT is sent in destroy -> this function is called in destructor when Lines are already destroyed
- and (Lines.Count = 0)
- and inherited CanShowEmulatedTextHint;
+ // CM_EXIT is sent in destroy -> this is called in destructor when Lines are already destroyed
+ //Result := Assigned(Lines) and inherited CanShowEmulatedTextHint;
+ // ToDo: Make this work. The line above does not work with GTK2 at least.
+ Result := False;
end;

Juha

Reply by email

Ondrej Pokorny
to Juha Manninen
Juha Manninen wrote 7 lines
On Thu, Aug 13, 2020 at 3:23 PM Ondrej Pokorny via lazarus wrote: > If I am not mistaken, TEdit has TextHint-emulation for WidgetSets > without native support. There is no reason why the same emulation > shouldn't work with TMemo. It does not. Actually it never worked. Nobody has tested it maybe because TMemo.TextHint was not published.

Emulated TMemo.TextHint (r63708) works perfectly on Win32 (Windows 10). I haven't checked your more recent changes. WinAPI doesn't support TMemo.TextHint natively.

Ondrej

Reply by email

Juha Manninen
to Ondrej Pokorny
PM Ondrej Pokorny wrote
Emulated TMemo.TextHint (r63708) works perfectly on Win32 (Windows 10). I haven't checked your more recent changes. WinAPI doesn't support TMemo.TextHint natively.

AFAIK it is not emulated on Windows. LCL-Win32 reports LCLCapability flag lcTextHint.
There is a related bug report :
https://bugs.freepascal.org/view.php?id=35967

I tested the emulation only with GTK2.
I should have mentioned the problem comes only when adding lines to a Memo by code when the Memo has no focus.
It is demonstrated by the example project in issue #37553.

I don't have Windows was hoping not to install it again as I don't need it for anything. Maybe I must have it for Lazarus testing anyway.

Juha

Reply by email

Juha Manninen
to Juha Manninen: On Thu, Aug 13, 2020 at 6:40 PM Ondrej Pokorny via lazarus AFAIK it is not emulated on…
PM Juha Manninen wrote
AFAIK it is not emulated on Windows. LCL-Win32 reports LCLCapability flag lcTextHint.
Actually it is emulated for older Windows versions.
function TWin32WidgetSet.GetLCLCapability has :
  ...
    lcTextHint:
    begin
      if (ComCtlVersion >= ComCtlVersionIE6) then
        Result := LCL_CAPABILITY_YES
      else
        Result := LCL_CAPABILITY_NO;
    end;

For Windows 10 it should report LCL_CAPABILITY_YES.

Juha

Reply by email

Juha Manninen
to Vojtěch Čihák:   something went wrong. When I open IDE Options or Project Options and I click on any…
PM Vojtěch Čihák wrote 5 lines
something went wrong. When I open IDE Options or Project Options and I click on any item of TreeView, everything disappear. Content of the filter become "(filter)". When I change it (i.e. non-empty string), content is back. And many of the content is italic. Lazarus 2.1.0 r63731M FPC 3.3.1 x86_64-linux-qt

Yours is QT4 I guess.
Damn right, I can reproduce with GTK2 IDE. I mostly tested individual applications only.
I try to figure out what is going on...

Juha

Reply by email

Ondrej Pokorny
to Juha Manninen: Actually it is emulated for older Windows versions. function…
Juha Manninen wrote 15 lines
On Thu, Aug 13, 2020 at 6:50 PM Juha Manninen wrote: > AFAIK it is not emulated on Windows. LCL-Win32 reports LCLCapability > flag lcTextHint. Actually it is emulated for older Windows versions. function TWin32WidgetSet.GetLCLCapability has : ... lcTextHint: begin if (ComCtlVersion >= ComCtlVersionIE6) then Result := LCL_CAPABILITY_YES else Result := LCL_CAPABILITY_NO; end; For Windows 10 it should report LCL_CAPABILITY_YES.

Funnily I tested with themes off, so I got LCL_CAPABILITY_NO :)

But yes, you are correct. That is not optimal. We need to split lcTextHint into lcTextHintEdit and lcTextHintMemo. Because as I wrote before WinAPI doesn't support TextHint for multi-line text boxes (TMemo):
https://docs.microsoft.com/en-us/windows/win32/api/commctrl/nf-commctrl-edit_setcuebannertext

So for TMemo we need the emulated code, which works now with a minor bug (the TextHint is not visible when the form is shown the first time). Strangely the bug is present only in a themed application, not in an unthemed one.

Ondrej

Reply by email

Juha Manninen
to Ondrej Pokorny
PM Ondrej Pokorny wrote
So for TMemo we need the emulated code, which works now with a minor bug (the TextHint is not visible when the form is shown the first time). Strangely the bug is present only in a themed application, not in an unthemed one.

Please test with the demo by Lagunov Aleksey in
https://bugs.freepascal.org/view.php?id=37553
adding the line
Memo1.TextHint:='My own TextHint';
as seen in my note.
Also remember to change function TCustomMemo.CanShowEmulatedTextHint. It now returns False always.
The emulation does not work with GTK2.

Juha

Reply by email

Ondrej Pokorny
to Juha Manninen
Juha Manninen wrote 14 lines
On Thu, Aug 13, 2020 at 9:54 PM Ondrej Pokorny via lazarus wrote: > So for TMemo we need the emulated code, which works now with a minor bug > (the TextHint is not visible when the form is shown the first time). > Strangely the bug is present only in a themed application, not in an > unthemed one. Please test with the demo by Lagunov Aleksey in https://bugs.freepascal.org/view.php?id=37553 adding the line Memo1.TextHint:='My own TextHint'; as seen in my note. Also remember to change function TCustomMemo.CanShowEmulatedTextHint. It now returns False always. The emulation does not work with GTK2.

Why have you removed the (FTextHint '') check in CanShowEmulatedTextHint?

Why should the emulated text hint be shown if there is none?

Ondrej

Reply by email

Juha Manninen
to Ondrej Pokorny
AM Ondrej Pokorny wrote
Why have you removed the (FTextHint '') check in CanShowEmulatedTextHint? Why should the emulated text hint be shown if there is none?

It was restored later as I noticed the same error. First I planned to make it generic code for both TEdit and TCombobox. Then I just copied it.
The latest revision is 63734.

Juha

Reply by email