المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : how to EXPAND or COLLAPSE a CTreeCtrl item?(TVS_SINGLEEXPAND cannot)



C++ Programming
04-01-2009, 11:11 AM
hi,
i want to EXPAND/COLLAPSE an COLLAPSE/EXPAND item when i single-click an item?
and the TVS_SINGLEEXPAND style causes the item being selected to expand and the item being unselected to collapse,but i still want the unselected to keep the old state.

now, i map the NM_CLICK:

void CTreeControlDlg::OnClickTree1(NMHDR* pNMHDR, LRESULT* pResult)
{
TRACE("OnClickTree1!\n");

HTREEITEM hItem = m_treeCtrl.GetSelectedItem();
if ( (hItem != NULL) && m_treeCtrl.ItemHasChildren(hItem))
{
... // but i donot how to do now...
}
*pResult = 0;
}


thank u very much!!!