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

Mikhail Maroukhine mikolg at yandex.ru
Thu Aug 19 12:42:12 CDT 2010


And returns 0 in both cases if searching prev item
---
 dlls/user32/dialog.c       |   15 ++++++++++++++-
 dlls/user32/tests/dialog.c |   19 +++++++++++++++++++
 2 files changed, 33 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..c4d55be 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,12 @@ 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 and searching next control
+ *      (tab test)
+ *  38. GetNextDlgItem returns 0 if there is no controls and searching prev control
+ *      (tab test)
+ *  39. GetNextDlgItem returns the first child if there is no controls with TABSTOP and searching next control
+ *  40. GetNextDlgItem returns 0 if there is no controls with TABSTOP and searching prev control
  */
 
 static void test_GetNextDlgItem(void)
@@ -381,6 +395,11 @@ 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,    100,   0,   1,   1,  0},
+        {   1,  39,    101,   0,   1,   0,  102},
+        {   1,  40,    101,   0,   1,   1,  0},
 
         {   0,   0,    0,   0,   0,   0,   0}  /* End of test */
     };
-- 
1.7.0.4


------------mPMAolpDjCUg7CXOk9RT6k--




More information about the wine-patches mailing list