RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
THintAction Class

THintAction is the action that executes when the user pauses the mouse over a control or menu item that has a hint.

Pascal
THintAction = class(TCustomAction);
C++
class THintAction : public TCustomAction;

StdActns

Do not use THintAction in an action manager or action list the way you would use other predefined actions. THintAction is not intended to work with a client control. Rather, it is used by the application object. 

When the user pauses the mouse over a control or menu item that defines its Hint property, the application responds in one of two ways: 

If the application has an OnHint event handler, it generates an OnHint event. 

If there is no OnHint event handler, the application executes a THintAction object. 

When THintAction executes, it calls the ExecuteAction method of potential target controls until a control is found to respond to the action. Some controls, such as TStatusBar, override the ExecuteAction method to respond to THintAction. 

Component writers can override the ExecuteAction method of a new component to respond to THintAction by displaying hint messages. Such an ExecuteAction method might look like the following:

function TMyControl.ExecuteAction(Action: TBasicAction): Boolean;
var
  HintText: string;
begin
if Action is THintAction then
begin
    HintText := THintAction(Action).Hint;
    { do something to display the hint text }
    Result := True;
end
else Result := inherited ExecuteAction(Action);
end;

 

bool __fastcall TMyControl::ExecuteAction(TBasicAction *Action)
{
  THintAction *pHint = dynamic_cast<THintAction *>(Action);
if (pHint)
  {
    // do something to display pHint->Hint
returntrue;
  }
return TComponent::ExecuteAction(Action);
}

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!