comctl32: Set tab focus correctly.

This commit is contained in:
Lei Zhang 2007-10-29 18:47:09 -07:00 committed by Alexandre Julliard
parent 73213d1444
commit f2519fdcda
2 changed files with 9 additions and 20 deletions

View File

@ -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;
}

View File

@ -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);