ContainedAction#

Qualified name: delphivcl.ContainedAction

class ContainedAction#

Bases: BasicAction

TContainedAction is the base class for actions that can be grouped by category and that can appear in action lists. TContainedAction introduces properties and methods that enable actions to appear in an action list. The properties of TContainedAction contain information about the relationship between the action and its action list. Methods of TContainedAction override those of the base class to take into account the action list that owns the action. TContainedAction defines the published Category property. Objects of type TContainedAction can be associated with a Category of actions. This category is used at design time to organize the actions in an action list using the Action List editor or the Action Manager editor (only available for VCL).

Methods

Create

Instantiates and initializes a TContainedAction object.

Destroy

Destroys the instance of the contained action.

DoHint

Calls the OnHint event handler.

Execute

Generates an OnExecute event.

GetParentComponent

Returns the action list containing the action.

HasParent

Indicates whether the action is contained in an action list.

SetParentComponent

Sets the action list containing the action.

Suspended

Returns True if the action list of the action is suspended.

Update

Provides an opportunity to execute centralized code when an application is idle.

Attributes

ActionComponent

Indicates the client component that caused this action to execute.

ActionList

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.

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.

AutoCheck#

Controls whether the Checked property toggles when the action executes. AutoCheck causes the Checked property to toggle when the action executes. This allows the Checked property of the action to remain in sync with the Checked property of the client (or an equivalent). If the client has an AutoCheck property of its own, the AutoCheck property of the action is propagated to the AutoCheck property of the client.

Caption#

Represents the caption of the action. Caption holds the string that is used as the caption of the action, when it is set. The value of Caption can be propagated to all client controls and client menu items linked to the action.

Category#

Group or category where the action belongs. IDE editors for actions group together actions that share the same category. In the VCL, if you are using an action manager, you can generate user interface elements that correspond to action categories. Action categories group actions by similarities, usually of behavior or functionality. Standard categories are Edit, Format, Help, Windows, and others. At design time you can modify or set the Category for an action by selecting the action from the action list or object tree view, and choosing Category in the Object Inspector.

Checked#

Indicates whether client controls and menu items appear checked. Checked specifies the checked state for the action. The value of Checked can be propagated to all client controls and client menu items linked to the action.

Note: If the action has a GroupIndex value greater than 0, then setting Checked to True sets to False the Checked properties of all other actions in the GroupIndex group. Tip: Use the AutoCheck property to ensure that the action’s Checked property toggles when the action executes.

Create(AOwner: Component)#

Instantiates and initializes a TContainedAction object. Applications do not need to call Create directly. Actions are created automatically when you choose New Action in the Action List editor. Create calls the inherited System.Classes.TBasicAction.Create constructor and then initializes the Enabled (setting it to True), Visible (setting it to True), and ImageIndex (setting it to -1) properties.

Destroy()#

Destroys the instance of the contained action. If the action is contained in an action list or action manager, Destroy removes the action from that list. Then it calls the inherited Destroy method.

DisableIfNoHandler#

Indicates whether the action’s clients should be disabled if no OnExecute event handler is found. DisableIfNoHandler defines whether to set the Enabled property of the action to False if no OnExecute event handler is set for the action. Setting Enabled to False disables all the action’s clients. See, for example, how FMX.Forms.TApplication.UpdateAction uses DisableIfNoHandler to define whether to set Enabled to False if the OnExecute event handler is not defined to the action. For example, setting DisableIfNoHandler to False can be useful when managing submenus. In this case, pointing to a command on the main menu, which causes the submenu to open, does not need any OnExecute event handler. Then, if DisableIfNoHandler is True, this main menu command becomes disabled and the submenu cannot be opened. In such cases it can be convenient to use actions of types FMX.Controls.TControlAction and Vcl.Controls.TControlAction. Objects of these classes have the value of DisableIfNoHandler set to False, by default.

DoHint(HintStr: string) Boolean#

Calls the OnHint event handler. Typically, applications do not call the DoHint method. It is called automatically when the user pauses the mouse on one of the action’s client controls or menu items. DoHint is called by the action’s client when the client asks to show the hint.

DoHint checks for an OnHint event handler and passes HintStr to it, if the event handler exists. The OnHint event handler can change the specified hint string HintStr. DoHint returns True if no event handler is assigned or if OnHint returns True. DoHint can be used to determine which hint text should be shown. For example, Vcl.Controls.TControlActionLink.DoShowHint calls DoHint internally, and if DoHint returns True, then Vcl.Controls.TControlActionLink.DoShowHint appends the action’s shortcut specification to the hint text to display.

Enabled#

Specifies the enabled state for the action. The value of Enabled can be propagated to all client controls and client menu items linked to the action.

Execute()#

Generates an OnExecute event.

GetParentComponent()#

Returns the action list containing the action. GetParentComponent returns the action list containing the action. This action list is stored in the ActionList property. If ActionList stores nil, then GetParentComponent calls the inherited System.Classes.TComponent.GetParentComponent method.

GroupIndex#

