RAD Studio for Microsoft .NET
ContentsIndex
PreviousUpNext
Using ActionManager to Create Actions in a VCL Forms Application

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. Add a file open action to the ActionManager on a form.
  2. Create the main menu.
  3. Add the action to the menu.
  4. Build and run the application.

To add a file open action to ActionManager

  1. Choose FileNewOtherDelphi for .NET ProjectsVCL Forms Application to create a new form.
  2. From the Additional page of the Tool Palette, add a TActionManager component to the form.
  3. 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.
  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 and add the File action to it

  1. From the Additional page of the Tool Palette, place a 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.
  4. Click Close to close the editor.

To build and run the application

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

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!