RAD Studio |  |

Organizing Actions for Toolbars and Menus
See Also
Collapse All

Several features simplify the work of creating, customizing, and maintaining menus and toolbars. These features allow you to organize lists of actions that users of your application can initiate by pressing a button on a toolbar, choosing a command on a menu, or pointing and clicking on an icon.

Often a set of actions is used in more than one user interface element. For example, the Cut, Copy, and Paste commands often appear on both an Edit menu and on a toolbar. You only need to add the action once to use it in multiple UI elements in your application.

On the Windows platform, tools are provided to make it easy to define and group actions, create different layouts, and customize menus at design time or runtime. These tools are known collectively as ActionBand tools, and the menus and toolbars you create with them are known as action bands. In general, you can create an ActionBand user interface as follows:

- Build the action list to create a set of actions that will be available for your application (use the Action Manager, TActionManager)
- Add the user interface elements to the application (use ActionBand components such as TActionMainMenuBarand TActionToolBar)
- Drag-and-drop actions from the Action Manager onto the user interface elements

The following table defines the terminology related to setting up menus and toolbars:

Action setup terminology

Term | Definition
Action | A response to something a user does, such as clicking a menu item. Many standard actions that are frequently required are provided for you to use in your applications as is. For example, file operations such as File Open, File SaveAs, File Run, and File Exit are included along with many others for editing, formatting, searches, help, dialogs, and window actions. You can also program custom actions and access them using action lists and the Action Manager.
Action band | A container for a set of actions associated with a customizable menu or toolbar. The ActionBand components for main menus and toolbars (TActionMainMenuBar and TActionToolBar) are examples of action bands.
Action category | Lets you group actions and drop them as a group onto a menu or toolbar. For example, one of the standard action categories is Search which includes Find, FindFirst, FindNext, and Replace actions all at once.
Action classes | Classes that perform the actions used in your application. All of the standard actions are defined in action classes such as TEditCopy, TEditCut, and TEditUndo. You can use these classes by dragging and dropping them from the Customize dialog onto an action band.
Action client | Most often represents a menu item or a button that receives a notification to initiate an action. When the client receives a user command (such as a mouse click), it initiates an associated action.
Action list | Maintains a list of actions that your application can take in response to something a user does.
Action Manager | Groups and organizes logical sets of actions that can be reused on ActionBand components. See TActionManager.
Menu | Lists commands that the user of the application can execute by clicking on them. You can create menus by using the ActionBand menu class TActionMainMenuBar, or by using cross-platform components such as TMainMenu or TPopupMenu.
Target | Represents the item an action does something to. The target is usually a control, such as a memo or a data control. Not all actions require a target. For example, the standard help actions ignore the target and simply launch the help system.
Toolbar | Displays a visible row of button icons which, when clicked, cause the program to perform some action, such as printing the current document. You can create toolbars by using the ActionBand toolbar component TActionToolBar, or by using the cross-platform component TToolBar.

If you are doing cross-platform development, refer to Using action lists for details.

See Also

TActionManager

TActionList

TAction

TActionLink

Setting Up Action Lists

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!