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. General Programming
  3. C / C++ / MFC
  4. Checking drop down toolbar menu items

Checking drop down toolbar menu items

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
6 Posts 2 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.
  • K Offline
    K Offline
    Kapgan
    wrote on last edited by
    #1

    I have a drop down menu on one of my toolbar buttons. I am having problem with checking menu items. If I use CCmdUI::SetCheck method, there is no problem, but I want to do this in a different way. Why does this code give error? int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; ... ... menu_tb2_btn1.LoadMenu(IDR_MENU_TOOLBAR2_BUTTON1); ASSERT(menu_tb2_btn1); pPopup = menu_tb2_btn1.GetSubMenu(0); ... ... return 0; } void CMainFrame::OnTb2btn1Item1() { // TODO: Add your command handler code here ... ... pPopup->CheckMenuRadioItem(0,3,1,MF_BYPOSITION); ... ... }

    D 1 Reply Last reply
    0
    • K Kapgan

      I have a drop down menu on one of my toolbar buttons. I am having problem with checking menu items. If I use CCmdUI::SetCheck method, there is no problem, but I want to do this in a different way. Why does this code give error? int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; ... ... menu_tb2_btn1.LoadMenu(IDR_MENU_TOOLBAR2_BUTTON1); ASSERT(menu_tb2_btn1); pPopup = menu_tb2_btn1.GetSubMenu(0); ... ... return 0; } void CMainFrame::OnTb2btn1Item1() { // TODO: Add your command handler code here ... ... pPopup->CheckMenuRadioItem(0,3,1,MF_BYPOSITION); ... ... }

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Kapgan wrote: Why does this code give error? Exactly what error does it give? Is it a compiler error? A linker error? A run-time error? If the latter, what steps are you taking that leads up to this point?


      "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

      K 1 Reply Last reply
      0
      • D David Crow

        Kapgan wrote: Why does this code give error? Exactly what error does it give? Is it a compiler error? A linker error? A run-time error? If the latter, what steps are you taking that leads up to this point?


        "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

        K Offline
        K Offline
        Kapgan
        wrote on last edited by
        #3

        It's a run-time error. It says debug assertion failure. I defined a pPopup named object and tried to make it hold the drop down menu, so that I can easily have access to other functions. But unfortunately I couldn't do this.

        D 1 Reply Last reply
        0
        • K Kapgan

          It's a run-time error. It says debug assertion failure. I defined a pPopup named object and tried to make it hold the drop down menu, so that I can easily have access to other functions. But unfortunately I couldn't do this.

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          Kapgan wrote: It says debug assertion failure. Which line of which file?


          "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

          K 1 Reply Last reply
          0
          • D David Crow

            Kapgan wrote: It says debug assertion failure. Which line of which file?


            "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

            K Offline
            K Offline
            Kapgan
            wrote on last edited by
            #5

            Line 122 of afx.inl

            D 1 Reply Last reply
            0
            • K Kapgan

              Line 122 of afx.inl

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #6

              As the assertion is related to a CString object, the code snippet you've provided is of no help. You'll need to locate the CString object in question. Given that m_pchData is in error, my first guess is that it is a heap-based object.


              "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

              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