Commit 104e1cf6 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

user32: For LBS_OWNERDRAWVARIABLE listboxes return the fixed item height if the listbox is empty.

parent 0b652fe8
......@@ -1169,7 +1169,7 @@ static void LISTBOX_InvalidateItemRect( LB_DESCR *descr, INT index )
*/
static LRESULT LISTBOX_GetItemHeight( LB_DESCR *descr, INT index )
{
if (descr->style & LBS_OWNERDRAWVARIABLE)
if (descr->style & LBS_OWNERDRAWVARIABLE && descr->nb_items > 0)
{
if ((index < 0) || (index >= descr->nb_items))
{
......
......@@ -214,6 +214,16 @@ static void check_item_height(void)
ok (itemHeight == tm.tmHeight, "Item height wrong, got %d, expecting %d\n", itemHeight, tm.tmHeight);
DestroyWindow (hLB);
hLB = CreateWindow ("LISTBOX", "TestList", LBS_OWNERDRAWVARIABLE,
0, 0, 100, 100, NULL, NULL, NULL, 0);
itemHeight = SendMessage(hLB, LB_GETITEMHEIGHT, 0, 0);
ok(itemHeight == tm.tmHeight, "itemHeight %d\n", itemHeight);
itemHeight = SendMessage(hLB, LB_GETITEMHEIGHT, 5, 0);
ok(itemHeight == tm.tmHeight, "itemHeight %d\n", itemHeight);
itemHeight = SendMessage(hLB, LB_GETITEMHEIGHT, -5, 0);
ok(itemHeight == tm.tmHeight, "itemHeight %d\n", itemHeight);
DestroyWindow (hLB);
}
static LRESULT WINAPI main_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
......
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