Validate Tree View Label Edit?
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?
LPNMTVDISPINFO lpTvdi = (LPNMTVDISPINFO)lParam;
// 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);
// Canceled; Set to a safe name if necessary