Vcl.StdActns.THintAction

From RAD Studio API Documentation
Jump to: navigation, search

Vcl.ActnList.TCustomActionSystem.Actions.TContainedActionSystem.Classes.TBasicActionSystem.Classes.TComponentSystem.Classes.TPersistentSystem.TObjectTHintAction

Delphi

THintAction = class(TCustomAction)

C++

class PASCALIMPLEMENTATION THintAction : public Vcl::Actnlist::TCustomAction

Properties

Type Visibility Source Unit Parent
class public
Vcl.StdActns.pas
Vcl.StdActns.hpp
Vcl.StdActns Vcl.StdActns

Description

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

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);
}



See Also