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. Menu invokes dialog

Menu invokes dialog

Scheduled Pinned Locked Moved C / C++ / MFC
c++comhelptutorialquestion
4 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
    kevincwong
    wrote on last edited by
    #1

    Hi, I am new to MFC. I am trying to invoke a dialog from the menu. I read the menus for beginners. http://www.codeproject.com/menu/MenusForBeginners.asp But I still a bit confused. Here is what I did. I already created a dialog, ID: IDD_MY_DIALOG. I also created a menu item and added event_handler with Message type: COMMAND, Class list: CMainFrame, ID: ID_MY_DIALOG. So, the Wizard created a default method for me void CMainFrame::OnMy_Dialog() { // TODO: Add your command handler code here } But I don't how to invoke my dialog when user clicked the "My_Dialog" menu item. Any help would be appreciated? Thanks, Kevin

    R 1 Reply Last reply
    0
    • K kevincwong

      Hi, I am new to MFC. I am trying to invoke a dialog from the menu. I read the menus for beginners. http://www.codeproject.com/menu/MenusForBeginners.asp But I still a bit confused. Here is what I did. I already created a dialog, ID: IDD_MY_DIALOG. I also created a menu item and added event_handler with Message type: COMMAND, Class list: CMainFrame, ID: ID_MY_DIALOG. So, the Wizard created a default method for me void CMainFrame::OnMy_Dialog() { // TODO: Add your command handler code here } But I don't how to invoke my dialog when user clicked the "My_Dialog" menu item. Any help would be appreciated? Thanks, Kevin

      R Offline
      R Offline
      Roger Allen
      wrote on last edited by
      #2

      When you created the dialog, you will have been prompted to create a wrapper class for it, e.g. CMyNewDialog. To pop one of these dialogs up you would do: CMyNewDialog dlgBox; // object is not a window until you call DoModal etc dlgBox.DoModal(); This would show the dialog on the screen If you vote me down, my score will only get lower

      K 1 Reply Last reply
      0
      • R Roger Allen

        When you created the dialog, you will have been prompted to create a wrapper class for it, e.g. CMyNewDialog. To pop one of these dialogs up you would do: CMyNewDialog dlgBox; // object is not a window until you call DoModal etc dlgBox.DoModal(); This would show the dialog on the screen If you vote me down, my score will only get lower

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

        Hi Roger, > When you created the dialog, you will have been prompted to > create a wrapper class for it, e.g. CMyNewDialog. When I right-mouse-clicked, it just pops up a default dialog. It did not prompted me to create a wrapper class. Can you tell me how to do so? >To pop one of these dialogs up you would do: >CMyNewDialog dlgBox; // object is not a window until you call DoModal etc >dlgBox.DoModal(); Oh yeah! I remember I read this from some books before. Really appreciated your help. Thanks, Kevin

        K 1 Reply Last reply
        0
        • K kevincwong

          Hi Roger, > When you created the dialog, you will have been prompted to > create a wrapper class for it, e.g. CMyNewDialog. When I right-mouse-clicked, it just pops up a default dialog. It did not prompted me to create a wrapper class. Can you tell me how to do so? >To pop one of these dialogs up you would do: >CMyNewDialog dlgBox; // object is not a window until you call DoModal etc >dlgBox.DoModal(); Oh yeah! I remember I read this from some books before. Really appreciated your help. Thanks, Kevin

          K Offline
          K Offline
          kevincwong
          wrote on last edited by
          #4

          I think I found the answer. 1) Open up the resource view. 2) click the dialog ID. 3) right click the dialog to add class.

          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