Commit 9cec74f3 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comctl32/tab: Reset current selection on negative focus value.

parent 33a1e827
......@@ -269,8 +269,14 @@ static LRESULT TAB_SetCurFocus (TAB_INFO *infoPtr, INT iItem)
{
TRACE("(%p %d)\n", infoPtr, iItem);
if (iItem < 0)
if (iItem < 0) {
infoPtr->uFocus = -1;
if (infoPtr->iSelected != -1) {
infoPtr->iSelected = -1;
TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGE);
TAB_InvalidateTabArea(infoPtr);
}
}
else if (iItem < infoPtr->uNumItem) {
if (infoPtr->dwStyle & TCS_BUTTONS) {
/* set focus to new item, leave selection as is */
......
......@@ -660,9 +660,7 @@ static void test_curfocus(HWND parent_wnd, INT nTabs)
/* Testing CurFocus with value larger than number of tabs */
focusIndex = SendMessage(hTab, TCM_SETCURSEL, 1, 0);
todo_wine{
expect(-1, focusIndex);
}
expect(-1, focusIndex);
SendMessage(hTab, TCM_SETCURFOCUS, nTabs+1, 0);
focusIndex = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0);
......@@ -1059,7 +1057,7 @@ static void test_insert_focus(HWND parent_wnd)
expect(2, r);
ok_sequence(sequences, TAB_SEQ_INDEX, insert_focus_seq, "insert_focus test sequence", FALSE);
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "insert_focus parent test sequence", FALSE);
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "insert_focus parent test sequence", TRUE);
DestroyWindow(hTab);
}
......@@ -1108,7 +1106,7 @@ static void test_delete_focus(HWND parent_wnd)
expect(-1, r);
ok_sequence(sequences, TAB_SEQ_INDEX, delete_focus_seq, "delete_focus test sequence", FALSE);
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "delete_focus parent test sequence", FALSE);
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "delete_focus parent test sequence", TRUE);
DestroyWindow(hTab);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment