Menu Items in Menu Bar

Can you have more than one menu item in the menu bar

Currently, I have two menu items (Tools and Edit) in the command bar. When clicked, both will bring up a popup menu. HOWEVER, when I click on Edit...i see Tool's popup menu instead of Edit's own correct menu popup.

Can I even have more than one menu item in the command bar

Anyone have any ideas



Answer this question

Menu Items in Menu Bar

  • FALCO

    So I think i may have found the solution...kinda of.

    So I was at the MSN website regarding migration to vs2005. I was completing the exercise and I noticed it answered my problem.

    http://msdn.microsoft.com/library/default.asp url=/library/en-us/dnppcgen/html/med303_msdn_migrate_evc_app_vs2k5.asp

    In the exercise it says i need to make some changes to the rc file.

    Mainly, it put all the menu items into a single menu item.

    It says Convert THIS

    IDR_MAINFRAME MENU PRELOAD DISCARDABLE
    BEGIN
    POPUP "&File"
    BEGIN
    MENUITEM "&New...\tCtrl+N", ID_FILE_NEW
    MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN
    MENUITEM SEPARATOR
    MENUITEM "E&xit", ID_APP_EXIT
    END
    POPUP "&Edit"
    BEGIN
    MENUITEM "&Commit Check", ID_EDIT_COMMIT
    MENUITEM SEPARATOR
    MENUITEM "&New Check", ID_EDIT_NEW_CHECK
    MENUITEM SEPARATOR
    MENUITEM "Ne&xt Check", ID_NEXT_CHECK
    MENUITEM "&Prev Check", ID_PREV_CHECK
    END
    POPUP "&View"
    BEGIN
    MENUITEM "&Check", ID_VIEW_CHECK
    MENUITEM "&Book", ID_VIEW_BOOK
    END
    POPUP "&Help"
    BEGIN
    MENUITEM "&About...", ID_APP_ABOUT
    END
    END

    TO THIS

    IDR_MAINFRAME MENU PRELOAD DISCARDABLE
    BEGIN
    POPUP "Menu"
    BEGIN
    POPUP "File"
    BEGIN
    MENUITEM "New...", ID_FILE_NEW
    MENUITEM "Open...", ID_FILE_OPEN
    MENUITEM SEPARATOR
    MENUITEM "Exit", ID_APP_EXIT
    END
    POPUP "Edit"
    BEGIN
    MENUITEM "Commit Check", ID_EDIT_COMMIT
    MENUITEM SEPARATOR
    MENUITEM "New Check", ID_EDIT_NEW_CHECK
    MENUITEM SEPARATOR
    MENUITEM "Next Check", ID_NEXT_CHECK
    MENUITEM "Prev Check", ID_PREV_CHECK
    END
    POPUP "View"
    BEGIN
    MENUITEM "Check", ID_VIEW_CHECK
    MENUITEM "Book", ID_VIEW_BOOK
    END
    POPUP "Help"
    BEGIN
    MENUITEM "About...", ID_APP_ABOUT
    END
    END
    END

    Anyone back up my claim that WM 5.0 only allows for a single menu item now

    If this is true, anyway around this little problem


  • cya

    I did have one other question, what is IDM_MENU

    I want to use my own custom popup menu. Do i need to do something that is connected to IDM_MENU


  • neutroncore

    Hi,

    More than one popup menu at the base level are allowed. The changes on the page are directed towards a smartphone style two button commandbar that makes hardware buttons based nativagation possible. Enclosing the popups in another popup converts them into one menu.

    If you are using SHMENUBAR resource as suggested on the page. Then

    IDR_MAINFRAME RCDATA
    BEGIN
      IDR_MAINFRAME, #this is the menu resource that shall be used for getting the popup menus.
      2,	#number of buttons
      
      I_IMAGENONE, ID_FILE_NEW, TBSTATE_ENABLED, TBSTYLE_BUTTON | 
    TBSTYLE_AUTOSIZE, IDS_NEW, 0, NOMENU, #nomenu mean a button not a popup. I_IMAGENONE, IDM_MENU, TBSTATE_ENABLED, TBSTYLE_DROPDOWN |
    TBSTYLE_AUTOSIZE, IDS_MENU, 0, 0, #this is the index of the submenu in IDR_MAINFRAM menu, i.e. "MENU" with the change and "File" without it. END

     With a SHMENUBAR/RCDATA resource by the same name, the actual resource that gets used for the commandbar is not the menu but this toolbar resource. Adding more menus at the base level require you to change the number of buttons entry and add a line similar  to the last with the appropriate submenu idex.

    Hope this helps

    Thanks



  • Rex Morgan

    Again, you have saved the day. It worked!!!!

    You should consider offering your knowledge about Pocket PC as a consulting service. I think a lot of people would hire you with all the experience you have. I know, I would hired a person for such a service to save time.


  • superjugy

    I am using Windows Mobile 5.0
  • Robert Vabo

    Hi,
    Thanks for appreciation.

    Look at http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=369959&SiteID=1 for answer to the question regarding putting a check mark before the menu item. I think it is just what you want.

    As for IDM_MENU, this is the command associated with the button. Although the button has a popup associated with it and thus you don't actually handle it in your code, this can still be used to get infromation about the button as in a normal toolbar. It is useful when you try to change the menu associated with the button, change the text being displayed on the button etc.

    Hope this helps.
    Thanks


  • Menu Items in Menu Bar