Board index » Visual Studio » Using modal window??

Using modal window??

Visual Studio20
Hi



I have several dialogs that interact with each other through buttons.

When a certain dialog appears I want it to be the focus until it is

destroyed. The user should not be able to click anywhere in the

application apart from this dialog.



I currently have this working but the user can still click on the

originating dialog, any ideas?



Thanks in advance


-
 

Re:Using modal window??

Seems like you are using Modeless dialogs, why don't you use modal dialogs

instead?



AliR.



"wallacej" <jamie_r_wallace@yahoo.co.uk>wrote in message

Quote
Hi



I have several dialogs that interact with each other through buttons.

When a certain dialog appears I want it to be the focus until it is

destroyed. The user should not be able to click anywhere in the

application apart from this dialog.



I currently have this working but the user can still click on the

originating dialog, any ideas?



Thanks in advance







-

Re:Using modal window??

can you explain how to use modal dialogs? I have looked for help but

it all relates to creating objects. Im creating the dialog using the

design tools in Visual C++.NET. You'll have to excuse me as I'm very

new to using C++ GUI



thanks in advance



wallace



-

Re:Using modal window??

Designing your dialog has no significance on whether it's modal or not,

though the defining it as a CHILD might not work out the way you want it.

Anyway, the way you display a modal dialog is by calling the CDialog's

DoModal() Method, vers calling CDialog's Create method.





CMyDialog Dlg;

Dlg.DoModal();



AliR.



"wallacej" <jamie_r_wallace@yahoo.co.uk>wrote in message

Quote
can you explain how to use modal dialogs? I have looked for help but

it all relates to creating objects. Im creating the dialog using the

design tools in Visual C++.NET. You'll have to excuse me as I'm very

new to using C++ GUI



thanks in advance



wallace







-

Re:Using modal window??

Hi



I've had a look at the suggestions on modal dialogs and I am still

confused. The method used to create the dialogs is the same as in the

following tutorial (I am maintaining previously written code):



cpp.enisoc.com/articles/dialogs/">cpp.enisoc.com/articles/dialogs/



The DialogBox() function is used to create the modal dialog boxes as

the tutorial suggests.



if(DialogBox((HINSTANCE)hinstDLL, MAKEINTRESOURCE(IDD_PROPERTY), hWnd,

(DLGPROC)ShowPropDlgProc) == -1) MessageBox(NULL, "Unable to open

property dialog", "Error", MB_OK|MB_ICONSTOP);//if not error



When the dialog pops up it is possible to click and use the other

windows in the application, which I do not want to happen. Can anybody

tell me why? You'll have to excuse me if I've posted this on the wrong

forum. I'm very new to C++ and its different environments and I've

sort of been thrown in the deep end! Which is fun!



Wallace



-