Author: jimtabor Date: Tue Oct 20 01:54:18 2015 New Revision: 69625
URL: http://svn.reactos.org/svn/reactos?rev=69625&view=rev Log: [User32] - Patch by Joachim Priesner : Hide horizontal Listbox scroll bar if no horizontal extent is set. See CORE-1101. - Patch by Alex Henrie : Simplify if-else statement. Scroll listbox item completely into view on LB_SETCURSEL.
Modified: trunk/reactos/win32ss/user/user32/controls/listbox.c
Modified: trunk/reactos/win32ss/user/user32/controls/listbox.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/control... ============================================================================== --- trunk/reactos/win32ss/user/user32/controls/listbox.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/user32/controls/listbox.c [iso-8859-1] Tue Oct 20 01:54:18 2015 @@ -259,7 +259,7 @@ if (descr->style & WS_VSCROLL) SetScrollInfo( descr->self, SB_VERT, &info, TRUE );
- if (descr->style & WS_HSCROLL) + if (descr->style & WS_HSCROLL && descr->horz_extent) { info.nPos = descr->horz_pos; info.nPage = descr->width; @@ -267,6 +267,20 @@ if (descr->style & LBS_DISABLENOSCROLL) info.fMask |= SIF_DISABLENOSCROLL; SetScrollInfo( descr->self, SB_HORZ, &info, TRUE ); + } + else + { + if (descr->style & LBS_DISABLENOSCROLL) + { + info.nMin = 0; + info.nMax = 0; + info.fMask = SIF_RANGE | SIF_DISABLENOSCROLL; + SetScrollInfo( descr->self, SB_HORZ, &info, TRUE ); + } + else + { + ShowScrollBar( descr->self, SB_HORZ, FALSE ); + } } } } @@ -313,7 +327,8 @@ ScrollWindowEx( descr->self, 0, diff, NULL, NULL, 0, NULL, SW_INVALIDATE | SW_ERASE | SW_SCROLLCHILDREN ); } - if (!scroll) InvalidateRect( descr->self, NULL, TRUE ); + else + InvalidateRect( descr->self, NULL, TRUE ); descr->top_item = index; LISTBOX_UpdateScroll( descr ); return LB_OKAY; @@ -1244,6 +1259,8 @@ info.nMin = 0; info.nMax = descr->horz_extent ? descr->horz_extent - 1 : 0; info.fMask = SIF_RANGE; + if (descr->style & LBS_DISABLENOSCROLL) + info.fMask |= SIF_DISABLENOSCROLL; SetScrollInfo( descr->self, SB_HORZ, &info, TRUE ); } if (descr->horz_pos > extent - descr->width) @@ -2908,7 +2925,7 @@
case LB_SETCURSEL: if (IS_MULTISELECT(descr)) return LB_ERR; - LISTBOX_SetCaretIndex( descr, wParam, FALSE ); + LISTBOX_SetCaretIndex( descr, wParam, TRUE ); ret = LISTBOX_SetSelection( descr, wParam, TRUE, FALSE ); if (ret != LB_ERR) ret = descr->selected_item; return ret;