RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TCustomApplicationEvents.OnHint Event

Occurs when the mouse pointer moves over a control or menu item that can display a Help Hint.

Pascal
property OnHint: TNotifyEvent;
C++
__property TNotifyEvent OnHint;

Write an OnHint event handler to perform special processing when the mouse pauses over a control or menu item whose Hint property is not an empty string (' "" ').  

A common use of the OnHint event is to display the value of a control or menu item's Hint property as the text of a status bar (TStatusBar). The Hint property of a control can specify both a short Help Hint and a (usually) longer hint that appears elsewhere because of code in an OnHint event handler.

Note: Call the CancelDispatch method from an OnHint event handler to prevent the application from forwarding the event to any other application events objects.
Tip: Component writers can respond to the automatically-fired THintAction action in a component's ExecuteAction method rather than relying on an OnHint event handler.
 

C++ Examples: 

 

/*
This example requires a TApplicationEvents and a TListBox
in the form.  Select the TApplicationEvents, double click
on the OnHint event and the OnShowHint event and add the
following code to the handlers.  OnHint is triggered when
the mouse passes over the control. OnShowHint is triggered
when the mouse passes over the control and the application
is about to display the hint window for a Help Hint
*/
void __fastcall TAppEventForm::ApplicationEventsHint(TObject *Sender)
{
    lbOther->Items->Add("Event OnHint");
}

void __fastcall TAppEventForm::ApplicationEventsShowHint(AnsiString &HintStr,
      bool &CanShow, Forms::THintInfo &HintInfo)
{
    lbOther->Items->Add("Event OnShowHint");
}

 

Delphi Examples: 

{
This example requires a TApplicationEvents and a TListBox
in the form.  Select the TApplicationEvents, double click
on the OnHint event and the OnShowHint event and add the
following code to the handlers.  OnHint is triggered when
the mouse passes over the control. OnShowHint is triggered
when the mouse passes over the control and the application
is about to display the hint window for a Help Hint
}
procedure TMainForm.ApplicationEventsHint(Sender: TObject);
begin
  lbOther.Items.Add('Event OnHint');
end;

procedure TMainForm.ApplicationEventsShowHint(var HintStr: String;
  var CanShow: Boolean; var HintInfo: THintInfo);
begin
  lbOther.Items.Add('Event OnShowHint');
end;

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!