Hi all,
        
Right now when using the MDI TAB navigation just doesn't works, as a
test just change the MDI.pl sample by adding a second Textfield control,
make them singleline (to keep it simple), add the proper tabstop => 1
and try adding a dialogui=>1 either to the MDIChild or to the MDIFrame.
        
(Complete test case at request)
        
The first case (dialogui=>1 in MDIChild) simply doesn't works because in
the main loop of Dialog in GUI.xs, fIsDialog is tested only on the top
window.
        
In the second case (dialogui=>1 in MDIFrame) a first TAB seems to work,
but the focus doesn't move past the first control.
        
Worse, when I try adding a -controlparent => 1 to the MDIChild, a few
TABs results in all the application freezing.
        
The attached patch cures that, allowing dialogui=>1 in the MDIChild and
calling IsDialogMessage in the context of that window.
        
Comments?
        
Regards.
        
-- 
Salvador Ortiz <[EMAIL PROTECTED]>

--- GUI.xs	2007-01-20 11:09:22.000000000 -0600
+++ /home/sog/dosdir/work/Win32-GUI-1.05_01/GUI.xs	2007-07-15 02:18:17.000000000 -0500
@@ -1049,6 +1049,7 @@
     BOOL fIsMDI;
     HACCEL acc;
     LPPERLWIN32GUI_USERDATA perlud;
+    LPPERLWIN32GUI_USERDATA tperlud;
 CODE:
     stayhere = 1;
     fIsDialog = FALSE;
@@ -1080,10 +1081,22 @@
                 fIsMDI    = perlud->dwPlStyle & (PERLWIN32GUI_MDIFRAME | PERLWIN32GUI_HAVECHILDWINDOW);
                 acc = perlud->hAcc;
             }
+	    // ### If the parent window is a MDIFrame the active MDIChild 
+	    // ### can be THE DialogBox
+	    if(fIsMDI &&
+		(thwnd = (HWND)SendMessage((HWND)perlud->dwData,
+			WM_MDIGETACTIVE, (WPARAM) 0, (LPARAM) NULL)) &&
+		(tperlud = (LPPERLWIN32GUI_USERDATA) GetWindowLong(thwnd, 
+			GWL_USERDATA)) &&
+		ValidUserData(tperlud)) {
+		    fIsDialog = tperlud->dwPlStyle & PERLWIN32GUI_DIALOGUI;
+	    } else {
+		thwnd = phwnd;
+	    }
 
             if( !( (fIsMDI && TranslateMDISysAccel((HWND)perlud->dwData, &msg)) ||
                    (acc && TranslateAccelerator(phwnd, acc, &msg))              ||
-                   (fIsDialog && IsDialogMessage(phwnd, &msg)) ) 
+                   (fIsDialog && IsDialogMessage(thwnd, &msg)) ) 
               ){
                 TranslateMessage(&msg);
                 DispatchMessage(&msg);
@@ -1124,6 +1137,7 @@
     BOOL fIsMDI;
     HACCEL acc;
     LPPERLWIN32GUI_USERDATA perlud;
+    LPPERLWIN32GUI_USERDATA tperlud;
 CODE:
     stayhere = 1;
     fIsDialog = FALSE;
@@ -1151,10 +1165,20 @@
                     fIsMDI    = perlud->dwPlStyle & (PERLWIN32GUI_MDIFRAME | PERLWIN32GUI_HAVECHILDWINDOW);
                     acc = perlud->hAcc;
                 }
+		if(fIsMDI &&
+		    (thwnd = (HWND)SendMessage((HWND)perlud->dwData,
+			    WM_MDIGETACTIVE, (WPARAM) 0, (LPARAM) NULL)) &&
+		    (tperlud = (LPPERLWIN32GUI_USERDATA) GetWindowLong(thwnd, 
+			    GWL_USERDATA)) &&
+		    ValidUserData(tperlud)) {
+			fIsDialog = tperlud->dwPlStyle & PERLWIN32GUI_DIALOGUI;
+		} else {
+		    thwnd = phwnd;
+		}
 
                 if( !( (fIsMDI && TranslateMDISysAccel((HWND)perlud->dwData, &msg)) ||
                        (acc && TranslateAccelerator(phwnd, acc, &msg))              ||
-                       (fIsDialog && IsDialogMessage(phwnd, &msg)) ) 
+                       (fIsDialog && IsDialogMessage(thwnd, &msg)) ) 
                   ){
                     TranslateMessage(&msg);
                     DispatchMessage(&msg);

Reply via email to