MDI apps and keyboard navigation (dialogui)

View: New views
2 Messages — Rating Filter:   Alert me  

MDI apps and keyboard navigation (dialogui)

by Salvador Ortiz Garcia-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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 <sog@...>


[MDI-dialogui.patch]

--- 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);


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Perl-Win32-GUI-Hackers mailing list
Perl-Win32-GUI-Hackers@...
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-hackers
http://perl-win32-gui.sourceforge.net/

Re: MDI apps and keyboard navigation (dialogui)

by Robert May-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 15/07/07, Salvador Ortiz GarcĂ­a <sog@...> wrote:

> 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?

Thanks.  I've applied this to my local copy, and will sync it into CVS
once I've had a chance to give it a spin.  MDI windows aren't
something I use much (at all?), so I'll only be making sure it doesn't
break anything else.

Regards,
Rob.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Perl-Win32-GUI-Hackers mailing list
Perl-Win32-GUI-Hackers@...
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-hackers
http://perl-win32-gui.sourceforge.net/
LightInTheBox - Buy quality products at wholesale price!