Use action objects, in conjunction with action lists, to centralize the response to user commands (actions).
Use AddControl, AddMenuItem, AddToolbarButton methods to link controls to an action.
See also TActionList.
TActionList maintains a list of actions used with components and controls, such as menu items and buttons.
Action lists are used, in conjunction with actions, to centralize the response to user commands (actions).
Write an OnUpdateActions handler to update actions state.
Created using function NewActionList.
See also TAction.
TAction and TActionList Constructors:
function NewAction
function NewActionList: Action list constructor. AOwner - owner form.
Properties and Methods:
Caption: Text caption.
Hint: Hint (tooltip). Currently used for toolbar buttons only.
Checked: Checked state.
Enabled: Enabled state.
Visible: Visible state.
HelpContext: Help context.
Accelerator: Accelerator for menu items.
Actions: Access to actions in the list.
Count: Number of actions in the list.
LinkControl: Add a link to a TControl or descendant control.
LinkMenuItem: Add a link to a menu item.
LinkToolbarButton: Add a link to a toolbar button.
Execute: Executes a OnExecute event handler.
Add: Add a new action to the list. Returns pointer to action object.
Delete: Delete action by index from list.
Clear: Clear all actions in the list.
Events:
OnExecute: This event is executed when user clicks on a linked object or Execute method was called.
OnUpdateActions: Event handler to update actions state. This event is called each time when application goes in the idle state (no messages in the queue).