RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TApplicationEvents.OnShowHint Event

Occurs when the application is about to display the hint window for a Help Hint.

Pascal
property OnShowHint: TShowHintEvent;
C++
__property TShowHintEvent OnShowHint;

Write an OnShowHint event handler to change the appearance and behavior of Help Hints. 

The HintStr parameter sets the text of the Help Hint. To obtain the text of a hint for a particular control, call the GetLongHint or GetShortHint function, assigning the result to HintStr. To change the text, change the value of this string. 

Use the CanShow parameter to permit or prevent the Help Hint from displaying. If CanShow is true, the Help Hint displays. If it is false, the Help Hint does not appear.

Note: Call the CancelDispatch method from an OnShowHint event handler to prevent the application from forwarding the event to any other application events objects.
 

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!