Using ActionManager to Create Actions in a VCL Forms Application

From RAD Studio
Jump to: navigation, search

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:

  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 File > New > Other > Delphi 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 Run > Run. The application executes, displaying a form with the main menu bar and the File menu.
  2. Choose File > Open. The Open file dialog displays.

See Also