Treeview control sends incorrect messages when expanding

Adam Gundy arg at
Tue Oct 14 10:44:37 CDT 2003

Martin Fuchs' patch of July 21st broke the treeview control - he changed it
so that TVN_ITEMEXPANDING messages are sent when expanding any item which has
not already been expanded.

This is not the way Windows behaves - it only sends these messages for items
which have been marked as having children (via the TVIF_CHILDREN/cChildren
flags) - note that marking in this way doesn't mean that the children yet exist;
hence the TVN_ITEMEXPANDING etc messages which Martin wanted.

the attached patch fixes the problem.

Real Programmers don't comment their code. If it was hard to write,
it should be hard to read, and even harder to modify.
These are all my own opinions.
-------------- next part --------------
Index: dlls/comctl32/treeview.c
RCS file: /home/wine/wine/dlls/comctl32/treeview.c,v
retrieving revision 1.129
diff -u -r1.129 treeview.c
--- dlls/comctl32/treeview.c	22 Sep 2003 21:32:33 -0000	1.129
+++ dlls/comctl32/treeview.c	14 Oct 2003 15:22:25 -0000
@@ -3203,7 +3203,8 @@
     TRACE("TVE_EXPAND %p %s\n", wineItem, TREEVIEW_ItemName(wineItem));
-    if (bUser || !(wineItem->state & TVIS_EXPANDEDONCE))
+    if (bUser || ((wineItem->cChildren != 0) &&
+                  !(wineItem->state & TVIS_EXPANDEDONCE)))
 	if (!TREEVIEW_SendExpanding(infoPtr, wineItem, TVE_EXPAND))

More information about the wine-patches mailing list