A question about TreeCtrl
-
I have a question about TreeCtrl. When I use mouse right click one item in the TreeCtrl, this item is highlight when the right mouse key is down. But when the right mouse key is up, this item loses highlight, the previous highlight item is highlight again. How can I keep the item that I right click highlight? Thanks in advance.
-
I have a question about TreeCtrl. When I use mouse right click one item in the TreeCtrl, this item is highlight when the right mouse key is down. But when the right mouse key is up, this item loses highlight, the previous highlight item is highlight again. How can I keep the item that I right click highlight? Thanks in advance.
void CFileViewTab::OnRclickTreeWorkspace(NMHDR* pNMHDR, LRESULT* pResult) { // TODO: Add your control notification handler code here LRESULT lReturn = 0; CPoint point(GetMessagePos()); ScreenToClient(&point); CTreeCtrl *pTree = (CTreeCtrl *)GetDlgItem(IDC_TREE_WORKSPACE); UINT flag; HTREEITEM hItem; if ((hItem = pTree->HitTest(point, &flag)) != NULL) { if (flag & TVHT_ONITEM) { pTree->SelectItem(hItem); ...... .....