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