Using ActionManager to Create Actions in a VCL Forms Application
Go Up to How To Build VCL Forms Applications
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:
- Create a main window.
- Add a File open action to the ActionManager.
- Create the main menu.
- Add the action to the menu.
- Build and run the application.
To create a main window and add a File open action
- Choose File > New > Other > Delphi Projects or C++Builder Projects and double-click the VCL Forms Application icon. The VCL Forms Designer is displayed.
- From the Additional page of the Tool Palette, add an TActionManager component to the form.
- 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.
- If necessary, click the Actions tab.
- Select New Standard Action from the drop-down list to display the Standard Action Classes dialog.
- Scroll to the File category, and click the TFileOpen action.
- Click OK to close the dialog.
- In the Action Manager editor, select the File category.Open... displays in the Actions: list box.
- Click Close to close the editor.
To create the main menu
- From the Additional page of the Tool Palette, place an TActionMainMenuBar component on the form.
- Open the Action Manager editor, and select the File category from the Categories: list box.
- Drag File to the blank menu bar. File displays on the menu bar.
To build and run the application
- Choose Run > Run. The application executes, displaying a form with the main menu bar and the File menu.
- Choose File > Open. The Open file dialog displays.