TAction has a OnHint event, but unfortunately not a OnHideHint event. This has the following drawback: I have ToolButtons and other controls associated with actions. Whenever the mouse is over such a control, the hint of the Action is shown in the StatusBar; (I have set the StatusBar's AutoHint property to True). But when the mouse leaves the ToolButton, the previous custom text in the StatusBar (which is not from a hint) is NOT automatically restored! Now I could write an OnMouseLeave event handler for each and every control on the form to restore my custom text in the StatusBar, but this would be cumbersome! Isn't there something which automatically restores the previous text in the StatusBar? An OnHideHint event in TAction would be ideal!
That is default behavior, When AutoHint is True, the status bar automatically responds to hint actions by displaying the long version of the hint's text in the first panel.
The issue that you are having is that when you leave a control with your mouse, you are basically entering another window, it's parent control. And because that parent has no Hint string value assigned to it, the HintAction is updated to an empty string.
If you want to return the default value when there is no hint to display then drop a TApplicationEvents component on the form and use the TApplication.OnHint event like this:
var
OriginalPanelText : String = 'BLA';
procedure TForm1.ApplicationEvents1Hint(Sender: TObject);
begin
if StatusBar1.SimplePanel or (StatusBar1.Panels.Count = 0)
then
if Application.Hint <> ''
then
StatusBar1.SimpleText := Application.Hint
else
StatusBar1.SimpleText := OriginalPanelText
else
if Application.Hint <> ''
then
StatusBar1.Panels[0].Text := Application.Hint
else
StatusBar1.Panels[0].Text := OriginalPanelText;
end;