Problem in TreeControl
-
HI, Iam Doing An application Using Tree Control. My problem is If I double Click on Any Root Item on the Tree That Should be display in one Edit Box. But Iam not Getting . plz check this code void CTreeItem::OnDblclkTree1(NMHDR* pNMHDR, LRESULT* pResult) { // m_Tree is Tree Control Variable HTREEITEM hItem = m_Tree.GetRootItem(); if ((hItem != NULL) && m_Tree.ItemHasChildren(hItem)) { m_Tree.Expand(hItem, TVE_EXPAND); m_Tree.EnsureVisible(hItem); } CString str=m_Tree.GetItemText( hItem ); UpdateData(FALSE); CDUXmlRuleDlgDlg duxml; // m_strNodeName is My Edit Box Control Variable. duxml.m_strNodeName = str; UpdateData(FALSE); *pResult = 0; } plz check this
-
HI, Iam Doing An application Using Tree Control. My problem is If I double Click on Any Root Item on the Tree That Should be display in one Edit Box. But Iam not Getting . plz check this code void CTreeItem::OnDblclkTree1(NMHDR* pNMHDR, LRESULT* pResult) { // m_Tree is Tree Control Variable HTREEITEM hItem = m_Tree.GetRootItem(); if ((hItem != NULL) && m_Tree.ItemHasChildren(hItem)) { m_Tree.Expand(hItem, TVE_EXPAND); m_Tree.EnsureVisible(hItem); } CString str=m_Tree.GetItemText( hItem ); UpdateData(FALSE); CDUXmlRuleDlgDlg duxml; // m_strNodeName is My Edit Box Control Variable. duxml.m_strNodeName = str; UpdateData(FALSE); *pResult = 0; } plz check this
If I've understood your intent, I think you want to have the edit box filled with the item text from the node you double clicked. The HTREEITEM returned by GetRootItem is instead going to point to the root of the entire tree control. Try using GetSelectedItem.
-
HI, Iam Doing An application Using Tree Control. My problem is If I double Click on Any Root Item on the Tree That Should be display in one Edit Box. But Iam not Getting . plz check this code void CTreeItem::OnDblclkTree1(NMHDR* pNMHDR, LRESULT* pResult) { // m_Tree is Tree Control Variable HTREEITEM hItem = m_Tree.GetRootItem(); if ((hItem != NULL) && m_Tree.ItemHasChildren(hItem)) { m_Tree.Expand(hItem, TVE_EXPAND); m_Tree.EnsureVisible(hItem); } CString str=m_Tree.GetItemText( hItem ); UpdateData(FALSE); CDUXmlRuleDlgDlg duxml; // m_strNodeName is My Edit Box Control Variable. duxml.m_strNodeName = str; UpdateData(FALSE); *pResult = 0; } plz check this
Krishnatv wrote:
My problem is If I double Click on Any Root Item on the Tree That Should be display in one Edit Box.
That edit box is on
CDUXmlRuleDlgDlg
, but in your code, I cant see , you have invoked it.Krishnatv wrote:
CDUXmlRuleDlgDlg duxml; // m_strNodeName is My Edit Box Control Variable. duxml.m_strNodeName = str; UpdateData(FALSE);
UpdateData
should be called here on you dialog object, after displaying it.Prasad Notifier using ATL | Operator new[],delete[][^]