Software Archive
Read-only legacy content
17060 Discussions

Nested modeless dialog boxes

Ray_R_1
Beginner
408 Views
I'm trying to nest three to four layers of modeless dialog boxes with several dialog boxes on each level. My question is do you need to setup a message loop for each modeless dialog box created, for each level or just one at the top to handle the whole thing ?? The message loop I'm talking about is
do while( GetMessage (mesg, NULL, 0, 0) )
if ( DlgIsDlgMessage(mesg) .EQV. .FALSE. ) then
Lret = TranslateMessage( mesg )
Iret = DispatchMessage( mesg )
end if
end do

Thanks
Ray
0 Kudos
2 Replies
Jugoslav_Dujic
Valued Contributor II
408 Views
What do you mean "nested modeless dialogs"? Are those actually child dialogs (as in tab controls)? Whatever, that message loop you posted looks fine to me. One message loop is enough.

Jugoslav
0 Kudos
Jugoslav_Dujic
Valued Contributor II
408 Views
Huh, I was wrong. I just checked modeless dialogs in my app and found that they don't respond to tab properly (which I didn't know for two years ;-)).

Now, I don't know what DlgIsDlgMessage exactly does (I have an old CVF version) so perhaps it does the stuff correctly. IsDialogMessage is actually related with processing of tab key, default buttons (Return and Esc) and similar. However, I dug out an article in MS's knowledge base (Q71450) which explains the way. So, if your code above
doesn't work (remind you, regarding tab key), the following line does:
if (.not.IsDialogMessage(GetActiveWindow(), mesg))


Jugoslav
0 Kudos
Reply