Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Mobile Development
  3. Mobile
  4. Problem disabling submenu item (Repost for Co-worker )

Problem disabling submenu item (Repost for Co-worker )

Scheduled Pinned Locked Moved Mobile
helptoolsquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • realJSOPR Offline
    realJSOPR Offline
    realJSOP
    wrote on last edited by
    #1

    I am unable to disable a second level menu item. I have a Tools popup menu on my menubar that contains two items and a popup item that also contains two menu items. It looks like this:

    Tools
    |--- Item1
    |--- Item2
    |---- SubItem1
    |---- SubItem2

    I used ClassWizard to add the usual ON_UPDATE_COMMAND_UI functions. In the appropriate function, I can use "pCmdUI->Enable(FALSE)" to disable "Item", but I can't disable "SubItem1" and "SubItem2". Matter of fact, the functions that ClassWizard generated for my two sub menu items are never even called. I have breakpoints on both these function and they are never even hit. This bug occurs on both my emulator and on my Compaq iPaq (arm processor). I created the project with AppWizard and am using a "Basic MenuBar". Any ideas? Can anyone else disable a submenu item? [edit] Forgot to mention that this is for PocketPC 2002. [/edit] ------- signature starts "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001 Please review the Legal Disclaimer in my bio. ------- signature ends

    J 1 Reply Last reply
    0
    • realJSOPR realJSOP

      I am unable to disable a second level menu item. I have a Tools popup menu on my menubar that contains two items and a popup item that also contains two menu items. It looks like this:

      Tools
      |--- Item1
      |--- Item2
      |---- SubItem1
      |---- SubItem2

      I used ClassWizard to add the usual ON_UPDATE_COMMAND_UI functions. In the appropriate function, I can use "pCmdUI->Enable(FALSE)" to disable "Item", but I can't disable "SubItem1" and "SubItem2". Matter of fact, the functions that ClassWizard generated for my two sub menu items are never even called. I have breakpoints on both these function and they are never even hit. This bug occurs on both my emulator and on my Compaq iPaq (arm processor). I created the project with AppWizard and am using a "Basic MenuBar". Any ideas? Can anyone else disable a submenu item? [edit] Forgot to mention that this is for PocketPC 2002. [/edit] ------- signature starts "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001 Please review the Legal Disclaimer in my bio. ------- signature ends

      J Offline
      J Offline
      Joao Paulo Figueira
      wrote on last edited by
      #2

      I did some research on this and found the following (file winfrm.cpp, line 1607 of the MFC sources):

      if (state.m_nID == (UINT)-1)
      {
      // possibly a popup menu, route to first item of that popup
      state.m_pSubMenu = pMenu->GetSubMenu(state.m_nIndex);
      if (state.m_pSubMenu == NULL ||
      (state.m_nID = state.m_pSubMenu->GetMenuItemID(0)) == 0 ||
      state.m_nID == (UINT)-1)
      {
      continue; // first item of popup can't be routed to
      }
      state.DoUpdate(this, FALSE); // popups are never auto disabled
      }
      else
      {
      // normal menu item
      // Auto enable/disable if frame window has 'm_bAutoMenuEnable'
      // set and command is _not_ a system command.
      state.m_pSubMenu = NULL;
      state.DoUpdate(this, m_bAutoMenuEnable && state.m_nID < 0xF000);
      }

      This seems to imply that MFC does not allow that.

      realJSOPR 1 Reply Last reply
      0
      • J Joao Paulo Figueira

        I did some research on this and found the following (file winfrm.cpp, line 1607 of the MFC sources):

        if (state.m_nID == (UINT)-1)
        {
        // possibly a popup menu, route to first item of that popup
        state.m_pSubMenu = pMenu->GetSubMenu(state.m_nIndex);
        if (state.m_pSubMenu == NULL ||
        (state.m_nID = state.m_pSubMenu->GetMenuItemID(0)) == 0 ||
        state.m_nID == (UINT)-1)
        {
        continue; // first item of popup can't be routed to
        }
        state.DoUpdate(this, FALSE); // popups are never auto disabled
        }
        else
        {
        // normal menu item
        // Auto enable/disable if frame window has 'm_bAutoMenuEnable'
        // set and command is _not_ a system command.
        state.m_pSubMenu = NULL;
        state.DoUpdate(this, m_bAutoMenuEnable && state.m_nID < 0xF000);
        }

        This seems to imply that MFC does not allow that.

        realJSOPR Offline
        realJSOPR Offline
        realJSOP
        wrote on last edited by
        #3

        He doesn't want to disable a popup menu, he want's disable one of the items in it. ClassWizard allowed him to create OnUpdate handlers for the subitems, but that code isn't being called at all. ------- signature starts "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001 Please review the Legal Disclaimer in my bio. ------- signature ends

        T 1 Reply Last reply
        0
        • realJSOPR realJSOP

          He doesn't want to disable a popup menu, he want's disable one of the items in it. ClassWizard allowed him to create OnUpdate handlers for the subitems, but that code isn't being called at all. ------- signature starts "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001 Please review the Legal Disclaimer in my bio. ------- signature ends

          T Offline
          T Offline
          Travis101
          wrote on last edited by
          #4

          After reporting this issue to Microsoft's tech support, they acknowledged that this was a bug in Pocket PC 2002.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups