When I have a main window with a child dialog on it, I can handle the tabstops in that dialog by setting the WS_EX_CONTROLPARENT extended style for the dialog and calling IsDialogMessage in the messageloop.
But now the dialog is nested one level more: Inside the main window is a child window (a custom control). This custom control contains a dialog. Is there a way to make the tabs work in this situation? Ideally, the custom control should use IsDialogMessage but as it's a child window of the main window, it does not have it's own message loop.
Thomas
But now the dialog is nested one level more: Inside the main window is a child window (a custom control). This custom control contains a dialog. Is there a way to make the tabs work in this situation? Ideally, the custom control should use IsDialogMessage but as it's a child window of the main window, it does not have it's own message loop.
Thomas
I've never tried this, but how about subclassing
the control. Then you would have a messageloop ?
the control. Then you would have a messageloop ?
No, that would give me the window procedure, not the message loop. IsDialogMessage needs to be called before TranslateAccelerator/DispatchMessage :(.
Thomas
Thomas
OK, now I'm awake and see where the problem is.
Have you tried nesting the IsDialogMessage ?
Warning, another untested idea :grin:
Have you tried nesting the IsDialogMessage ?
Warning, another untested idea :grin:
.while TRUE
invoke GetMessage,addr msg,NULL,0,0
.break .if (!eax)
invoke IsDialogMessage,hDlg1,addr msg
.if eax == FALSE
invoke IsDialogMessage,hDlg2,addr msg
.if eax == FALSE
invoke TranslateMessage,addr msg
invoke DispatchMessage,addr msg
.endif
.endif
.endw
I've never run into this situation before... but after some thought, and looking at the API reference... I have one idea:
As different angle to consider is: why dont you try to make the "layer 3" dialog a child of the Parent window (Layer 1), when creating the dialog from the Custom Control (Layer 2).
This way, the main message loop (layer 1) will see both the Custom control, and the Dialog as PARALLEL children of it...??
Just a thought?
:alright:
NaN
As different angle to consider is: why dont you try to make the "layer 3" dialog a child of the Parent window (Layer 1), when creating the dialog from the Custom Control (Layer 2).
This way, the main message loop (layer 1) will see both the Custom control, and the Dialog as PARALLEL children of it...??
Just a thought?
:alright:
NaN
I believe NaN almost hit it on the nail :alright:
I would recommend a slightly different route. Technically speaking, windows messages are not routed to their current parent but rather the parent they were on when *created*.
So if the wanted nesting is:
Top level -> Dialog1 -> Dialog2
then make it this instead...
Top level->Dialog1 & Dialog2
(Much like NaN suggested). But after this step re-assign Dialog2 to Dialog1 to make it look like figure 1. The messages will still be routed to the Top Level window because it was created that way
:grin:
I would recommend a slightly different route. Technically speaking, windows messages are not routed to their current parent but rather the parent they were on when *created*.
So if the wanted nesting is:
Top level -> Dialog1 -> Dialog2
then make it this instead...
Top level->Dialog1 & Dialog2
(Much like NaN suggested). But after this step re-assign Dialog2 to Dialog1 to make it look like figure 1. The messages will still be routed to the Top Level window because it was created that way
:grin:
Thanks everyone but I found out what caused it. It does work normally but the dialog handle was not passed correctly to IsDialogMessage...
:stupid:
Thomas
:stupid:
Thomas