Indicates a group of actions in one action list. Actions in this group act like the group of radio buttons. The value of GroupIndex is used to define groups of actions. Actions in each group act like groups of radio buttons. When GroupIndex is greater than 0, this value identifies the group to which some actions belong. The value of GroupIndex can be propagated to all client controls and client menu items linked to the action. When the Checked property of any action in that group is set to True, the Checked properties of all other actions in the group are set to False. That is, only one action in the group can be checked at a time.

Note: All actions in a group must be listed by the same action list.

HasParent()#

Indicates whether the action is contained in an action list. HasParent returns True if the action is contained in an action list stored in the ActionList property. If ActionList stores nil, then HasParent calls the inherited System.Classes.TComponent.HasParent method.

HelpContext#

Keeps the integer context ID that identifies the Help topic for the action. HelpContext specifies the integer context ID to identify the Help topic to show when invoking Help for the action. The value of HelpContext can be propagated to all client controls and client menu items linked to the action. See also IsHelpLinked. HelpContext is only used when htContext is selected in the HelpType property.

Note: To use Help, you need to enable Help in your application. When your application supports usage of the appropriate Help system, then it can show Help topics from the associated Help file. When a client control has focus and the user presses the F1 key, the control uses the value of the HelpContext property to invoke the online Help that shows the topic with this context ID. The target topic is uniquely identified by a HelpContext context ID value.

HelpKeyword#

Contains the keyword string that identifies the Help topic for the action. The value of HelpKeyword can be propagated to all client controls and client menu items linked to the action. HelpKeyword is only used when htKeyword is selected in the HelpType property.

Note: To use Help, you need to enable Help in your application. When your application supports usage of the appropriate Help system, then it can show Help topics from the associated Help file. When a client control has focus and the user presses the F1 key, the control uses the HelpKeyword property’s value to invoke the online Help showing the topic with this keyword.

HelpType#

Keeps whether to use the HelpContext or HelpKeyword property to identify the Help topic. The value of HelpType can be propagated to all client controls and client menu items linked to the action. HelpType can keep one of the following constants:

htContext ? instructs to use the HelpContext property to identify the Help topic to show when invoking Help. htKeyword ? instructs to use the HelpKeyword property to identify the Help topic to show when invoking Help.

Hint#

Stores the Help hint text. Hint holds the hint string indicating the hint text for the action. Hint contains the text strings that appear in a pop-up box (or in a status bar) when the user moves the mouse over screen elements. This hint string can be propagated to clients of the action ? to controls, menu items, and other GUI elements.

Note: VCL controls support hint strings containing three parts that can be shown in separate locations (see Vcl.Controls.TControl.Hint).

ImageIndex#

Stores an index in a list of images. ImageIndex is a zero-based index in a list of images. TContainedAction does not provide the actual list of images, only implementations of actions in GUI application frameworks provide such a property. In general, this list of images contains images that are associated with controls and menu items that use this action. The value of ImageIndex can be propagated to all client controls and client menu items linked to the action.

Note: When ImageIndex is -1, this means that the list does not contain any images. In typical implementations of controls, an image is drawn at the leftmost position in the control, and a control’s text is drawn to the right of the image. If ImageIndex is -1, then a control does not offset the text to the right to reserve a placeholder for the image. Otherwise, if ImageIndex is not -1, then the control’s text is always drawn with the offset to the right to reserve a place for drawing an image.

Index#

Specifies the index of the action in its action list. Index indicates the position of the action in its action list. You can change the action’s Index at design time using one of the IDE editors to handle actions. The index of actions determines the order in which they appear in user interface elements such as menus and tool bars. Index is zero-based. When Index is -1, this means that the ActionList property does not contain any list.

OnHint#

<Delphi property OnHint of type TContainedAction at 2114116F5F0>

SecondaryShortCuts#

Stores shortcuts (in addition to ShortCut) for triggering the action. Actions can execute in response to multiple shortcut key combinations. SecondaryShortCuts lists all the shortcut key combinations (other than the one specified by the ShortCut property) that can trigger the action. This lets you provide additional, secondary shortcuts. When the user types one of the key combinations listed in SecondaryShortCuts, the action’s Execute method is called.

SetParentComponent(AParent: Component)#

Sets the action list containing the action. SetParentComponent sets the specified AParent action list as the action list containing the action. This action list is stored in the ActionList property.

ShortCut#

Shortcut that triggers the action. The value of Shortcut can be propagated to all client controls and client menu items linked to the action.

StatusAction#

Stores the status for an input field in an action. StatusAction holds the status for an input field in the action, when it is set. The value of StatusAction can be propagated to all client controls and client menu items linked to the action.

Suspended()#

Returns True if the action list of the action is suspended.

Update()#

Provides an opportunity to execute centralized code when an application is idle.

Visible#

Stores whether the action representation is visible. Visible specifies the visible state for the action (True means visible, False means invisible). This Visible value is propagated to a client of the action if IsVisibleLinked method of the action link linking the client to the action returns True. If the Visible of an action is False and IsVisibleLinked of an action link returns True, then the Visible of the client (a control, menu item, or others) is also set False and this client is also invisible. Typically, IsVisibleLinked of an action link returns False if the action belongs to TCustomViewAction. Otherwise, when the action belongs to TAction, then IsVisibleLinked of an action link returns True. That is, TCustomViewAction is used when one need to provide visible representation of clients of actions that have Visible set True.