Search In Site

25 June, 2013

Modifying And Deleting Menu Items in visual basic


Modifying And Deleting Menu Items
You think the program is perfect, but the users are complaining that they don’t like having the Save As item in the Edit menu and want to move it to the File menu. Is that possible? Yes, using the Menu Editor. You can rearrange, add, or remove items in your menu with the Menu Editor, so open that tool now.
Inserting Or Deleting Items In A Menu System
To add a new item to a menu, or a new menu to the menu system, select an item in the Menu Editor, and click the Insert button. This inserts a new, empty entry into the menu just before the item you selected:
File
....New
....Open
...
Edit
....Cut
....Copy
....Paste
Now just enter the new item’s Caption and Name properties, and you’re all set. To remove a menu or menu item, just select that menu or item and click the Delete button.

Rearranging Items In A Menu System
You can use the four arrow buttons in the Menu Editor to move items up and down, as well as indent or outdent (that is, remove one level of indenting) menu items. Here’s what the arrows do:
" Right arrow_ Indents a menu item.
" Left arrow_ Outdents a menu item.
" Up arrow_ Moves the currently selected item up one level.
" Down arrow_ Moves the currently selected item down one level.
For example, to move the Save As item from the Edit menu to the File menu, just select that item and keep clicking the up arrow button until the Save As item is positioned as you want it in the File menu.

Adding A Menu Separator
Menus themselves allow you ways to group commands by function (File, Edit, and so on). Often within a menu, however, it helps the user to group menu items by function (Print, Print Preview, Page Setup, and so on). You do that with menu separators.
A menu separator is a horizontal rule that really only has one purpose to divide menu items into groups . And using the Menu Editor, you can add separators to your menus.

To add a menu separator, select an item in the Menu Editor and click Insert to create a new item just before the item you selected. To make this new item a menu separator,  just give use a hyphen (-) for its Caption property. You must give all menu items a name even if they don’t do anything so give it a dummy Name property value as well, such as mnuSeparator. When you run the program, you’ll see the menu separators in place.
Adding Access Characters

The Testing Departments calling again: They like the menus you’ve added to your program, but there’s the keyboard access issue. Theoretically, they say, users should be able to use the keyboard for everything. It’s time to add access characters to your program. When the user presses the Alt
key and an access character, the menu item corresponding to that access character is selected. How do you associate an access character with a menu or menu item? It’s easy just place an ampersand (&) in front of the character you want to make into the access character in that menu or item’s caption.
For example, if you had this menu system
File
....New
....Open
Edit
....Cut
....Copy
....Paste
you could make a letter in all menus or menu items into access characters by placing an ampersand in front of it:
&File
....&New
....&Open
&Edit
....&Cut
....C&opy
....&Paste

Avoiding Access Character Duplication
Note in the previous example that we have two items Cut and Copy in the Edit menu that begin with _C_. That’s a problem, because an access character must be unique at its level (where the level is the menu bar for menus and a menu for menu items). To avoid confusion (both to the user and to Visual Basic), we make _o_, the second letter in Copy, the access character for that item. The result of adding access characters to your menus at design time appears in the Menu Editor.

To use an access key, users first open the menu in which the item they want to select appears (possibly using an access key, like Alt+F for the File menu), then they press the Alt key and the access key.

0 comments:

Post a Comment

Dear Visitors All The Tricks And Hacks Posted Here Are Only For Knowledge Purpose.Don't Use These for Illegal Operations.

 
Twitter Bird Gadget