[Closed] treeview: post process LabelEdit
What I want to do is that after I got input from LabelEdit I want to remove all you-should-not-use-character.
I have a dotnet regex wrapper maxscript function to replace those character to “”.
I found this thread.
http://forums.cgsociety.org/showthread.php?f=98&t=1072018
I guess this is what I need. The problem is that ois it well beyond my dotnet capability.
WM_GETTEXT will be used to set any text to control before it will be show, and before it will be returned to treeview node. for second case we will use WM_KILLFOCUS message, but we have to know how the focus was lost. for this we will use WM_KEYUP to check that focus was not changed because of ESC pressed. because it’s only one case when we don’t have to change the text.
I think that all code will be about 40 lines of code, and will not need any overrides for TreeView.
Or… If I I can simply rebuild treeview after LabelEdit, that’s OK, too.
I store all my data as XML and have function to build treeview nodes from this.
Or… this was also mentioned.
class AClass
{
…
const int WM_SETTEXT = 0xC;
const int TV_FIRST = 0x1100;
const int TVM_GETEDITCONTROL = (TV_FIRST + 15);[DllImport(“user32”, CharSet=CharSet.Auto)] static extern int SendMessage(HWND hwnd, int wMsg, int wParam, IntPtr lParam);
…
// the tree must be in edit mode
void SetTreeViewEditText(TreeView tree, string myText)
{IntPtr editHandle = (IntPtr) SendMessage(tree.Handle, TVM_GETEDITCONTROL, 0, IntPtr.Zero);
SendMessage(editHandle, WM_SETTEXT, 0, Marshal.StringToHGlobalAuto( myText ) );}
…
}
Please, help me…
THANKS!