TAction = class(TCustomAction)
class PASCALIMPLEMENTATION TAction : public TCustomAction
TAction is the base class for VCL action objects. TAction implements actions to be used with menu items and controls. The published properties and events of TAction actions can be managed in the Object Inspector at design time.
- Changes the public scope to published for the AutoCheck, Caption, Checked, Enabled, GroupIndex, HelpType, HelpContext, HelpKeyword, Hint, ImageIndex, SecondaryShortCuts, ShortCut, and Visible properties.
- Sets the published scope for the OnExecute, OnUpdate, and OnHint events.
- The published scope of these properties and events provides the possibility to use the Object Inspector assistance for editing values of these properties and events.
- The DisableIfNoHandler property is set to True while an action is created, that is, the action is inaccessible if it does not have an OnExecute event handler.
TAction is a generic action component. It can be added to action lists when there is no predefined action class that implements the desired response to user commands. Unlike predefined action classes, which have built-in methods that respond when users click the client controls, TAction has no built-in response to user commands. Instead, when using TAction, you can provide the response when the action "fires" by writing (using the Object Inspector's assistance) an OnExecute event handler, and configure the properties of TAction to reflect the current conditions by writing an OnUpdate event handler.
Action objects are used to centralize the response to user commands (actions) and to represent user interface elements in applications that use action lists or action bands.
TAction can also act as a base class for predefined action classes. You can derive from TAction if you want to retain the published scope of the supported properties and events. If you want to use the public scope to some of the supported properties and events, you can derive from TCustomAction.