Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

difference between modal and modeless dialogs in MFC

Can you please help me gain a comprehensive knowledge about differences between modal and modeless dialogs by introducing me excellent tutorial links?
For example can you explain me about the programs that are linked here? Are they modal and modeless ones?
Up to know I thought that designing a dialog using just codes means modeless but designing a dialog using Toolbox means modal but as much as I search, I get more confused. Can you help me understand more?

like image 506
Sepideh Abadpour Avatar asked Aug 23 '13 08:08

Sepideh Abadpour


People also ask

What is difference between modal and modeless dialog?

Modal dialog boxes, which require the user to respond before continuing the program. Modeless dialog boxes, which stay on the screen and are available for use at any time but permit other user activities.

What is modeless dialog?

A dialog box is referred to as modeless if the user does not have to close it in order to continue using the application that owns the dialog box. A modeless dialog box has the following characteristics. It has a thin border. It can be neither minimized nor maximized.

What is modal and modeless dialog box in C#?

The difference between a modal and modeless dialog box is that, modal dialogs once invoked will not allow the users to access the parent window, whereas modeless dialogs will allow the user to work with the parent window.


2 Answers

The difference between modal and modeless dialogs is not limited to MFC.

When a modal dialog is open you cannot interact with anything else than this modal dialog inside your program, as long as the modal dialog is open. Most dialogs are modal, for example the File-Save As dialogs are modal.

On the other hand a modeless dialog behaves just like a normal window, you can do anything you want while it is open. The spell checker dialog in Microsoft Word is an example of such a dialog.

The link you mentiond in your question has nothing to do with modal and modeless dialogs.

Modal dialogs are trivial in MFC.

Modeless dialogs are a bit more complicated, but you can find plenty of tutorials by searching "mfc modeless dialog tutorial" on google.

like image 195
Jabberwocky Avatar answered Sep 22 '22 16:09

Jabberwocky


Modal dialog boxes are created by invoking the DoModal member function of your CDialog derived class in MFC or using the DialogBox API function.

Modeless dialog boxes are created by invoking the Create() (or CreateIndirect) member function of your CDialog derived class in MFC or using the CreateDialog API function.

The above links also explain what else you need to do to support the modal and modeless dialog boxes, for MFC, this MSDN link has some more information.

like image 40
Edward Clements Avatar answered Sep 19 '22 16:09

Edward Clements