Felix Nawothnig : treeview: Initialize iImage and iSelectedImage with zero.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Jan 9 06:10:41 CST 2007


Module: wine
Branch: master
Commit: 2eb171c1f559fcc79068e3e61789469a0281a74e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=2eb171c1f559fcc79068e3e61789469a0281a74e

Author: Felix Nawothnig <flexo at holycrap.org>
Date:   Tue Jan  9 08:03:39 2007 +0100

treeview: Initialize iImage and iSelectedImage with zero.

---

 dlls/comctl32/tests/treeview.c |    8 ++++++++
 dlls/comctl32/treeview.c       |    8 ++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/dlls/comctl32/tests/treeview.c b/dlls/comctl32/tests/treeview.c
index adf0ea4..ba14dd6 100644
--- a/dlls/comctl32/tests/treeview.c
+++ b/dlls/comctl32/tests/treeview.c
@@ -70,6 +70,7 @@ static void IdentifyItem(HTREEITEM hItem
 static void FillRoot(void)
 {
     TVINSERTSTRUCTA ins;
+    TVITEM tvi;
     static CHAR root[]  = "Root",
                 child[] = "Child";
 
@@ -82,6 +83,13 @@ static void FillRoot(void)
     hRoot = TreeView_InsertItem(hTree, &ins);
     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');
     ins.hParent = hRoot;
     ins.hInsertAfter = TVI_FIRST;
diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c
index aefce78..4fb2a32 100644
--- a/dlls/comctl32/treeview.c
+++ b/dlls/comctl32/treeview.c
@@ -1010,8 +1010,12 @@ TREEVIEW_AllocateItem(TREEVIEW_INFO *inf
     if (!newItem)
 	return NULL;
 
-    newItem->iImage = -1;
-    newItem->iSelectedImage = -1;
+    /* I_IMAGENONE would make more sense but this is neither what is
+     * 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)
     {




More information about the wine-cvs mailing list