我在 tree control 控件上面显示了一些目录,我现在想在运行的时候动态编辑它的节点,也就是可以改变名字:
但是我在运行的时候没有反映,不知道是哪边错了代码如下请大家指点:
void CTreeDlg::OnSelchangedTree1(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
// TODO: Add your control notification handler code here
h=m_tree.GetSelectedItem();
CString text;
text=m_tree.GetItemText(h);
*pResult = 0;
}void CTreeDlg::OnEndlabeleditTree1(NMHDR* pNMHDR, LRESULT* pResult)
{
TV_DISPINFO* pTVDispInfo = (TV_DISPINFO*)pNMHDR;
// TODO: Add your control notification handler code here
m_tree.SetItemText(pTVDispInfo->item.hItem,pTVDispInfo->item.pszText);
*pResult = 0;
}
但是我在运行的时候没有反映,不知道是哪边错了代码如下请大家指点:
void CTreeDlg::OnSelchangedTree1(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
// TODO: Add your control notification handler code here
h=m_tree.GetSelectedItem();
CString text;
text=m_tree.GetItemText(h);
*pResult = 0;
}void CTreeDlg::OnEndlabeleditTree1(NMHDR* pNMHDR, LRESULT* pResult)
{
TV_DISPINFO* pTVDispInfo = (TV_DISPINFO*)pNMHDR;
// TODO: Add your control notification handler code here
m_tree.SetItemText(pTVDispInfo->item.hItem,pTVDispInfo->item.pszText);
*pResult = 0;
}
{
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
// TODO: Add your control notification handler code here
h=m_tree.GetSelectedItem(); text=m_tree.GetItemText(h);
m_tree.EditLabel(h);