Recent

Author Topic: TLabeledEdit does not show TextHint when it is ReadOnly or not Enabled  (Read 1666 times)

kinlion

  • Jr. Member
  • **
  • Posts: 82
  • I Love Lazarus
As title.

Maybe TEdit is same, but I did not test.

Is it a bug or just designed in such a way?

I have a TLabeledEdit to show a parameter, if user did not input the value(the parameter is empty), I want it shows the default value by TextHint.
However, the parameter is not editable at some time. Thus I make the LabeledEdit ReadOnly or not Enabled, then the TextHint becomes invisible.

Environment:
Win10 x64
Lazarus 2.0.10
FPC 3.2.0
SVN Revision: 63526

Any help will be appreciated.

ASerge

  • Hero Member
  • *****
  • Posts: 2222
I have a TLabeledEdit to show a parameter, if user did not input the value(the parameter is empty), I want it shows the default value by TextHint.
However, the parameter is not editable at some time. Thus I make the LabeledEdit ReadOnly or not Enabled, then the TextHint becomes invisible.
In my opinion, this is normal. If this is a hint and not a label, then since the field cannot be edited, the hint is not needed either.

Bart

  • Hero Member
  • *****
  • Posts: 5275
    • Bart en Mariska's Webstek
On Windows TextHint is implemented natively using the Windows API for that.
So, what you see is the natural behaviour of Windows.

Bart

jamie

  • Hero Member
  • *****
  • Posts: 6090
use something like this instead of disabling it etc..

Code: Pascal  [Select][+][-]
  1. procedure TForm1.LabeledEdit1KeyDown(Sender: TObject; var Key: Word;
  2.   Shift: TShiftState);
  3. begin
  4.   if Key <> VK_TAB Then Key := 0;
  5. end;                                            
  6.  

Setup some flag somewhere to turn it on/off
The only true wisdom is knowing you know nothing

winni

  • Hero Member
  • *****
  • Posts: 3197
Hi!

If TabStop is enabled pressing Tab never reaches the onKey events.

Winni

jamie

  • Hero Member
  • *****
  • Posts: 6090
Yes you got me on that one...

I guess if I was using Lazarus more often I would of noticed that.. . :)
The only true wisdom is knowing you know nothing

 

TinyPortal © 2005-2018