OnEndlabeleditTree ()
-
Hi, I have enabled editing of the labels on the tree control and I want to see what user has edited in the label in the OnEndlabeleditTree () function, so that I can either commit the change or, reject the change. what should I use the check the user input in the label? code: void CGeneratorView::OnEndlabeleditTree(NMHDR* pNMHDR, LRESULT* pResult) { TV_DISPINFO* pTVDispInfo = (TV_DISPINFO*)pNMHDR; HTREEITEM hItem = pTVDispInfo->item.hItem; if () //check edited text ????????????????????????????? { *pResult = TRUE; } else { *pResult = FALSE; } }
-
Hi, I have enabled editing of the labels on the tree control and I want to see what user has edited in the label in the OnEndlabeleditTree () function, so that I can either commit the change or, reject the change. what should I use the check the user input in the label? code: void CGeneratorView::OnEndlabeleditTree(NMHDR* pNMHDR, LRESULT* pResult) { TV_DISPINFO* pTVDispInfo = (TV_DISPINFO*)pNMHDR; HTREEITEM hItem = pTVDispInfo->item.hItem; if () //check edited text ????????????????????????????? { *pResult = TRUE; } else { *pResult = FALSE; } }
pTVDispInfo->item.pszText has the text, but if the user canceled the editing then it will be NULL. So you might do something like:
LPCTSTR lpszText = pTVDispInfo->item.pszText; if (lpszText != NULL && IsValidText(lpszText)) { *pResult = TRUE; } else { *pResult = FALSE; }
where IsValidText is some function you write to check the edited text.