RAD Studio |  |

Using ActionManager to Create Actions in a VCL Forms Application
See Also
Collapse All

Using RAD Studio, the following procedure illustrates how to create actions using ActionManager. It sets up a simple user interface with a text area, as would be appropriate for a text editing application, and describes how to create a file menu item with a file open action.

Building the VCL application with ActionManager actions consists of the following major steps:

1. Create a main window.
2. Add a File open action to the ActionManager.
3. Create the main menu.
4. Add the action to the menu.
5. Build and run the application.

To create a main window and add a File open action

1. Choose FileNewOtherDelphi Projects or C++Builder Projects and double-click the VCL Forms Application icon. The VCL Forms Designer is displayed.
2. From the Additional page of the Tool Palette, add an TActionManager component to the form.
3. Double-click the TActionManager to display the Action Manager editor.
   Tip: To display captions for nonvisual components such as ActionManager, choose Tools->Environment Options
   . On the Designer tab, check Show component captions, and click OK.
4. If necessary, click the Actions tab.
5. Select New Standard Action from the drop-down list to display the Standard Action Classes dialog.
6. Scroll to the File category, and click the TFileOpen action.
7. Click OK to close the dialog.
8. In the Action Manager editor, select the File category. Open... displays in the Actions: list box.
9. Click Close to close the editor.

To create the main menu

1. From the Additional page of the Tool Palette, place an TActionMainMenuBar component on the form.
2. Open the Action Manager editor, and select the File category from the Categories: list box.
3. Drag File to the blank menu bar. File displays on the menu bar.

To build and run the application

1. Choose RunRun. The application executes, displaying a form with the main menu bar and the File menu.
2. Choose FileOpen. The Open file dialog displays.

See Also

VCL Overview

Building a VCL Forms Application

Building a VCL Forms MDI Application Without Using a Wizard

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