user32/listbox: Update anchor index on LB_SETSEL.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2018-08-15 11:22:56 +03:00 committed by Alexandre Julliard
parent b3e005483c
commit 201dc289d0
2 changed files with 4 additions and 7 deletions

View File

@ -2853,7 +2853,10 @@ LRESULT ListBoxWndProc_common( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
return descr->items[wParam].selected;
case LB_SETSEL:
return LISTBOX_SetSelection( descr, lParam, wParam, FALSE );
ret = LISTBOX_SetSelection( descr, lParam, wParam, FALSE );
if (ret != LB_ERR && wParam)
descr->anchor_item = lParam;
return ret;
case LB_SETCURSEL:
if (IS_MULTISELECT(descr)) return LB_ERR;

View File

@ -553,19 +553,16 @@ static void test_LB_SETSEL(void)
ret = SendMessageA(list, LB_SETSEL, TRUE, 0);
ok(ret == 0, "Unexpected return value %d.\n", ret);
ret = SendMessageA(list, LB_GETANCHORINDEX, 0, 0);
todo_wine
ok(ret == 0, "Unexpected anchor 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);
todo_wine
ok(ret == 1, "Unexpected anchor 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);
todo_wine
ok(ret == 1, "Unexpected anchor index %d.\n", ret);
DestroyWindow(list);
@ -580,19 +577,16 @@ todo_wine
ret = SendMessageA(list, LB_SETSEL, TRUE, 0);
ok(ret == 0, "Unexpected return value %d.\n", ret);
ret = SendMessageA(list, LB_GETANCHORINDEX, 0, 0);
todo_wine
ok(ret == 0, "Unexpected anchor 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);
todo_wine
ok(ret == 1, "Unexpected anchor 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);
todo_wine
ok(ret == 1, "Unexpected anchor index %d.\n", ret);
DestroyWindow(list);