Setting Up Action Lists
- Note: This topic describes how to manage VCL action lists. See FireMonkey Actions for usage of action lists in FireMonkey applications.
Setting up action lists is fairly easy once you understand the basic steps involved:
- Create the action list.
- Add actions to the action list.
- Set properties on the actions.
- Attach clients to the action.
Here are the steps in more detail:
- Drop a TActionList object onto your form or data module. (ActionList is on the Standard category of the Tool palette.)
- Double-click the TActionList object to display the Action List editor.
- Either use one of the predefined actions listed in the editor: right-click and choose New Standard Action...
- The predefined actions are organized into categories (such as Dataset, Edit, Help, and Window) in the Standard Action Classes dialog box. Select all the standard actions you want to add to the action list and click OK.
- ...or create a new action of your own: right-click and choose New Action.
- Set the properties of each action in the Object Inspector. (The properties you set affect every client of the action.)
- The Name property identifies the action, and the other properties and events (Caption, Checked, Enabled, HelpContext, Hint, ImageIndex, ShortCut, Visible, and Execute) correspond to the properties and events of its client controls. The client's corresponding properties are typically, but not necessarily, the same name as the corresponding client property.
- For example, an action's Enabled property corresponds to a TToolButton's Enabled property. However, an action's Checked property corresponds to a TToolButton's Down property.
- If you use the predefined actions, the action includes a standard response that occurs automatically. If creating your own action, you need to write an event handler that defines how the action responds when fired. See What Happens When an Action Fires for details.
- Attach the actions in the action list to the clients that require them:
- Click the control (such as the button or menu item) on the form or data module. In the Object Inspector, the Action property lists the available actions.
- Select the action you want.
The standard actions, such as TEditDelete or TDataSetPost, all perform the action you would expect. See the online reference Help for details on how all of the standard actions work. If writing your own actions, you will need to understand more about what happens when the action is fired. See What Happens When an Action Fires for details.