Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/comctl32/listbox.c | 5 ++++- dlls/comctl32/tests/listbox.c | 6 ------ 2 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/dlls/comctl32/listbox.c b/dlls/comctl32/listbox.c index e033975f41..b3491bbacf 100644 --- a/dlls/comctl32/listbox.c +++ b/dlls/comctl32/listbox.c @@ -2758,7 +2758,10 @@ static LRESULT CALLBACK LISTBOX_WindowProc( HWND hwnd, UINT msg, WPARAM wParam, 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; diff --git a/dlls/comctl32/tests/listbox.c b/dlls/comctl32/tests/listbox.c index 07aa5c6f49..c9d13a8d67 100644 --- a/dlls/comctl32/tests/listbox.c +++ b/dlls/comctl32/tests/listbox.c @@ -611,19 +611,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); @@ -638,19 +635,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);