Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Dialog proc. question.

dzuba
Beginner
669 Views
Hello!

I created modal dialog this way:
flag = dlginit(IDD_DIALOG1,InfoDialog)
flag = DlgSetSub(InfoDialog, IDD_DIALOG1, MyCallbackFunction)
flag = DlgModal(InfoDialog, i)

I added a button to a dialog with VS Resource Editor.
If I click on it - the dialog box disapears!
WHY ?!


If I am trying to make modeless dialog:
flag = DlgModeless(InfoDialog, i, ghwndMain)
It not apears at all (or maybe apears and disapears quickly).
WHY ? How can I show modeless dialog?

The project is Single document Win32 application.

Thanks.
0 Kudos
3 Replies
anthonyrichards
New Contributor III
669 Views

The message from any control not assigned a call-back using DLGSETSUB will be handled by the default dialog procedure, which in my experience does just what you observe - it closes the box. So make re you assign the button a call-back.

Also, if you are using call-backs, use DLGMODAL(dlg), without the second argument.

You do not use call-backs with a modeless dialog. A modeless dialog requires a message loop and a dialog procedure to handle the messages.

Message Edited by anthonyrichards on 03-01-2006 09:03 AM

0 Kudos
Jugoslav_Dujic
Valued Contributor II
669 Views
You do not use call-backs with a modeless dialog. A modeless dialog requires a message loop and a dialog procedure to handle the messages.

This statement is ambiguous at best, and incorrect at worst.

A modeless dialog handled with DFLOGM can have callbacks, and they work the same way as in modal dialog. The only difference in this regard is that button without the callback does not close the dialog. (And I find that behavior of modal dialogs questionable).

A modeless dialog handled with DFLOGM does require a message loop, but if you're in a GUI application (or QuickWin's menu callback) the message loop is already there. It does not require a separate dialog procedure, as DFLOGM, of course, provides one (and, btw, it's the same as the one of modal dialogs, with few if's here and there to adjust modal/modeless behavior).
0 Kudos
anthonyrichards
New Contributor III
669 Views
Yes, well Jugoslav I did modify that statement later and include the CVF example code which shows a loop and callbacks being used with a modeless box. I thought I had posted the edited message, but it seems to have failed to get through.
0 Kudos
Reply