Lecture 5 - Menus (1)(VB 2008)

download Lecture 5 - Menus (1)(VB 2008)

of 14

Transcript of Lecture 5 - Menus (1)(VB 2008)

  • 8/14/2019 Lecture 5 - Menus (1)(VB 2008)

    1/14

    Lecture 5: Creating Menus (1)

  • 8/14/2019 Lecture 5 - Menus (1)(VB 2008)

    2/14

    Introduction

    So far, we have discussed several Features expected of Applications: ToolBars with ToolBar Buttons Using multiple Forms and Dialog Boxes

    In Lectures 5 - 6, we will discuss the expected Menu capability: Adding Menus to our VB .NET projects Adding Submenus to our Projects Menus

    Creating Context Menus

    Along the way, we will discuss theMenuStrip Control, which: Allows you to add Menus, Menu Items, and SubMenu Items Contains a built in Menu Editorwhich 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

  • 8/14/2019 Lecture 5 - Menus (1)(VB 2008)

    3/14

    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.

  • 8/14/2019 Lecture 5 - Menus (1)(VB 2008)

    4/14

    Check Marks

    Shown below is an example Project with a MenuStrip Control:

    This instance consists of severalcomponents: 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.

  • 8/14/2019 Lecture 5 - Menus (1)(VB 2008)

    5/14

    The MenuStrip Control To demonstrate, lets make a simple Menu-based Editing project

  • 8/14/2019 Lecture 5 - Menus (1)(VB 2008)

    6/14

    Adding Menu Items and SubMenus

  • 8/14/2019 Lecture 5 - Menus (1)(VB 2008)

    7/14

    Adding Toolbars (1):

  • 8/14/2019 Lecture 5 - Menus (1)(VB 2008)

    8/14

    Toolbars (2): Setting tspMain

  • 8/14/2019 Lecture 5 - Menus (1)(VB 2008)

    9/14

    Toolbars (3): Setting tspFormatting

  • 8/14/2019 Lecture 5 - Menus (1)(VB 2008)

    10/14

    Adding TextBoxes

    Now, finish the GUI by adding two TextBoxes:

    Next, we will add code to make the Menus work

  • 8/14/2019 Lecture 5 - Menus (1)(VB 2008)

    11/14

    Coding the Menus (1)

  • 8/14/2019 Lecture 5 - Menus (1)(VB 2008)

    12/14

    Coding the Menus (2)

  • 8/14/2019 Lecture 5 - Menus (1)(VB 2008)

    13/14

    Coding the Menus (3)

  • 8/14/2019 Lecture 5 - Menus (1)(VB 2008)

    14/14

    Conclusion (Cont. in Lecture 6)

    In this Lecture, we discussed theMenuStrip Control,which: Allows you to add Menus, Menu Items, and SubMenu Items

    Including the addition ofAccess Keys and Shortcut Keys As well as Check Marks

    We also used the Menu Editor: Which allowed us to Add, Change, and Delete Menu Items.

    In Lecture 6, we continue our discussion ofMenus, by : Finishing ourQuickMenu Project

    Coding our ToolStrips Testing Menu Functions

    Discussing Context Menus: A second type ofdrop-down menu also supported by VB .NET

    The ContextMenuStrip Control