Author: jimtabor
Date: Tue May 6 15:41:01 2014
New Revision: 63172
URL:
http://svn.reactos.org/svn/reactos?rev=63172&view=rev
Log:
[User32]
- Patch by Andrew Eikum : Allow setting horizontal extent even without WS_HSCROLL. Only
update listbox horizontal scroll info if WS_HSCROLL is set.
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/contro…
==============================================================================
--- trunk/reactos/win32ss/user/user32/controls/listbox.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/user32/controls/listbox.c [iso-8859-1] Tue May 6 15:41:01
2014
@@ -74,7 +74,7 @@
INT item_height; /* Default item height */
INT page_size; /* Items per listbox page */
INT column_width; /* Column width for multi-column listboxes */
- INT horz_extent; /* Horizontal extent (0 if no hscroll) */
+ INT horz_extent; /* Horizontal extent */
INT horz_pos; /* Horizontal position */
INT nb_tabs; /* Number of tabs in array */
INT *tabs; /* Array of tabs */
@@ -259,17 +259,14 @@
if (descr->style & WS_VSCROLL)
SetScrollInfo( descr->self, SB_VERT, &info, TRUE );
- if (descr->horz_extent)
- {
- info.nMin = 0;
- info.nMax = descr->horz_extent - 1;
+ if (descr->style & WS_HSCROLL)
+ {
info.nPos = descr->horz_pos;
info.nPage = descr->width;
- info.fMask = SIF_RANGE | SIF_POS | SIF_PAGE;
+ info.fMask = SIF_POS | SIF_PAGE;
if (descr->style & LBS_DISABLENOSCROLL)
info.fMask |= SIF_DISABLENOSCROLL;
- if (descr->style & WS_HSCROLL)
- SetScrollInfo( descr->self, SB_HORZ, &info, TRUE );
+ SetScrollInfo( descr->self, SB_HORZ, &info, TRUE );
}
}
}
@@ -1236,16 +1233,21 @@
*/
static LRESULT LISTBOX_SetHorizontalExtent( LB_DESCR *descr, INT extent )
{
- if (!descr->horz_extent || (descr->style & LBS_MULTICOLUMN))
+ if (descr->style & LBS_MULTICOLUMN)
return LB_OKAY;
- if (extent <= 0) extent = 1;
if (extent == descr->horz_extent) return LB_OKAY;
TRACE("[%p]: new horz extent = %d\n", descr->self, extent );
descr->horz_extent = extent;
+ if (descr->style & WS_HSCROLL) {
+ SCROLLINFO info;
+ info.cbSize = sizeof(info);
+ info.nMin = 0;
+ info.nMax = descr->horz_extent ? descr->horz_extent - 1 : 0;
+ info.fMask = SIF_RANGE;
+ SetScrollInfo( descr->self, SB_HORZ, &info, TRUE );
+ }
if (descr->horz_pos > extent - descr->width)
LISTBOX_SetHorizontalPos( descr, extent - descr->width );
- else
- LISTBOX_UpdateScroll( descr );
return LB_OKAY;
}
@@ -2492,7 +2494,7 @@
descr->item_height = 1;
descr->page_size = 1;
descr->column_width = 150;
- descr->horz_extent = (descr->style & WS_HSCROLL) ? 1 : 0;
+ descr->horz_extent = 0;
descr->horz_pos = 0;
descr->nb_tabs = 0;
descr->tabs = NULL;