Hi Mike, That sounds like a good idea. As soon as my colleague is at the office we'll try that. Thanks so far. Sascha
sascha billian
Posts
-
Creating a SDI window from a dialog (MFC) -
Creating a SDI window from a dialog (MFC)correct. any clues? thanks Sascha
-
Creating a SDI window from a dialog (MFC)Yes, the window appears. I haven't the code here, because i'm at home, but the window shows as it should. but there's one thing i forgot to tell you. The problem problem occured, when we tried to gray out a button in the toolbar by clicking on another toolbar button. It didn't gray out. BUT: in the menu bar, if i try the same with the menu items which are linked with the buttons (same id), one item is grayed out when clicking the other: this is the code which is used to create the doc/view and show the window:
CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS(CSDI_LeerDoc), RUNTIME_CLASS(CMainFrame), RUNTIME_CLASS(CSDI_LeerView)); AddDocTemplate(pDocTemplate); CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); if (!ProcessShellCommand(cmdInfo)) return FALSE; m_pMainWnd->ShowWindow(SW_SHOW); m_pMainWnd->UpdateWindow(); ...
thanks! Sascha -
Creating a SDI window from a dialog (MFC)Hi there! We've got a real big problem, allthough it seems to be not really difficult: Our main application is a dialog which definitely MUST remain a dialog. My colleague wants to create a SDI window from this dialog by clicking on a specific button. Still no problem. The problem ist, that the window seems not to get the windows messages: Usually if you create a method to handle a mouseclick on a button in the toolbar, you can also create a function
OnUpdateClickXXX(CCmdUI* pCmdUI)
for example you could gray a specific button, if ButtonXXX is being clicked on. But OnUpdateClickXXX is never called! For me it seems, that the WM_PAINT message is being processed just by the dialog. the SDI window is created withCSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS(CSDI_LeerDoc), RUNTIME_CLASS(CMainFrame), RUNTIME_CLASS(CSDI_LeerView)); AfxGetApp()->AddDocTemplate(pDocTemplate); //because i am in the dialog, i have to call AfxGetApp() to register the doctemplate with the application
when you click on a button in the dialog. All OnClickBlah, OnUpdateBlah... methods are inserted by the class wizard, and the AFX_MESSAGE_MAP has the correct ON_COMMAND, ON_UPDATE_COMMAND...entries Could you give us some hints, where we could look for that problem? Sure, the problem is caused by the dialog "standing" between the application and the doc/view. Thank you all, and i hope you can help us with our problem. Sascha Billian Sascha Billian -
Creating a SDI window from a dialogHi there! [edit]: Sorry, wrong Message board. I'll post it on the VC++/MFC Board [/edit] We've got a real big problem, allthough it seems to be not really difficult: Our main application is a dialog which definitely MUST remain a dialog. My colleague wants to create a SDI window from this dialog by clicking on a specific button. Still no problem. The problem ist, that the window seems not to get the windows messages: Usually if you create a method to handle a mouseclick on a button in the toolbar, you can also create a function
OnUpdateClickXXX(CCmdUI* pCmdUI)
for example you could gray a specific button, if ButtonXXX is being clicked on. But OnUpdateClickXXX is never called! For me it seems, that the WM_PAINT message is being processed just by the dialog. the SDI window is created withCSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS(CSDI_LeerDoc), RUNTIME_CLASS(CMainFrame), RUNTIME_CLASS(CSDI_LeerView)); AfxGetApp()->AddDocTemplate(pDocTemplate); //because i am in the dialog, i have to call AfxGetApp() to register the doctemplate with the application
when you click on a button in the dialog. All OnClickBlah, OnUpdateBlah... methods are inserted by the class wizard, and the AFX_MESSAGE_MAP has the correct ON_COMMAND, ON_UPDATE_COMMAND...entries Could you give us some hints, where we could look for that problem? Sure, the problem is caused by the dialog "standing" between the application and the doc/view. Thank you all, and i hope you can help us with our problem. Sascha Billian