Aric Stewart : comctl32: TCM_SETCURSEL also updates the focus item.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Sep 10 10:17:53 CDT 2007


Module: wine
Branch: master
Commit: 3822aa4b638ac1820d80fedee05c37f777137854
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=3822aa4b638ac1820d80fedee05c37f777137854

Author: Aric Stewart <aric at codeweavers.com>
Date:   Tue Sep  4 15:38:19 2007 +0900

comctl32: TCM_SETCURSEL also updates the focus item.

---

 dlls/comctl32/tab.c       |    1 +
 dlls/comctl32/tests/tab.c |   10 ++++++----
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/dlls/comctl32/tab.c b/dlls/comctl32/tab.c
index 830bc7e..d3cf0fd 100644
--- a/dlls/comctl32/tab.c
+++ b/dlls/comctl32/tab.c
@@ -255,6 +255,7 @@ static inline LRESULT TAB_SetCurSel (TAB_INFO *infoPtr, INT iItem)
   else {
       if (infoPtr->iSelected != iItem) {
           infoPtr->iSelected=iItem;
+          infoPtr->uFocus=iItem;
           TAB_EnsureSelectionVisible(infoPtr);
           TAB_InvalidateTabArea(infoPtr);
       }
diff --git a/dlls/comctl32/tests/tab.c b/dlls/comctl32/tests/tab.c
index 3069d13..1787a8b 100644
--- a/dlls/comctl32/tests/tab.c
+++ b/dlls/comctl32/tests/tab.c
@@ -182,6 +182,7 @@ static const struct message getset_cur_focus_seq[] = {
 static const struct message getset_cur_sel_seq[] = {
     { TCM_SETCURSEL, sent|lparam, 0 },
     { TCM_GETCURSEL, sent|wparam|lparam, 0, 0 },
+    { TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
     { TCM_SETCURSEL, sent|lparam, 0 },
     { TCM_GETCURSEL, sent|wparam|lparam, 0, 0 },
     { TCM_SETCURSEL, sent|lparam, 0 },
@@ -673,9 +674,7 @@ static void test_getters_setters(INT nTabs)
 
         SendMessage(hTab, TCM_SETCURFOCUS, nTabs+1, 0);
         focusIndex = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0);
-        todo_wine{
             expect(1, focusIndex);
-        }
 
         ok_sequence(sequences, TAB_SEQ_INDEX, getset_cur_focus_seq, "Getset curFoc test sequence", FALSE);
     }
@@ -683,6 +682,7 @@ static void test_getters_setters(INT nTabs)
     /* Testing CurSel */
     {
         INT selectionIndex;
+        INT focusIndex;
 
         flush_sequences(sequences, NUM_MSG_SEQUENCES);
 
@@ -692,6 +692,10 @@ static void test_getters_setters(INT nTabs)
         selectionIndex = SendMessage(hTab, TCM_GETCURSEL, 0, 0);
             expect(nTabs-1, selectionIndex);
 
+        /* Focus should switch with selection */
+        focusIndex = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0);
+            expect(nTabs-1, focusIndex);
+
         /* Testing CurSel with negative value */
         SendMessage(hTab, TCM_SETCURSEL, -10, 0);
         selectionIndex = SendMessage(hTab, TCM_GETCURSEL, 0, 0);
@@ -704,9 +708,7 @@ static void test_getters_setters(INT nTabs)
         selectionIndex = SendMessage(hTab, TCM_SETCURSEL, nTabs+1, 0);
             expect(-1, selectionIndex);
         selectionIndex = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0);
-        todo_wine{
             expect(1, selectionIndex);
-        }
 
         ok_sequence(sequences, TAB_SEQ_INDEX, getset_cur_sel_seq, "Getset curSel test sequence", FALSE);
         ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Getset curSel test parent sequence", FALSE);




More information about the wine-cvs mailing list