Hello,
I've written code that creates a new tree view item with a "default label" that I immediately expect the user to change (much like when creating a new folder in Explorer). The text they enter must conform to C naming conventions. But if the user cancels editing the default label I want to change it to something safe anyway.
My TVN_ENDLABELEDIT handler looks like thus:-
I've tried changing szText and sending TVM_SETITEM to the tree view control, but it doesn't seem to work. Any ideas?Code:case TVN_ENDLABELEDIT: { LPNMTVDISPINFO lpTvdi = (LPNMTVDISPINFO)lParam; if (lpTvdi->item.pszText) { if (!lstrlen(lpTvdi->item.pszText)) { // Nothing entered; Set to a safe name lpTvdi->item.pszText = "t_struct1"; // This is how dialogs set the return value, in case you didn't know SetWindowLong(hDlg, DWL_MSGRESULT, TRUE); } else { // Validate } } else { // Canceled; Set to a safe name if necessary // HOW?!? } break; }



LinkBack URL
About LinkBacks



) and another function that traverses through my structure list and tries to match a given string with a name (if it does then I change the string and search again).