CustomAction#
Qualified name: delphivcl.CustomAction
- class CustomAction#
Bases:
ContainedAction
TCustomAction is the base class for VCL actions intended to be used with menu items and controls. TCustomAction introduces support for the properties, events, and methods of menu items and controls that are clients of action objects. Most properties and events introduced in TCustomAction are public; therefore, use TCustomAction as a base class when deriving your own actions that publish specific subset of properties of associated controls. Action objects centralize the response to user commands (actions) and represent user interface elements in applications that use actions. They provide an easy way to synchronize, for example, the enabled state and caption of a speed button and a menu item, and handle the response when users click these components. Each such component, called the client, has its properties dynamically updated by the action and forwards user actions to the action for a response. At design time, you can work in the Action List editor with actions contained in an action list or in the Action Manager editor of the action manager. The action list or action manager is a container for actions, which it organizes into categories. Component and control public properties and events that are supported in TCustomAction, either directly or through an ancestor, are:
Caption Checked Enabled HelpType HelpContext HelpKeyword Hint ImageIndex ShortCut Visible OnHint OnUpdate OnExecute Because the OnHint, OnUpdate, and OnExecute events are public, they do not appear in the Object Inspector. That is, the Object Inspector does not support generating custom event handlers for these events. TCustomAction can also act as the base class for predefined action classes. You can derive from TCustomAction if you want to retain the public scope of supported properties and events or modify the public scope to the published scope. For predefined actions that augment the behavior of TCustomAction, see the action classes in the Vcl.StdActns, Vcl.DBActns, and Vcl.ExtActns units.
Methods
Instantiates and initializes a VCL TCustomAction object.
Frees an instance of TCustomAction.
Responds when a client control "fires".
Provides an opportunity to execute centralized code when an application is idle.
Attributes
Indicates the client component that caused this action to execute.
Holds the action list to which the action belongs.
AutoCheck
Controls whether the Checked property toggles when the action executes.
Caption
Represents the caption of the action.
Category
Group or category where the action belongs.
Checked
Indicates whether client controls and menu items appear checked.
ClassName
Returns the TObject.ClassName
ComObject
Specifies the interface reference implemented by the component.
ComponentCount
Indicates the number of components owned by the component.
ComponentIndex
Indicates the position of the component in its owner's Components property array.
ComponentState
Describes the current state of the component, indicating when a component needs to avoid certain actions.
ComponentStyle
Governs the behavior of the component.
Components
<Delphi indexed property Components of type TComponent at 21141642500>
DesignInfo
Contains information used by the Form designer.
DisableIfNoHandler
Indicates whether the action's clients should be disabled if no OnExecute event handler is found.
Enabled
Specifies the enabled state for the action.
GroupIndex
Indicates a group of actions in one action list.
HelpContext
Keeps the integer context ID that identifies the Help topic for the action.
HelpKeyword
Contains the keyword string that identifies the Help topic for the action.
HelpType
Keeps whether to use the HelpContext or HelpKeyword property to identify the Help topic.
Hint
Stores the Help hint text.
ImageIndex
Stores an index in a list of images.
Displays the name of linked items from the Image Collection.
Embarcadero Technologies does not currently have any additional information.
Index
Specifies the index of the action in its action list.
Name
Specifies the name of the component as referenced in code.
Observers
Indicates the TObservers object added to the TComponent.
OnExecute
<Delphi property OnExecute of type TBasicAction at 211416603D0>
OnHint
<Delphi property OnHint of type TContainedAction at 2114116F5F0>
OnUpdate
<Delphi property OnUpdate of type TBasicAction at 211416604A0>
Owner
Indicates the component that is responsible for streaming and freeing this component.
SecondaryShortCuts
Stores shortcuts (in addition to ShortCut) for triggering the action.
ShortCut
Shortcut that triggers the action.
StatusAction
Stores the status for an input field in an action.
Tag
Stores a NativeInt integral value as a part of a component.
VCLComObject
Represents information used internally by components that support COM.
Visible
Stores whether the action representation is visible.
- ActionComponent#
Indicates the client component that caused this action to execute.
- ActionList#
Holds the action list to which the action belongs. Vcl.ActnList.TCustomAction.ActionList inherits from System.Actions.TContainedAction.ActionList. All content below this line refers to System.Actions.TContainedAction.ActionList. Holds the action list to which the action belongs.
- Create(AOwner: Component)#
Instantiates and initializes a VCL TCustomAction object. Applications do not need to call the constructor directly. Actions are created automatically when you add them to an action manager (in the Action Manager editor) or action list component (in the Action List editor) at design time. If you want to create an action at run time, assign a TActionList or TActionManager component to its ActionList property after calling Create. AOwner is the component that is responsible for freeing the action. It becomes the value of the Owner property. Create simply calls an inherited System.Actions.TContainedAction.Create constructor.
- Destroy()#
Frees an instance of TCustomAction. Do not call the destructor directly in an application. Instead, call Free. Free ensures that the action is not nil before calling the destructor. If the action is contained in an action list or action manager, Destroy removes the action from that list.
- Execute()#
Responds when a client control “fires”. Execute is called automatically when a client control “fires” (for example, when the user clicks a button or selects a menu item). It returns True if an event handler is found to handle the action, False if there was no event handler or if the action was not enabled. Execute first ensures that the action is updated. Then, if the Enabled property is True, it attempts to handle the action by generating an OnExecute event on the action list that contains this action (if the action belongs to an action list). If the action list’s OnExecute event handler does not handle the action, Execute generates an OnActionExecute event on the application itself. If neither the action list nor the application handles the action in response to these events, Execute generates an OnExecute event on itself. If this action has no OnExecute event handler, Execute instructs the application to locate the current target control and call the ExecuteTarget method, which is the mechanism by which predefined action classes perform their function.
- ImageName#
Displays the name of linked items from the Image Collection.
- Images#
Embarcadero Technologies does not currently have any additional information.
- Update()#
Provides an opportunity to execute centralized code when an application is idle. Vcl.ActnList.TCustomAction.Update inherits from System.Classes.TBasicAction.Update. All content below this line refers to System.Classes.TBasicAction.Update. Provides an opportunity to execute centralized code when an application is idle. Update triggers the OnUpdate event handler. Update returns True if an event handler was found, False otherwise. When the application is idle, the OnUpdate event occurs for every action. This provides an opportunity for applications to execute centralized code for enabling and disabling, checking and unchecking, and so on.