hi,
My project is built on windows mobile 5.0 pocket pc,vs2005.I use the following code insert a tree node:
TVINSERTSTRUCT InsertStruct;
InsertStruct.hParent = hParent;
InsertStruct.hInsertAfter = TVI_LAST;
InsertStruct.item.mask = TVIF_TEXT |TVIF_IMAGE |TVIF_CHILDREN;
InsertStruct.item.pszText = FileData.cFileName;
InsertStruct.item.iImage = 0;
InsertStruct.item.cChildren = 1;
InsertItem(&InsertStruct);
That's to say, all the insert nodes have children and so have "+" before them.
But now I need to remove "+" before them ,and I used SetItem function to remove it but the function just delete its children.
Any suggestion on how to remove "+" is appreciated.
Para

how to remove "+" before a tree node
Amanda Song
Hmmm...
I'm sure your control has the TVS_HASBUTTONS style set Have you tried to use a parent callback instead of setting zero or one in the cChildren member
I assume you are using cChildren = 0 when using SetItem, aren't you
Winterset
Yes, you're right,the tree has TVS_HASBUTTONS style and I use the following code to remove "+":
TVITEM item = { 0 };
item.mask = TVIF_HANDLE | TVIF_CHILDREN;
item.hItem = hRoot ;
item.cChildren = 0;
SetItem( &item );
But I can't understand what you say,how to use a parent callback
Morias
TV_DISPINFO tvdi;
tvdi.item.mask = TVIF_CHILDREN ;
tvdi.item.hItem = hCurrent;
GetItem(&tvdi.item);
tvdi.item.cChildren = 0;
SetItem(&tvdi.item);
HWND hWndParent;
hWndParent = ::GetParent(m_hWnd);
if(hWndParent)
{
tvdi.hdr.hwndFrom = m_hWnd;
tvdi.hdr.idFrom = GetDlgCtrlID(m_hWnd);
tvdi.hdr.code = TVN_GETDISPINFO;
SendMessage(hWndParent, WM_NOTIFY, tvdi.hdr.idFrom,
(LPARAM)&tvdi);
}
that's to say ,first set the item's cChildren equal 0,and then send message to its parent to remove "+" .
RonaldS
Tim Heckel
Sondre - MSFT Regional Director
Or is this not supported on CE
LCoder
Thank U very much.
I have tried I_CHILDRENCALLBACK in my project and it doesn't work too,but I find some valuable infomation in the internet with the keyword "I_CHILDRENCALLBACK" ,and now the problem is not a problem.
Para