diff --git a/dlls/comctl32/tab.c b/dlls/comctl32/tab.c index 2db8cfee28..5f9e2957f8 100644 --- a/dlls/comctl32/tab.c +++ b/dlls/comctl32/tab.c @@ -2325,11 +2325,6 @@ static void TAB_Refresh (TAB_INFO *infoPtr, HDC hdc) /* Then, draw the selected item */ TAB_DrawItem (infoPtr, hdc, infoPtr->iSelected); - - /* If we haven't set the current focus yet, set it now. - * Only happens when we first paint the tab controls */ - if (infoPtr->uFocus == -1) - TAB_SetCurFocus(infoPtr, infoPtr->iSelected); } SelectObject (hdc, hOldFont); @@ -2637,6 +2632,10 @@ TAB_InsertItemT (TAB_INFO *infoPtr, WPARAM wParam, LPARAM lParam, BOOL bUnicode) TRACE("[%p]: added item %d %s\n", infoPtr->hwnd, iItem, debugstr_w(item->pszText)); + /* If we haven't set the current focus yet, set it now. */ + if (infoPtr->uFocus == -1) + TAB_SetCurFocus(infoPtr, iItem); + return iItem; } diff --git a/dlls/comctl32/tests/tab.c b/dlls/comctl32/tests/tab.c index 32de6bc3f0..9489376745 100644 --- a/dlls/comctl32/tests/tab.c +++ b/dlls/comctl32/tests/tab.c @@ -876,9 +876,7 @@ static void test_insert_focus(HWND parent_wnd) expect(1, nTabsRetrieved); r = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0); - todo_wine { - expect(0, r); - } + expect(0, r); tcNewTab.iImage = 2; r = SendMessage(hTab, TCM_INSERTITEM, 2, (LPARAM) &tcNewTab); @@ -888,9 +886,7 @@ static void test_insert_focus(HWND parent_wnd) expect(2, nTabsRetrieved); r = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0); - todo_wine { - expect(0, r); - } + expect(0, r); r = SendMessage(hTab, TCM_SETCURFOCUS, -1, 0); expect(0, r); @@ -903,9 +899,7 @@ static void test_insert_focus(HWND parent_wnd) expect(2, r); r = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0); - todo_wine { - expect(2, r); - } + expect(2, r); ok_sequence(sequences, TAB_SEQ_INDEX, insert_focus_seq, "insert_focus test sequence", TRUE); ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "insert_focus parent test sequence", FALSE); @@ -930,9 +924,7 @@ static void test_delete_focus(HWND parent_wnd) expect(2, nTabsRetrieved); r = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0); - todo_wine { - expect(0, r); - } + expect(0, r); r = SendMessage(hTab, TCM_DELETEITEM, 1, 0); expect(1, r); @@ -941,9 +933,7 @@ static void test_delete_focus(HWND parent_wnd) expect(1, nTabsRetrieved); r = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0); - todo_wine { - expect(0, r); - } + expect(0, r); r = SendMessage(hTab, TCM_SETCURFOCUS, -1, 0); expect(0, r);