rafi
April 13th, 1999, 07:15 AM
I have 3 dialogs on a Screen. The order is like this. First I have created a Modal Dialog. Over the Modal Dialog I have created a Modeless Dialog. And on a Button click event on the modeless dialog I have created one more Modal Dialog. The problem is When the mouse is clicked on the modeless dialog the control is within the 3rd dialog whereas when the mouse is clicked on the first created modal dialog the control is lost and it gives some assertion errors. The assertion errors are due to non destruction of the later dialogs. Please clear my doubt how to retain the control over the 3rd dialog even when the mouse is clicked on the first created dialog.
Paul McKenzie
April 13th, 1999, 01:39 PM
To tell you the truth, it's not a good idea to mix modal and modeless dialogs in the manner that you have done. Your problem has to do with the way modeless dialogs get there messages sent to them. Modeless dialogs rely on messages sent from the parent's message pump (and must be sent using IsDialogMessage), while a modal dialog has its own private message pump, independent of the parent.
My theory is this (I may be wrong):
Given that the first dialog is modal, you've disabled the applications message processing and have entered another message loop, namely the modal dialog's. You then bring up a modeless dialog, but where is it going to get the messages from? The app's message pump is disabled, and the first modal dialog's message pump is not calling IsDialogMessage so that the modeless dialog can get it's messages. Therefore the modeless dialog is in no mans land waiting for messages that are never sent.
Can you state what the assertions were? Also, I would consider another UI design. A lot of dialogs popping up (especially if there are 3 or more, plus a modeless one in the middle of the pile) would be cumbersome to the normal Windows user. Possibly a property sheet?
Regards,
Paul McKenzie