user32: Allow setting horizontal extent even without WS_HSCROLL.

oldstable
Andrew Eikum 2014-04-23 14:58:29 -05:00 committed by Alexandre Julliard
parent 5d31c1e824
commit c4a28490f3
2 changed files with 39 additions and 3 deletions

View File

@ -83,7 +83,7 @@ typedef struct
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 */
@ -1239,7 +1239,7 @@ static void LISTBOX_SetHorizontalPos( LB_DESCR *descr, INT pos )
*/
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;
@ -2485,7 +2485,7 @@ static BOOL LISTBOX_Create( HWND hwnd, LPHEADCOMBO lphc )
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;

View File

@ -1617,6 +1617,41 @@ static void test_missing_lbuttonup( void )
DestroyWindow(parent);
}
static void test_extents(void)
{
HWND listbox, parent;
DWORD res;
parent = create_parent();
listbox = create_listbox(WS_CHILD | WS_VISIBLE, parent);
res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
ok(res == 0, "Got wrong initial horizontal extent: %u\n", res);
SendMessageA(listbox, LB_SETHORIZONTALEXTENT, 64, 0);
res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
ok(res == 64, "Got wrong horizontal extent: %u\n", res);
DestroyWindow(listbox);
listbox = create_listbox(WS_CHILD | WS_VISIBLE | WS_HSCROLL, parent);
res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
ok(res == 0, "Got wrong initial horizontal extent: %u\n", res);
SendMessageA(listbox, LB_SETHORIZONTALEXTENT, 64, 0);
res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
ok(res == 64, "Got wrong horizontal extent: %u\n", res);
DestroyWindow(listbox);
DestroyWindow(parent);
}
START_TEST(listbox)
{
const struct listbox_test SS =
@ -1698,4 +1733,5 @@ START_TEST(listbox)
test_set_count();
test_GetListBoxInfo();
test_missing_lbuttonup();
test_extents();
}