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

This commit is contained in:
Huw Davies 2006-12-05 14:32:02 +00:00 committed by Alexandre Julliard
parent 0b652fe8c6
commit 104e1cf6dd
2 changed files with 11 additions and 1 deletions

View File

@ -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))
{

View File

@ -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)