Tuesday, January 26, 2010

ASSIGN_03 Working with Menus and Toolbars

Enabling and disabling menu items

You disable a menu item while the function accessed from that menu item is currently not available. Whenever you change a menu item, you are required to provide at least three parameters:
- The Menu Index of the menu item you want to change
- The Command Index of the menu item you want to change
- A Flag (what you want done to the menu item)

In addition, if the menu item you want to change is on a submenu, you need to provide the Subcommand index. To enable the menu item Menu Builder you want to use these parameters:

Menu Index
Command Index
Subcommand Index
Flag

Menu Index refers to the main drop-down window where your menu item resides. This derived by counting how far from the left the menu is. Note all indexes must be zero based.

Command Index, for this item, you count what item down your menu item is. Again, all indexes are zero based. So, of you count 0 for Spelling, 2 for AutoCorrect, and so forth, you find that the submenu Add-ins is number 10. Note that you must all menu items even if they are disabled (separator bars are not counted). Because the menu item you want to disable is on a submenu, you also must provide the Subcommand Index. You find this value by counting down the submenu the same way you counted for the Command Index. In this example, if you do not provide a Subcommand Index. Access would disable the entire Add-ins menu.

0 comments: