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:
- Add a file open action to the ActionManager on a form.
- Create the main menu.
- Add the action to the menu.
- Build and run the application.
To add a file open action to ActionManager
- Choose FileNewOtherDelphi for .NET ProjectsVCL Forms Application to create a new form.
- From the Additional page of the Tool Palette, add a TActionManager component to the form.
- Double-click the TActionManager component to display the Action Manager editor.
Tip: To display captions for nonvisual components such as TActionManager, 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 and add the File action to it
- From the Additional page of the Tool Palette, place a 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.
- Click Close to close the editor.
To build and run the application
- Select RunRun. The application executes, displaying a form with the main menu bar and the File menu.
- Select FileOpen. The Open file dialog displays.