Library tutorials & articles

Menus

Creating Submenus

In the Menu editor, you will notice that when you press the < and > buttons, dots will appear before the selected item. These show what item belongs to what. For example:

&File
....&Open
....&Save
....&Insert...
........&Text
........&Image
....&Close
&Help
....&About
<< Top Menu
<< Menu item of File
<< Menu item of File
<< Menu item of File
<< Sub Menu of Insert
<< Sub Menu of Insert
<< Menu item of File
<< Top Menu
<< Menu item of Help

So, to create a sub menu, simply follow these steps:

1) Select Tools | Menu Editor

2) Create a menu item which you want to contain the sub menu (which will have the > after it) i.e. Insert on the File menu

3) Insert an item after the menu item you have just created. (i.e. after Insert...). Click Insert:

4) Enter the text to be displayed for the sub menu item in the Caption text box (i.e. Text). As always you can use the & to set the Shortcut key: So &Text would display the menu item Text.

5) Enter a name for the menu item. This will be used when accessing the menu's properties in your code.

6) Press the > button until the item is indented once more than the menu you want to contain a sub menu. You will see four dots (....) appear before the text Open. This shows that Open is a sub menu item on the menu item Insert:

6) Click OK. If you have used the examples, you will now see something like this when you click on File:

Comments

  1. 28 Apr 2003 at 04:42

    In this tutorial i dosent tell you the code for the menu. and im also very new to vb so if someone could tell me what i need to do for the code that would be great.


  2. 17 Nov 2002 at 19:54

    I have made a menu with1 1 Item (about) set it to enable - unchecked visable
    made a click event(msg box)


    then in my form mouse up event I put

    Code:

    Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = vbRightButton Then
       ' Set the flags
       vFlags = vbPopupMenuRightButton
       ' Display the menu
       PopupMenu about, vFlags
       End If
    End Sub
     I get compile error variable not defined   with vFlags?
    do i need to dim vFlags = "somthing " in the  Option Explicit section of the code?

  3. 20 May 2002 at 12:39

    sorry 'bout that... there was an old style link lurking in there... I have corrected the link on


    http://www.developerfusion.com/show/15/10/, which now points to


    http://www.developerfusion.com/show/49/4/ (menu status subclassing)


    not sure about changing the colour of your menu, other than drawing it yourself, or using one of the http://vbaccelerator.com/ controls

  4. 20 May 2002 at 12:11

    i click view an example and no example???
    i really want to change the look of my menu,change color or nything? ny ideas?

  5. 01 Jan 1999 at 00:00

    This thread is for discussions of Menus.

Leave a comment

Sign in or Join us (it's free).