Lecture 5: Creating Menus (1)
Introduction
So far, we have discussed several Features expected of Applications:
In Lectures 5 - 6, we will discuss the expected Menu capability:
ToolBars with ToolBar Buttons Using multiple Forms and Dialog Boxes Adding Menus to our VB .NET projects Adding Submenus to our Project’s Menus Creating Context Menus
Along the way, we will discuss the MenuStrip Control, which:
Allows you to add Menus, Menu Items, and SubMenu Items… Contains a built in Menu Editor which allows you to:
Add, Change, and Delete Menu Items.
The Menus you create will also support related features:
Access Keys and Shortcut Keys Check Marks
Access Keys and Shortcut Keys
Once created, your menus can support keyboard operation:
In addition to normal mouse-based opening, closing, and activation.
Access Keys:
Allow users to open a menu using the
key + a letter.
Example: (2 keys pressed simultaneously) Once activated, the opened Menu will appear on the screen; Opened Menus can be navigated easily, as usual:
Using the Arrow keys or the Mouse.
Shortcut Keys:
Which allow users to directly invoke a menu item
Often using a Function Key (e.g., F3), or the key + a letter. Example: (2 keys pressed simultaneously). Once invoked by the user, Menu-driven effects take place normally.
Check Marks
Shown below is an example Project with a MenuStrip Control:
This instance consists of several components:
Three Menus, various Menu Items (not all shown), and a SubMenu
A CheckMark:
Provides True/False selection of the Item Selection is not exclusive (independent of other Checkmarked items)
A Separator:
provides logical separation for groups of items.
The MenuStrip Control
To demonstrate, let’s make a simple Menu-based Editing project…
Adding Menu Items and SubMenus
Adding Toolbars (1):
Toolbars (2): Setting tspMain
Toolbars (3): Setting tspFormatting
Adding TextBoxes
Now, finish the GUI by adding two TextBoxes:
Next, we will add code to make the Menus work…
Coding the Menus (1)
Coding the Menus (2)
Coding the Menus (3)
Conclusion (Cont. in Lecture 6)
In this Lecture, we discussed the MenuStrip Control, which:
Allows you to add Menus, Menu Items, and SubMenu Items…
We also used the Menu Editor :
Including the addition of Access Keys and Shortcut Keys As well as Check Marks Which allowed us to Add, Change, and Delete Menu Items.
In Lecture 6, we continue our discussion of Menus, by :
Finishing our QuickMenu Project
Coding our ToolStrips Testing Menu Functions
Discussing Context Menus:
A second type of ‘drop-down’ menu also supported by VB .NET
The ContextMenuStrip Control