Recent

Author Topic: TEdit.TextHint  (Read 5558 times)

mdalacu

  • Full Member
  • ***
  • Posts: 233
    • dmSimpleApps
TEdit.TextHint
« on: November 06, 2020, 04:31:48 pm »
Hi, i have obeserved that TextHint property is not working properly on Lazarus 2.0.8 on Win10.
Before if you had  Text:='' and ShowHint checked  The font in Editbox was italic and gray and was showing what you haad put in TextHint.
Now the text shows but with the same font as Text propery so you can not differetiate between hint and text...
Is the same for you, is it a bug, am i doing something wrong?
Thank you!

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: TEdit.TextHint
« Reply #1 on: November 06, 2020, 05:42:28 pm »
It works as it should here (Laz/fpc 2.0.10/3.2.0, Linux-gtk2 x86_64) so it might be something widgetset-dependant or a bug that was fixed.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: TEdit.TextHint
« Reply #2 on: November 06, 2020, 06:01:06 pm »
For me (Win 10), the texthint is upright, too, but it is in some kind of gray color - I do agree that it is a bit difficult to discern. I went back to Laz 2.0.6, 2.0.2 and 1.8.4 and found that it always looks the same. Please specify the Laz version in which it was drawn italic.

Since the TextHint is drawn entirely by the widgetset on Windows I could imagine that one of the recent Windows updates changed the text hint behavior - just a gues...

mdalacu

  • Full Member
  • ***
  • Posts: 233
    • dmSimpleApps
Re: TEdit.TextHint
« Reply #3 on: November 07, 2020, 07:46:48 am »
So, the lazarus Version is 2.0.8 and Windows version is 20.10.
I have pout two screenshots one the way it is now and one how it behaved in the past...
More greyed and italic....
Thanks.

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: TEdit.TextHint
« Reply #4 on: November 07, 2020, 08:50:25 am »
Well, at least it's still gray. Looks like there has been some change in your Windows style/theme configuration, can it be? What happens if you try with a program compiled before the change?
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

mdalacu

  • Full Member
  • ***
  • Posts: 233
    • dmSimpleApps
Re: TEdit.TextHint
« Reply #5 on: November 07, 2020, 09:22:10 am »
The picture on top is with the program compiled sometime in 2018 and the one below is how any editbox looks now.
I have no custom theme.
I have recompiled it now and  this is the way it looks...no italic, so it is very difficult to differentiate between normal text and a hint, especially on hi rez devices.
« Last Edit: November 07, 2020, 09:30:36 am by mdalacu »

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: TEdit.TextHint
« Reply #6 on: November 07, 2020, 10:39:13 am »
I should have gone back by one more version... When I test the issue with Laz 1.6.4 I do see the italic texthint, and there are additional properties TextHintFontColor and TextHintFontStyle. The svn commit notes of r53365 (Nov 14, 2016) say: "rewrite TextHint emulation, use WinAPI if available." This means that now the TextHint follows the Lazarus idea to use the widgetset as much as possible to control the appearance and behaviour of the controls. In widgetsets where the TEdit does not have a TextHint it is emulated., in the others (Win10, definitely) the native TextHint is used. I guess there is not much that can be done against it.

mdalacu

  • Full Member
  • ***
  • Posts: 233
    • dmSimpleApps
Re: TEdit.TextHint
« Reply #7 on: November 07, 2020, 10:42:55 am »
Yes  wp, thank you for this. I was afraid of this...it was a nice and useful feature.
i also found this and deducted the same thing..:/

..from StdCtrls
Code: Pascal  [Select][+][-]
  1. initialization
  2.   RegisterPropertyToSkip(TCustomEdit, 'TextHintFontColor','Used in a previous version of Lazarus','');
  3.   RegisterPropertyToSkip(TCustomEdit, 'TextHintFontStyle','Used in a previous version of Lazarus','');
  4. end.  
 

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4468
  • I like bugs.
Re: TEdit.TextHint
« Reply #8 on: November 07, 2020, 08:35:13 pm »
Do other native Windows apps show the hint in Italic style? IOW, does the WinAPI somehow support it?

Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: TEdit.TextHint
« Reply #9 on: November 07, 2020, 10:11:45 pm »
Looking through several Microsoft applications which are on my system I only found upright texthints, the gray color seems to be noticeably brighter, though.

Juha, if I understand correctly, the LCL contains code to emulate the text hint for those widgetsets which do not support a native texthint. But then it should be possible the provide some kind of global switch to force using the emulated text hint if the user wants to. This would solve the OP's issue.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4468
  • I like bugs.
Re: TEdit.TextHint
« Reply #10 on: November 08, 2020, 11:19:33 am »
The global switch could be just a compile time define. See the attached patch.
Then, should there be a property for FontStyle, or should the style always be Italic? It becomes more complicated.

[Edit] Oops, it should be IFNDEF obviously. Take it as a concept, I didn't test it.
« Last Edit: November 08, 2020, 11:38:15 am by JuhaManninen »
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Bart

  • Hero Member
  • *****
  • Posts: 5290
    • Bart en Mariska's Webstek
Re: TEdit.TextHint
« Reply #11 on: November 08, 2020, 11:55:56 am »
The problem with emulating TextHint (in the way I did in the first implementation of TextHint) is that when you change the font of the control when the TextHint is showing this will lead to unexpected results.
I did not see any solution for that.

In hindsight I think that implementing TextHintFontStyle and TextHintFontStyle was a mistake, it just overcomplicated things.
Italic and a little less font weight should be OK for any system that does not implement this natively.

Bart

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4468
  • I like bugs.
Re: TEdit.TextHint
« Reply #12 on: November 08, 2020, 05:48:03 pm »
Italic and a little less font weight should be OK for any system that does not implement this natively.
Italic sounds good because it is distinct from a text entered by user.
However many widgetsets, including WinAPI, don't use Italic. I don't know why.
LCL's policy is to use native widget behavior, thus logically native TextHint should be used when available.
Maybe the emulated one should be always Italic and a compile time define should force it to be emulated always. Patches, anyone?
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Bart

  • Hero Member
  • *****
  • Posts: 5290
    • Bart en Mariska's Webstek
Re: TEdit.TextHint
« Reply #13 on: November 08, 2020, 11:05:18 pm »
Italic and a little less font weight should be OK for any system that does not implement this natively.
Italic sounds good because it is distinct from a text entered by user.
However many widgetsets, including WinAPI, don't use Italic. I don't know why.
LCL's policy is to use native widget behavior, thus logically native TextHint should be used when available.
Maybe the emulated one should be always Italic and a compile time define should force it to be emulated always. Patches, anyone?

I was talking about the emulated TextHint there.

Bart

 

TinyPortal © 2005-2018