Commit 832b748b authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

user32/listbox: Update caret index on LB_SETSEL.

parent b37b3f00
......@@ -2963,7 +2963,11 @@ LRESULT ListBoxWndProc_common( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
case LB_SETSEL:
ret = LISTBOX_SetSelection( descr, lParam, wParam, FALSE );
if (ret != LB_ERR && wParam)
{
descr->anchor_item = lParam;
if (lParam != -1)
LISTBOX_SetCaretIndex( descr, lParam, TRUE );
}
return ret;
case LB_SETCURSEL:
......
......@@ -583,21 +583,29 @@ static void test_LB_SETSEL(void)
ret = SendMessageA(list, LB_GETANCHORINDEX, 0, 0);
ok(ret == -1, "Unexpected anchor index %d.\n", ret);
ret = SendMessageA(list, LB_GETCARETINDEX, 0, 0);
ok(ret == 0, "Unexpected caret index %d.\n", ret);
ret = SendMessageA(list, LB_SETSEL, TRUE, 0);
ok(ret == 0, "Unexpected return value %d.\n", ret);
ret = SendMessageA(list, LB_GETANCHORINDEX, 0, 0);
ok(ret == 0, "Unexpected anchor index %d.\n", ret);
ret = SendMessageA(list, LB_GETCARETINDEX, 0, 0);
ok(ret == 0, "Unexpected caret index %d.\n", ret);
ret = SendMessageA(list, LB_SETSEL, TRUE, 1);
ok(ret == 0, "Unexpected return value %d.\n", ret);
ret = SendMessageA(list, LB_GETANCHORINDEX, 0, 0);
ok(ret == 1, "Unexpected anchor index %d.\n", ret);
ret = SendMessageA(list, LB_GETCARETINDEX, 0, 0);
ok(ret == 1, "Unexpected caret index %d.\n", ret);
ret = SendMessageA(list, LB_SETSEL, FALSE, 1);
ok(ret == 0, "Unexpected return value %d.\n", ret);
ret = SendMessageA(list, LB_GETANCHORINDEX, 0, 0);
ok(ret == 1, "Unexpected anchor index %d.\n", ret);
ret = SendMessageA(list, LB_GETCARETINDEX, 0, 0);
ok(ret == 1, "Unexpected caret index %d.\n", ret);
DestroyWindow(list);
......@@ -607,21 +615,29 @@ static void test_LB_SETSEL(void)
ret = SendMessageA(list, LB_GETANCHORINDEX, 0, 0);
ok(ret == -1, "Unexpected anchor index %d.\n", ret);
ret = SendMessageA(list, LB_GETCARETINDEX, 0, 0);
ok(ret == 0, "Unexpected caret index %d.\n", ret);
ret = SendMessageA(list, LB_SETSEL, TRUE, 0);
ok(ret == 0, "Unexpected return value %d.\n", ret);
ret = SendMessageA(list, LB_GETANCHORINDEX, 0, 0);
ok(ret == 0, "Unexpected anchor index %d.\n", ret);
ret = SendMessageA(list, LB_GETCARETINDEX, 0, 0);
ok(ret == 0, "Unexpected caret index %d.\n", ret);
ret = SendMessageA(list, LB_SETSEL, TRUE, 1);
ok(ret == 0, "Unexpected return value %d.\n", ret);
ret = SendMessageA(list, LB_GETANCHORINDEX, 0, 0);
ok(ret == 1, "Unexpected anchor index %d.\n", ret);
ret = SendMessageA(list, LB_GETCARETINDEX, 0, 0);
ok(ret == 1, "Unexpected caret index %d.\n", ret);
ret = SendMessageA(list, LB_SETSEL, FALSE, 1);
ok(ret == 0, "Unexpected return value %d.\n", ret);
ret = SendMessageA(list, LB_GETANCHORINDEX, 0, 0);
ok(ret == 1, "Unexpected anchor index %d.\n", ret);
ret = SendMessageA(list, LB_GETCARETINDEX, 0, 0);
ok(ret == 1, "Unexpected caret index %d.\n", ret);
DestroyWindow(list);
}
......
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