Adding Shortcut Keys
One of the most powerful aspects of menus are shortcut keys single keys or key combinations that let the user execute a menu command immediately (without having to open the menu the command is in, as you must do with access keys). You usually use function keys (although many PCs now go up to F16, it’s best to limit yourself to F1 through F10) or Ctrl key combinations for shortcut keys.
One of the most powerful aspects of menus are shortcut keys single keys or key combinations that let the user execute a menu command immediately (without having to open the menu the command is in, as you must do with access keys). You usually use function keys (although many PCs now go up to F16, it’s best to limit yourself to F1 through F10) or Ctrl key combinations for shortcut keys.
For example, the standard shortcut key for Select All is Ctrl+A, and entering that shortcut selects all the text in a document.
Giving a menu item a shortcut key is very easy in the Menu Editor. Just open the Menu Editor, select the item you want to give a shortcut key to and select the shortcut key you want to use in the Menu Editor box labeled Shortcut. (Note that to open the Menu Editor, the form you’re designing must be the active window in Visual Basic, not the code window.) That’s all it takes now run the program,
Shortcut Key Standards
Windows conventions now include a set of standard shortcut keys that are supposed to apply across most Windows applications. Here are the most common shortcut keys (be very careful when using these key combinations for other purposes; your users may expect the standard response):
" Ctrl+A_Select All " Ctrl+B_Bold
" Ctrl+C_Copy
" Ctrl+F_Find
" Ctrl+G_Go To
" Ctrl+H_Replace" Ctrl+I_Italic
" Ctrl+J_Justify
" Ctrl+N_New
" Ctrl+O_Open
" Ctrl+P_Print
" Ctrl+Q_Quit
" Ctrl+S_Save
" Ctrl+U_Underline
" Ctrl+V_Paste
" Ctrl+W_Close
" Ctrl+X_Cut
" Ctrl+Z_Undo
" F1_Help
As you can see in that figure, the Colors item in the Edit menu has a small arrow at the right. This indicates that there’s a submenu attached to this menu item. Selecting the menu item opens the submenu,. As you can see, submenus appear as menus attached to menus.
Submenus let you organize your menu system in a compact way, and adding them to a program is simple. For example, let’s say you started this way, with a Red, Green, and Blue menu item in the Edit menu:
Edit
....Cut
....Copy
....Paste
....Red
....Green
....Blue
....Select All
To put those items in a submenu, we first add a name for the submenu say, Colors:
Edit
....Cut
....Copy
....Paste
....Colors
....Red
....Green
....Blue
....Select All
All that left is to indent (using the right arrow in the Menu Editor) the items that should go into that submenu (note that they must appear just under the submenu’s name):
Edit
....Cut
....Copy
....Paste
....Colors
........Red
........Green
........Blue
....Select All
That’s it close the Menu Editor.
Shortcut Key Standards
Windows conventions now include a set of standard shortcut keys that are supposed to apply across most Windows applications. Here are the most common shortcut keys (be very careful when using these key combinations for other purposes; your users may expect the standard response):
" Ctrl+A_Select All " Ctrl+B_Bold
" Ctrl+C_Copy
" Ctrl+F_Find
" Ctrl+G_Go To
" Ctrl+H_Replace" Ctrl+I_Italic
" Ctrl+J_Justify
" Ctrl+N_New
" Ctrl+O_Open
" Ctrl+P_Print
" Ctrl+Q_Quit
" Ctrl+S_Save
" Ctrl+U_Underline
" Ctrl+V_Paste
" Ctrl+W_Close
" Ctrl+X_Cut
" Ctrl+Z_Undo
" F1_Help
Creating Submenus
The email is in and it’s more praise for your program, AmazingWingDings (Deluxe version). It’s gratifying to read the great reviews but one user asks if you couldn’t place the Red, Green, and Blue color selections in the Edit menu into a submenu. What are submenus, and how can you create them? As you can see in that figure, the Colors item in the Edit menu has a small arrow at the right. This indicates that there’s a submenu attached to this menu item. Selecting the menu item opens the submenu,. As you can see, submenus appear as menus attached to menus.
Submenus let you organize your menu system in a compact way, and adding them to a program is simple. For example, let’s say you started this way, with a Red, Green, and Blue menu item in the Edit menu:
Edit
....Cut
....Copy
....Paste
....Red
....Green
....Blue
....Select All
To put those items in a submenu, we first add a name for the submenu say, Colors:
Edit
....Cut
....Copy
....Paste
....Colors
....Red
....Green
....Blue
....Select All
All that left is to indent (using the right arrow in the Menu Editor) the items that should go into that submenu (note that they must appear just under the submenu’s name):
Edit
....Cut
....Copy
....Paste
....Colors
........Red
........Green
........Blue
....Select All
That’s it close the Menu Editor.
You add code to submenu items in the same way that you add code to menu items just click them to open the corresponding event-handling function and add the code you want, as we’ve done here to report the user’s color selection:
Private Sub mnuEditColorsBlue_Click()
MsgBox ("You selected Blue")
End Sub
Private Sub mnuEditColorsGreen_Click()
MsgBox ("You selected Green")
End Sub
Private Sub mnuEditColorsRed_Click()
Private Sub mnuEditColorsBlue_Click()
MsgBox ("You selected Blue")
End Sub
Private Sub mnuEditColorsGreen_Click()
MsgBox ("You selected Green")
End Sub
Private Sub mnuEditColorsRed_Click()
MsgBox ("You selected Red")
End Sub
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.