Tree View Right Click Problem.
Having problems about right clicking on an item in a tree control. The item
that is clicked on is not the right one.
If I have three items in a tree.
Here is my problem. I click on the first item with normal click. I click on
the third item with the right click mouse. In this event I had a messagebox
telling me which item is selected, and this one comes out with the first
item no mather what. I also tried to get into the OnSelchangedItemfieldtree
function - but with no luck.
How can I right click on the third one and get its name out of it? Does
anyone know?
Re: Tree View Right Click Problem.
hmm... are you using GetSelectedItem()?
Re: Tree View Right Click Problem.
Re: Tree View Right Click Problem.
Take a look at this thread :thumb:
Re: Tree View Right Click Problem.
Hello all,
Thanks a lot.I solved by using following code.
BOOL CAddASDU::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
// TODO: Add your specialized code here and/or call the base class
if(wParam == IDC_POINTS)
{
NMTREEVIEW* pNMTV = (NMTREEVIEW *) lParam;
if(pNMTV->hdr.code == NM_RCLICK)
{
HTREEITEM hItem = m_PointsTree.GetDropHilightItem();
if(hItem) m_PointsTree.SelectItem(hItem);
}
}
return CDialog::OnNotify(wParam, lParam, pResult);
}
Re: Tree View Right Click Problem.
Just use CTreeCtrl::GetSelectedItem when handling the NM_RCLICK
Re: Tree View Right Click Problem.
Ya jayender thats required but it isnt alone solve the problem.we need to override the onnotify function as said above.