treeview: Initialize iImage and iSelectedImage with zero.

This commit is contained in:
Felix Nawothnig 2007-01-09 08:03:39 +01:00 committed by Alexandre Julliard
parent 5a220321df
commit 2eb171c1f5
2 changed files with 14 additions and 2 deletions

View File

@ -70,6 +70,7 @@ static void IdentifyItem(HTREEITEM hItem)
static void FillRoot(void) static void FillRoot(void)
{ {
TVINSERTSTRUCTA ins; TVINSERTSTRUCTA ins;
TVITEM tvi;
static CHAR root[] = "Root", static CHAR root[] = "Root",
child[] = "Child"; child[] = "Child";
@ -82,6 +83,13 @@ static void FillRoot(void)
hRoot = TreeView_InsertItem(hTree, &ins); hRoot = TreeView_InsertItem(hTree, &ins);
assert(hRoot); assert(hRoot);
/* UMLPad 1.15 depends on this being not -1 (I_IMAGECALLBACK) */
tvi.hItem = hRoot;
tvi.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE;
SendMessage( hTree, TVM_GETITEM, 0, (LPARAM)&tvi );
ok(tvi.iImage == 0, "tvi.iImage=%d\n", tvi.iImage);
ok(tvi.iSelectedImage == 0, "tvi.iSelectedImage=%d\n", tvi.iSelectedImage);
AddItem('B'); AddItem('B');
ins.hParent = hRoot; ins.hParent = hRoot;
ins.hInsertAfter = TVI_FIRST; ins.hInsertAfter = TVI_FIRST;

View File

@ -1010,8 +1010,12 @@ TREEVIEW_AllocateItem(TREEVIEW_INFO *infoPtr)
if (!newItem) if (!newItem)
return NULL; return NULL;
newItem->iImage = -1; /* I_IMAGENONE would make more sense but this is neither what is
newItem->iSelectedImage = -1; * documented (MSDN doesn't specify) nor what Windows actually does
* (it sets it to zero)... and I can so imagine an application using
* inc/dec to toggle the images. */
newItem->iImage = 0;
newItem->iSelectedImage = 0;
if (DPA_InsertPtr(infoPtr->items, INT_MAX, newItem) == -1) if (DPA_InsertPtr(infoPtr->items, INT_MAX, newItem) == -1)
{ {