Forum > LCL

TStatusBar.AutoHint without hint popup?

(1/1)

Rudi1703:
Finally arrived here from D7 (and not quite sure if this is the right place for my question...)

In my D7 apps, I used TStatusBar.AutoHint = true and TForm.ShowHint = false. While the mouse hovers over a component, its hint will be shown in the status bar. This happens regardless of the components property ShowHint. With the components property ShowHint I controlled the hint popup display separately for specific components.

With Lazarus (0.9.28.2 r22279 FPC 2.2.4 i386-win32-win32/win64), I found no way to display the hint in the status bar without getting the popup hint, too.

Is this a bug or a feature? Any work around known?

As of http://www.lazarus.freepascal.org/index.php/topic,4697.0.html, there seems to be a relation to the forms ShowHint property. Is this true?

TIA, Rudi

mas steindorff:
from what I remember of D5, it's the same way for Lazarus only the OnShowHint event does not appear in the object inspector (yet).

this works for me:

--- Code: ---...
   FormCreate
   ...
    RgCardType.OnShowHint := @myShowHint;  // RgCardType is a tradiogroup in this case
end;

procedure Tfrm.myShowHint(Sender: TObject; info:PHintinfo);
begin
  StatusBar1.SimpleText:=info^.HintStr;
end;


--- End code ---

<edit>  just retested it and I guess I also get the popup too

mas steindorff:
OK, finally got it working with short and long hints


--- Code: ---add this line or use the object inspector
RgCardType.Hint:='short |long hint';

procedure TfrmTConfig.myShowHint(Sender: TObject; info:PHintinfo);
var str:string;
begin
  str:= GetLongHint(Tcontrol(sender).Hint);// info^.HintStr is just the short string
  StatusBar1.SimpleText := str;
end;


--- End code ---

If I start the hint out as '|this is my hint" I do not see the popup

Rudi1703:
Thanks mas!

It is sufficient to prefix the hint with "|" to suppress the popup hint. IMHO a little bit more Delphi compatibility would be fine...

Rudi

Navigation

[0] Message Index

Go to full version