Huw Davies <huw@xxxxxxxxxxxxxxx> We need to send TVN_EXPAND* on collapsing either when the user has initiated it with the mouse/keybaord or in response to a TVM_EXPAND when the state is not TVIS_EXPANDEDONCE. This brings the logic into line with TREEVIEW_Expand. Save the item's cChildren member when deleting children in response to TVE_COLLAPSERESET Index: dlls/comctl32/treeview.c =================================================================== RCS file: /home/wine/wine/dlls/comctl32/treeview.c,v retrieving revision 1.132 diff -u -r1.132 treeview.c --- dlls/comctl32/treeview.c 20 Nov 2003 04:19:59 -0000 1.132 +++ dlls/comctl32/treeview.c 20 Nov 2003 23:24:54 -0000 @@ -3134,7 +3134,7 @@ if (!(wineItem->state & TVIS_EXPANDED)) return FALSE; - if (bUser) + if (bUser || !(wineItem->state & TVIS_EXPANDEDONCE)) TREEVIEW_SendExpanding(infoPtr, wineItem, action); if (wineItem->firstChild == NULL) @@ -3142,7 +3142,7 @@ wineItem->state &= ~TVIS_EXPANDED; - if (bUser) + if (bUser || !(wineItem->state & TVIS_EXPANDEDONCE)) TREEVIEW_SendExpanded(infoPtr, wineItem, action); bSetSelection = (infoPtr->selectedItem != NULL @@ -3153,9 +3153,11 @@ if (bRemoveChildren) { + INT old_cChildren = wineItem->cChildren; TRACE("TVE_COLLAPSERESET\n"); wineItem->state &= ~TVIS_EXPANDEDONCE; TREEVIEW_RemoveAllChildren(infoPtr, wineItem); + wineItem->cChildren = old_cChildren; } if (wineItem->firstChild)