Condividi tramite


How to: Define 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 (Visual FoxPro), 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.

To coordinate 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 Event of the command buttons.

  2. Create the coordinated menu.

  3. Add the coordinated toolbar and menu to a form set.

See Also

Tasks

How to: Coordinate Toolbars and Forms Using Code

How to: Create the Coordinated Menu

Reference

Customize Toolbar Dialog Box (Visual FoxPro)

Other Resources

Creating Custom Toolbars

Designing Menus and Toolbars

Customizing the Visual FoxPro Environment