[PATCH] user32: If a dialog has no tab-accessible controls, set focus to first control

Alex Henrie alexhenrie24 at gmail.com
Wed Nov 30 22:48:20 CST 2011


Fixes bug 22848, "Notepad++: Ctrl+tab doesn't work properly". The MSDN specification for this behavior can be found in the last sentence of http://msdn.microsoft.com/en-us/library/windows/desktop/ms644995%28v=vs.85%29.aspx#wm_initdialog
---
 dlls/user32/dialog.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/dlls/user32/dialog.c b/dlls/user32/dialog.c
index b9e739a..c6b2455 100644
--- a/dlls/user32/dialog.c
+++ b/dlls/user32/dialog.c
@@ -695,6 +695,7 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
         if (dlgProc)
         {
             HWND focus = GetNextDlgTabItem( hwnd, 0, FALSE );
+            if (!focus) focus = GetNextDlgGroupItem( hwnd, 0, FALSE );
             if (SendMessageW( hwnd, WM_INITDIALOG, (WPARAM)focus, param ) && IsWindow( hwnd ) &&
                 ((~template.style & DS_CONTROL) || (template.style & WS_VISIBLE)))
             {
@@ -702,6 +703,7 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
                  * WM_INITDIALOG may have changed the tab order, so find the first
                  * tabstop control again. */
                 dlgInfo->hwndFocus = GetNextDlgTabItem( hwnd, 0, FALSE );
+                if (!dlgInfo->hwndFocus) dlgInfo->hwndFocus = GetNextDlgGroupItem( hwnd, 0, FALSE );
                 if( dlgInfo->hwndFocus )
                     SetFocus( dlgInfo->hwndFocus );
             }
-- 
1.7.4.1






More information about the wine-patches mailing list