GetNextDlgTabItem returns hwndDlg if it does not contain controls. GetNextDlgTabItem returns the first child if next TABSTOP control not found.

Mikhail Maroukhine mikolg at yandex.ru
Wed Aug 18 12:53:19 CDT 2010


---
 dlls/user32/dialog.c       |   15 ++++++++++++++-
 dlls/user32/tests/dialog.c |   14 ++++++++++++++
 2 files changed, 28 insertions(+), 1 deletions(-)

diff --git a/dlls/user32/dialog.c b/dlls/user32/dialog.c
index aac8a4d..bb17fea 100644
--- a/dlls/user32/dialog.c
+++ b/dlls/user32/dialog.c
@@ -1683,6 +1683,7 @@ static HWND DIALOG_GetNextTabItem( HWND hwndMain, HWND hwndDlg, HWND hwndCtrl, B
 HWND WINAPI GetNextDlgTabItem( HWND hwndDlg, HWND hwndCtrl,
                                    BOOL fPrevious )
 {
+    HWND nextItem;
     hwndDlg = WIN_GetFullHandle( hwndDlg );
     hwndCtrl = WIN_GetFullHandle( hwndCtrl );
 
@@ -1695,7 +1696,19 @@ HWND WINAPI GetNextDlgTabItem( HWND hwndDlg, HWND hwndCtrl,
      */
     if (!hwndCtrl && fPrevious) return 0;
 
-    return DIALOG_GetNextTabItem(hwndDlg,hwndDlg,hwndCtrl,fPrevious);
+    nextItem = DIALOG_GetNextTabItem(hwndDlg,hwndDlg,hwndCtrl,fPrevious);
+    
+    /* if next tab item not found return the first child even if it does not have TABSTOP 
+       Checked on XP
+    */
+    if (!nextItem && !fPrevious) nextItem = GetWindow(hwndDlg,GW_CHILD);
+
+    /* if there is no controls on hwndDlg return hwndDlg
+       Checked on XP
+    */
+    if (!nextItem && !fPrevious) nextItem = hwndDlg;
+    
+    return nextItem;
 }
 
 /**********************************************************************
diff --git a/dlls/user32/tests/dialog.c b/dlls/user32/tests/dialog.c
index b7727da..9c12340 100644
--- a/dlls/user32/tests/dialog.c
+++ b/dlls/user32/tests/dialog.c
@@ -142,6 +142,14 @@ static const h_entry hierarchy [] = {
     { 30,  5,  WS_CHILD | WS_VISIBLE | WS_GROUP, 0},
     /* And around them */
     { 84,  4,  WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0},
+    
+    /* empty window */
+    {  100,  0, WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS, WS_EX_WINDOWEDGE},
+    
+    /* window with no tabstop element */
+    {  101,  0, WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS, WS_EX_WINDOWEDGE},    
+    {  102,  101, WS_CHILD | WS_VISIBLE},    
+    
     {0, 0, 0, 0}
 };
 
@@ -336,6 +344,9 @@ static int id (HWND h)
  *      (group test)
  *  36. Passing NULL may result in the first child being the one returned.
  *      (tab test)
+ *  37. GetNextDlgItem returns dlg hwnd if there is no controls
+ *      (tab test)
+ *  38. GetNextDlgItem returns the first child if there is no controls with TABSTOP
  */
 
 static void test_GetNextDlgItem(void)
@@ -381,6 +392,9 @@ static void test_GetNextDlgItem(void)
 
         {   1,  35,    2,   0,   0,   0,  60},
         {   1,  36,    2,   0,   1,   0,  60},
+        
+        {   1,  37,    100,   0,   1,   0,  100},        
+        {   1,  38,    101,   0,   1,   0,  102}, 
 
         {   0,   0,    0,   0,   0,   0,   0}  /* End of test */
     };
-- 
1.7.0.4


------------195ZnGQw4aZwCnsB6hCkyz--




More information about the wine-patches mailing list