User renaming treeview node
BlitzMax Forums/MaxGUI Module/User renaming treeview node
| ||
Is the manual renaming of a tree node with keyboard input something that Windows actually supports? It would be very useful to allow users to rename nodes without using a popup box or something. |
| ||
yes, its possible. You have to hack a bit in the win32maxguiex and the users.bmx but its easy to achive. First add this to the pub.win32.user32.bmx : Function GetWindowTextA( hwnd) Function GetWindowTextW( hwnd) Then modifiy the win32maxguiex.bmx: Search the TWindowsTreeView Type and add the following field: Field _edithwnd:Int then edit the create function and change the wstyle variable to this: wstyle=WS_CHILD|TVS_HASLINES|TVS_HASBUTTONS|TVS_LINESATROOT|TVS_SHOWSELALWAYS|TVS_NOTOOLTIPS|WS_CLIPSIBLINGS|TVS_EDITLABELS last change : search the OnNotify Method of TWindowsTreeView and add the following in the Select block: Case TVN_BEGINLABELEDITW _edithwnd = SendMessageW(_hwnd,TVM_GETEDITCONTROL,0,0) Case TVN_ENDLABELEDITW Local buffer:Short[260] GetWindowTextW(_edithwnd , buffer , 256) _selected.setText(String.FromShorts(buffer,256)) Rebuild the pub.win32 and maxgui.win32maxguiex modules. Just start the treeview exsample and select a node. After a second click you're now able to edit the node. I hope this helps you:) |
| ||
That seems like a big part of it, but the application still needs to be able to turn label editing on: http://msdn.microsoft.com/en-us/library/bb760017%28VS.85%29.aspx#tv_label_editing |
| ||
In your sample application, if you rename the tree node with the "left-click twice" method, a crash ensues: |
| ||
hmm, it works without crahes here, maybe you can try to avoid crashes by changing this line_selected.setText(String.FromShorts(buffer,256)) to if _selected then _selected.setText(String.FromShorts(buffer,256)) |