From 0e5dac618f0f3c9575864a078c3ce614035ef4fd Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Wed, 25 Mar 2009 18:34:58 -0400 Subject: [PATCH] comctl32/tab: Selected item should have TCIS_BUTTONPRESSED state. --- dlls/comctl32/tab.c | 16 +++++----------- dlls/comctl32/tests/tab.c | 10 ++++++++++ 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/dlls/comctl32/tab.c b/dlls/comctl32/tab.c index ac81016038e..62770aa8b85 100644 --- a/dlls/comctl32/tab.c +++ b/dlls/comctl32/tab.c @@ -252,6 +252,9 @@ static inline LRESULT TAB_SetCurSel (TAB_INFO *infoPtr, INT iItem) return -1; else { if (infoPtr->iSelected != iItem) { + infoPtr->items[prevItem].dwState &= ~TCIS_BUTTONPRESSED; + infoPtr->items[iItem].dwState |= TCIS_BUTTONPRESSED; + infoPtr->iSelected=iItem; infoPtr->uFocus=iItem; TAB_EnsureSelectionVisible(infoPtr); @@ -489,12 +492,8 @@ static LRESULT TAB_KeyUp(TAB_INFO* infoPtr, WPARAM keyCode) { if (!TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGING)) { - infoPtr->iSelected = newItem; - infoPtr->uFocus = newItem; + TAB_SetCurSel(infoPtr, newItem); TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGE); - - TAB_EnsureSelectionVisible(infoPtr); - TAB_InvalidateTabArea(infoPtr); } } @@ -615,13 +614,8 @@ TAB_LButtonDown (TAB_INFO *infoPtr, WPARAM wParam, LPARAM lParam) { if (!TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGING)) { - infoPtr->iSelected = newItem; - infoPtr->uFocus = newItem; + TAB_SetCurSel(infoPtr, newItem); TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGE); - - TAB_EnsureSelectionVisible(infoPtr); - - TAB_InvalidateTabArea(infoPtr); } } return 0; diff --git a/dlls/comctl32/tests/tab.c b/dlls/comctl32/tests/tab.c index 5f5e4b9c732..7cee79dfa03 100644 --- a/dlls/comctl32/tests/tab.c +++ b/dlls/comctl32/tests/tab.c @@ -727,6 +727,7 @@ static void test_getters_setters(HWND parent_wnd, INT nTabs) { INT selectionIndex; INT focusIndex; + TCITEM tcItem; flush_sequences(sequences, NUM_MSG_SEQUENCES); @@ -756,6 +757,15 @@ static void test_getters_setters(HWND parent_wnd, INT nTabs) 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); + + /* selected item should have TCIS_BUTTONPRESSED state + It doesn't depend on button state */ + memset(&tcItem, 0, sizeof(TCITEM)); + tcItem.mask = TCIF_STATE; + tcItem.dwStateMask = TCIS_BUTTONPRESSED; + selectionIndex = SendMessage(hTab, TCM_GETCURSEL, 0, 0); + SendMessage(hTab, TCM_GETITEM, selectionIndex, (LPARAM) &tcItem); + ok (tcItem.dwState & TCIS_BUTTONPRESSED, "Selected item should have TCIS_BUTTONPRESSED\n"); } /* Testing ExtendedStyle */ -- 2.11.4.GIT