[Lazarus] TextHint in TComboBox

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] TextHint in TComboBox

Free Pascal - Lazarus mailing list
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
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] TextHint in TComboBox

Free Pascal - Lazarus mailing list
On 13.08.2020 14:10, Juha Manninen via lazarus 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

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] TextHint in TComboBox

Free Pascal - Lazarus mailing list
On Thu, Aug 13, 2020 at 3:23 PM Ondrej Pokorny via lazarus
<[hidden email]> 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 look at it.

------ 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
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] TextHint in TComboBox

Free Pascal - Lazarus mailing list
On 13.08.2020 15:15, Juha Manninen via lazarus wrote:
> On Thu, Aug 13, 2020 at 3:23 PM Ondrej Pokorny via lazarus
> <[hidden email]> 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

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] TextHint in TComboBox

Free Pascal - Lazarus mailing list
On Thu, Aug 13, 2020 at 6:40 PM Ondrej Pokorny via lazarus
<[hidden email]> 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 now at all. I 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
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] TextHint in TComboBox

vojtech.cihak
In reply to this post by Free Pascal - Lazarus mailing list

Hi,

 

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

 

Vojtěch a.k.a. Blaazen

______________________________________________________________
> Od: "Juha Manninen via lazarus" <[hidden email]>
> Komu: "Lazarus mailing list" <[hidden email]>
> Datum: 13.08.2020 14:10
> Předmět: [Lazarus] TextHint in TComboBox
>

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
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] TextHint in TComboBox

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
On Thu, Aug 13, 2020 at 6:50 PM Juha Manninen <[hidden email]> 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
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] TextHint in TComboBox

Free Pascal - Lazarus mailing list
In reply to this post by vojtech.cihak
On Thu, Aug 13, 2020 at 6:56 PM Vojtěch Čihák via lazarus
<[hidden email]> wrote:
> 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
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] TextHint in TComboBox

Free Pascal - Lazarus mailing list
Please test with r63734.
The 3-state type TEmulatedTextHintStatus and its thsChanging was
needed after all.
Should have tested still more. :(
At least here it works now.

Juha
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] TextHint in TComboBox

vojtech.cihak

Yes, it looks fine now.

 

Thanks!

______________________________________________________________
> Od: "Juha Manninen via lazarus" <[hidden email]>
> Komu: "Lazarus mailing list" <[hidden email]>
> Datum: 13.08.2020 19:36
> Předmět: Re: [Lazarus] TextHint in TComboBox
>

Please test with r63734.
The 3-state type TEmulatedTextHintStatus and its thsChanging was
needed after all.
Should have tested still more. :(
At least here it works now.

Juha
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] TextHint in TComboBox

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
On 13.08.2020 17:58, Juha Manninen via lazarus wrote:

> On Thu, Aug 13, 2020 at 6:50 PM Juha Manninen <[hidden email]> 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

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] TextHint in TComboBox

Free Pascal - Lazarus mailing list
On Thu, Aug 13, 2020 at 9:54 PM Ondrej Pokorny via lazarus
<[hidden email]> 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
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] TextHint in TComboBox

Free Pascal - Lazarus mailing list
On 13.08.2020 21:33, Juha Manninen via lazarus wrote:

> On Thu, Aug 13, 2020 at 9:54 PM Ondrej Pokorny via lazarus
> <[hidden email]> 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

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] TextHint in TComboBox

Free Pascal - Lazarus mailing list
On Fri, Aug 14, 2020 at 9:32 AM Ondrej Pokorny via lazarus
<[hidden email]> 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
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus