I've created a treeview control within my windows application using the basic Win32 API. I'm attempting to add an item to the tree that functions as a group folder.
The image list for the treeview contains 3 images: closed folder, open folder, item image.
The basic items within the treeview use the 3rd image.
The group treeview items are supposed to use the first two images. I want them to display the first image when not expanded, and I want them to display the second image when they are expanded.
Here is the code I use to add the group items to the treeview:
TVINSERTSTRUCT insertStruct;
insertStruct.hParent=Parent;
insertStruct.hInsertAfter=insertAfter;
insertStruct.itemex.mask=TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_EXPANDEDIMAGE;
insertStruct.itemex.pszText=(LPWSTR)wname.c_str();
insertStruct.itemex.cchTextMax=wname.size();
insertStruct.itemex.iImage=0;
insertStruct.itemex.iSelectedImage=1;
insertStruct.itemex.iExpandedImage=1;
HTREEITEM newItem=(HTREEITEM)SendMessage(hTree,TVM_INSERTITEM,0,(LPARAM)&insertStruct);
I'm pretty sure that this is right. In the application, the group treeview item will display the closed folder image when it is not selected, and it will show the open folder image when it is selected, but it doesn't show the open folder image when it is expanded and not selected. It should display the open folder image when it is expanded, but is doesn't. Does anyone know why this is?
Thanks,
Coolgames