Commit 1a25f47d authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comctl32/listbox: Scroll to specified caret index.

parent 832b748b
...@@ -1462,19 +1462,23 @@ static void LISTBOX_MakeItemVisible( LB_DESCR *descr, INT index, BOOL fully ) ...@@ -1462,19 +1462,23 @@ static void LISTBOX_MakeItemVisible( LB_DESCR *descr, INT index, BOOL fully )
*/ */
static LRESULT LISTBOX_SetCaretIndex( LB_DESCR *descr, INT index, BOOL fully_visible ) static LRESULT LISTBOX_SetCaretIndex( LB_DESCR *descr, INT index, BOOL fully_visible )
{ {
INT oldfocus = descr->focus_item; BOOL focus_changed = descr->focus_item != index;
TRACE("old focus %d, index %d\n", oldfocus, index); TRACE("old focus %d, index %d\n", descr->focus_item, index);
if (descr->style & LBS_NOSEL) return LB_ERR; if (descr->style & LBS_NOSEL) return LB_ERR;
if ((index < 0) || (index >= descr->nb_items)) return LB_ERR; if ((index < 0) || (index >= descr->nb_items)) return LB_ERR;
if (index == oldfocus) return LB_OKAY;
LISTBOX_DrawFocusRect( descr, FALSE ); if (focus_changed)
descr->focus_item = index; {
LISTBOX_DrawFocusRect( descr, FALSE );
descr->focus_item = index;
}
LISTBOX_MakeItemVisible( descr, index, fully_visible ); LISTBOX_MakeItemVisible( descr, index, fully_visible );
LISTBOX_DrawFocusRect( descr, TRUE );
if (focus_changed)
LISTBOX_DrawFocusRect( descr, TRUE );
return LB_OKAY; return LB_OKAY;
} }
......
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