TVX is extension for TreeView control to support moving, inserting and deleting. Once you call TVX function your tree view will become extended. Key Bindings :
Code:
INSERT - add new item SHIFT INSERT - add new group DELETE - delete item or group SHIFT UP - move item up SHIFT DOWN - move item down
Current API is as follows (documentation currently in the source):
Code:
TVX - Initialisation function. Mandatory to call before you show the TreeView. Walk - Walk the menu and rise events. Check out Save button in Example Move - Moves tree view item up or down Copy - Copies menu item or group to another location. Exists in the code as TVX_CopyItem, but still not documented and properly interfaced.
Download (with example) Basic Example:
Code:
Gui, Add, TreeView, h400 w300 vMyTree root := TV_Add("Root", "" , "Expand") loop, 10 P := TV_Add(A_Index, root) TVX("MyTree", "Handler", "HasRoot CollapseOnMove ") Gui, Show, autosize return Handler: return #include TVX.ahk
Check out Walk example here Documentation
Code (Expand):
;---------------------------------------------------------------------------------------- ; Function: TVX ; Initialisation function. Mandatory to call before you show the TreeView. ; ; Parameters: ; pTree - AHK name of the TreeView control ; pSub - Subroutine for TreeViewX, the same rules as in g. ; pOptions - String containing space delimited options for setting up TreeViewX ; pUserData - Base name of the array holding user data. ; This array is indexed using tree view item handles. ; ; Options: ; HasRoot - TreeViewX has root item - the one containing all other items. ; Root item can't be moved, edited or delited, and items can not ; be moved or created outside of it. This option need to be set ; after root is already added to the menu, as TreeViewX need to ; know the root menu handle. ; ; CollapseOnMove - When moving item out of of its container, this option makes container collapse ; EditOnInsert - Automaticaly enters edit mode upon insertion of new item ; ; Example: ;> ;> TVX("MyTree", "Handler", "HasRoot CollapseOnMove") ;> ;---------------------------------------------------------------------------------------- ; Function: Walk ; Walk the menu and rise events ; ; Parameters: ; root - menu to iterate, can be simple item also ; label - event handler ; event_type - event argument 1 - Event type ; event_param - event argument 2 - Item upon which event is rised ; ; ; Type Param ; ; + - Iteration start, root handle ; M - Menu item, menu handle ; I - Item, item handle ; E - End of menu menu handle (pseudo item) ; - - Iteration end root handle (pseudo item) ; ;---------------------------------------------------------------------------------------------- ; Function: Move ; Moves tree view item up or down ; ; Parameters: ; item - Handle of the item to move ; direction - "u" or "d" (Up & Down) ; ; Returns: ; Handle of the item ; ; Remarks: ; Item to be moved is copied to the new place then source item is deleted. This ; creates new handle for the moved item. New handle will be returned by the function. ;