Partager via


Defining Toolbar Actions

After creating a toolbar, you must define the actions associated with the toolbar and its objects. For example, you must define what happens when the user clicks the toolbar or one of its buttons.

To define a toolbar action

  1. Select the object for which you want to define an action: the toolbar or one of its buttons.
  2. In the Properties window, choose the Methods tab.
  3. Edit the appropriate event.
  4. Add the code that specifies the action.

Additionally, you can set properties and methods of the toolbar and its objects.

Coordinating Menus and Custom Toolbars

If you create a toolbar, you should synchronize menu commands with their corresponding toolbar buttons. For example, if you enable a toolbar button, you should enable its corresponding menu command.

You should design and create your application to:

  • Perform the same actions when the user chooses associated toolbar buttons and menu items.
  • Coordinate the enabling and disabling of associated toolbar buttons and menu items.

Follow these general steps when coordinating menu items and toolbar buttons:

  1. Create a toolbar by defining a toolbar class, add command buttons, and include the operational code in the methods associated with the Click events of the command buttons.
  2. Create the coordinated menu.
  3. Add the coordinated toolbar and menu to a form set.

See Also

Coordinating Toolbars and Forms Using Code | Creating the Coordinated Menu | Creating Custom Toolbars | Customize Toolbar Dialog Box | Designing Menus and Toolbars | Configuring Visual FoxPro