Take focus before setting the caret position and selections.
diff --git a/controls/listbox.c b/controls/listbox.c index 7749f7b..24f6ea8 100644 --- a/controls/listbox.c +++ b/controls/listbox.c
@@ -1837,6 +1837,14 @@ TRACE("[%04x]: lbuttondown %d,%d item %d\n", wnd->hwndSelf, x, y, index ); if (!descr->caret_on && (descr->in_focus)) return 0; + + if (!descr->in_focus) + { + if( !descr->lphc ) SetFocus( wnd->hwndSelf ); + else SetFocus( (descr->lphc->hWndEdit) ? descr->lphc->hWndEdit + : descr->lphc->self->hwndSelf ); + } + if (index != -1) { if (descr->style & LBS_EXTENDEDSEL) @@ -1861,13 +1869,6 @@ } } - if(!descr->in_focus) - { - if( !descr->lphc ) SetFocus( wnd->hwndSelf ); - else SetFocus( (descr->lphc->hWndEdit) ? descr->lphc->hWndEdit - : descr->lphc->self->hwndSelf ); - } - descr->captured = TRUE; SetCapture( wnd->hwndSelf ); if (index != -1 && !descr->lphc)