AutoHotkey Community

It is currently May 27th, 2012, 3:59 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 29 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: April 18th, 2009, 2:09 pm 
Offline

Joined: February 28th, 2006, 4:38 pm
Posts: 73
I use icons in my treeview, so I modified it to keep the right icon when moving up and down.

Here's it.

Code:
;Title: TreeViewX
;      TreeViewX  extends standard TreeView control to support moving, deleting & inserting.

;----------------------------------------------------------------------------------------
; 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")
;>
TVX( pTree, pSub, pOptions="", pUserData="", pIconData="" ) {
   global

   if InStr(pOptions, "HasRoot")   {
      TVX_HasRoot  := 1
      TVX_root := TV_GetNext()
   }

   if InStr(pOptions, "CollapseOnMove")
        TVX_CollapseOnMove := 1

   if InStr(pOptions, "EditOnInsert")
      TVX_EditOnInsert   :=    1

   TVX_userData := pUserData
   TVX_iconData := pIconData
   TVX_sub := pSub
   GuiControl, +AltSubmit +ReadOnly +gTVX_OnEvent, %pTree%
}

;----------------------------------------------------------------------------------------
; 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)
;
TVX_Walk(root, label, ByRef event_type, ByRef event_param){
   local n, t, p, c,   pref, bSetEnd, lastParent, rootsParent, tmp

   ; start event for menus
   event_type := "+"
   event_param := root
   GoSub %label%

   if !TV_GetChild(root)
      return

   ; this will be exit condition. If we come to roots parent, stop walking.
   rootsParent := TV_GetParent(root)

   lastParent := root
   c := root
   loop {
      c := TV_GetNext(c, "Full")
      TV_GetText(tmp, c)

      ; Check if this item is submenu. If so, set the lastParent
      if ( TV_GetChild(c) ){
         lastParent := c
         event_type := "M"
      }
      else event_type := "I"         ; not a submenu, it is normal item

      event_param := c
      GoSub %label%


      ; Check if c is the last item in the current submenu
      ; Do so by taking the next item and checking its parent.
      ; If the parent is different then "lastParent" current item is
      ;  at the end of the its submenu.
      n := TV_GetNext(c, "FULL")
      if (n)
      {
         p := TV_GetParent(n)
         if ( p != lastParent){
            t := lastParent
            lastParent := p
         }
         else continue

         ; It is the last child
         Loop {   ; rise "E" (end of menu) event
            event_type := "E"
            event_param := t
            GoSub %label%

            t := TV_GetParent(t)
            if (t = rootsParent) {   ; rise "-" (end of walk) event
               event_type := "-"
               event_param := t
               GoSub %label%
               return
            }
            if (p = t)
               break
         }

      } else
         Loop {
             ;this is the end of the complite menu, so close all open submenus, if any
             if (lastParent = root)    {
               event_type := "-"
               event_param := root
               GoSub %label%
               return
             }

             event_type := "E"
             event_param := lastParent
             GoSub %label%
             lastParent := TV_GetParent(lastParent)
         }
   }
}

;----------------------------------------------------------------------------------------------
; 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.
;
TVX_Move(item, direction){
   local newc, newp, t, p, n, c

   p := TV_GetPrev(item)
   n := TV_GetNext(item)

   if (TVX_HasRoot)
   {
       if   TV_GetNext()=item
         return

       if (direction="u")
       {
          if (p = 0 && TV_GetParent(item)=TV_GetNext())         ;don't let item go above root
          {
            TV_Modify(item)
            TVX_sel:=item
            return
          }
       }
    }


   ; Do so by coping an item bellow calculated item and deleting the old one.
   ; Return handle of new item

   ; newc - calculated child after which "item" should be created.
   ; newp -  ... and its parent

   ; if moving down
   if (direction = "d")
   {
      ; handle end of submenu
      if !n
      {
         newc := TV_GetParent(item)

         ; check the end of the entire list
         if (TVX_HasRoot && newc = TVX_root)
            return

         if TVX_CollapseOnMove
            TV_Modify(newc, "-Expand")

         newp := TV_GetParent(newc)
      }
      ; somewhere in the middle
      else
      {
         ; if submenu, go into it
         t := TV_Get(n, "E")
         if (t = n)
         {
            newp := n
            newc := "First"
         }
         ; not a submenu
         else
         {
            newc := n
            newp := TV_GetParent(n)
         }
      }
   }

   ; if moving up
   if (direction = "u")
   {
      ;going up - handle start of the submenu
      if !p
      {
         t := TV_GetParent(item)
         if TVX_CollapseOnMove
            TV_Modify(t, "-Expand")

         newc := TV_GetPrev(t)

         ; handle start of the menu again
         if !newc
         {
            newp := TV_GetParent(t)
            newc := "First"
         }
         else
            newp := TV_GetParent(newc)
      }
      ; somewhere in the middle
      else
      {
         ; if submenu is expanded, go into it
         t := TV_Get(p, "E")
         if (t = p)
         {
            newc := TV_GetChild(p)
            Loop
            {
               c := TV_GetNext(newc)
               if c = 0
                  break
               newc := c
            }
;            newc := "First"
            newp := t
         }
         else
         {
            t := TV_GetPrev(p)
            ;check the top of the list
            if !t
            {
               newc := "First"
               newp := TV_GetParent(p)
            }
            else
            {
               newc := t
               newp := TV_GetParent(newc)
            }
         }
      }
   }

   newc := TVX_CopyItem(newc, newp, item)
   TV_Delete(item)
   return newc
}


;---------------------------------------------------------------------------------------------
; TVX_Walk event handler wrapped in the function
;
; Function that copies menu item to the destination item.
; Handle of destination item is specified in the global variable TVX_copyDest.
;
TVX_CopyProc(iType, item) {
   local c, txt
   static lastParent

   TV_GetText(txt, item)
   if iType in +
   {
      lastParent := TVX_copyDest
      TV_Modify(TVX_copyDest, "Icon" . %TVX_iconData%%item%, txt)

      if TVX_userData
      {
         %TVX_userData%%TVX_copyDest% := %TVX_userData%%item%
         %TVX_userData%%item% := ""
      }
      if TVX_iconData
      {
         %TVX_iconData%%TVX_copyDest% := %TVX_iconData%%item%
         %TVX_iconData%%item% := ""
      }
   }

   if iType in I,M
   {
      c := TV_Add(txt, lastParent, "Icon" . %TVX_iconData%%item%)
      if iType = M
         lastParent := c

      if TVX_userData
      {
         %TVX_userData%%c% := %TVX_userData%%item%
         %TVX_userData%%item% := ""
      }
      if TVX_iconData
      {
         %TVX_iconData%%c% := %TVX_iconData%%item%
         %TVX_iconData%%item% := ""
      }
   }

   if iType = E
      lastParent := TV_GetParent(lastParent)
}

;----------------------------------------------

_TVX_CopyProc:
   TVX_CopyProc(TVX_itemType, TVX_param)
return

;-----------------------------------------------------------------------------------------------
; Create new item after the child "destc" with parent "destp" and copy the "source" item into it
;
TVX_CopyItem(destc, destp, source){
   global

   ;create the holder and call the copy function
   TVX_copyDest := TV_Add("", destp , destc)
   TVX_Walk(source, "_TVX_CopyProc", TVX_itemType, TVX_param)

   return TVX_copyDest
}

;----------------------------------------------------------------------------------------------
; Used to control moving
;
TVX_OnItemSelect(pItemId){
   global

   if (TVX_bSelfSelect)   {
      TVX_bSelfSelect := false
      return true
   }

   TVX_prevSel := TVX_sel
   TVX_sel := pItemId

   if GetKeyState("Shift") && (TVX_lastKey=38 || TVX_lastKey=40)
    if (pItemId != TVX_root)
    {
        TVX_sel := TVX_Move( TVX_prevSel, TVX_lastKey=40 ? "d" : "u")
      TVX_prevSel := pItemId


      TVX_bSelfSelect := true
      TV_Modify(TVX_sel, "Select")
;      TV_Modify(TVX_sel, "Select Bold")
      return true
    }

    return false
}

;----------------------------------------------------------------------------------------------

TVX_OnKeyPress(pKey){
   local tp, sel, tttt

   TVX_lastKey := pKey

   if (TVX_bSelfPress)   {
      TVX_bSelfPress := false
      return true
   }

   ;delete
   if pKey = 46
   {
      ; use GetSelection instead Editor_sel since if key is pressed and hold
      ; TVX_OnSelect handler may not be called before delete to set the TVX_sel

      sel := TV_GetSelection()
      if (TVX_HasRoot && sel = TVX_root)
         return false

      ; is shift delete is pressed return - some problems with this combination
      if (GetKeyState("Shift"))
         return false

      TV_Delete(sel)
      return true
   }

   ;insert
   if pKey = 45
   {
      tp := TV_GetParent(TVX_sel)
      if (TVX_sel = TVX_root)
         tp := TVX_root

      if TV_Get(TVX_sel, "E") ; if expand, add into it
         tp := TV_Add("New Item", TVX_sel, "Select Bold First")
      else
         tp := TV_Add("New Item", tp, "Select Bold " . TVX_sel)
      %TVX_userData%%tp% = ; clear data
      %TVX_iconData%%tp% = ; clear data
      if GetKeyState("Shift")
      {
         tttt := TV_Add("New Item", tp, "Bold First ")
         %TVX_userData%%tttt% = ; clear data
         %TVX_iconData%%tttt% = ; clear data
         TV_Modify(tp,"Expand", "New Menu")
      }

      if (TVX_EditOnInsert)
      {
         TVX_bSelfPress := TVX_bSelfSelect := true
         TV_Modify(tp, "Select")
         Send, {F2}
      }

      return true
   }

   return false
}

;----------------------------------------------------------------------------------------------
; g soubroutine for Tree View
;
TVX_OnEvent:
   if (A_GuiEvent="S")
      if TVX_OnItemSelect(A_EventInfo)
         return

   if (A_GuiEvent="K")
      if TVX_OnKeyPress(A_EventInfo)
         return

   ;if not the Xtended property send event to the caller
   gosub %TVX_sub%
return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 2nd, 2009, 9:41 pm 
Okay, nice code!

I know how to save the treeview. But it is also possible to load the treeview?
I use the following code: (I formatted the code so that it is easily understood)


Code:
Gui, Add, TreeView, MyTreeView

; read each line into a var
FileReadLine, contentLine1, myfile.txt, 1
FileReadLine, contentLine2, myfile.txt, 2
FileReadLine, contentLine3, myfile.txt, 3
etc.

; extracts the ID's P2231416 P2231417 P2231418 from each line
StringLeft, OutputVar1, contentLine1, 8
StringLeft, OutputVar2, contentLine2, 8
StringLeft, OutputVar3, contentLine3, 8
etc.

; extracts the right-part of the ID's --> example TV_Add("First parent")
StringTrimLeft, RightpartLine1, contentLine1, 10
StringTrimLeft, RightpartLine2, contentLine1, 10
StringTrimLeft, RightpartLine3, contentLine1, 10
etc.

; join them together --> results in example P1 := TV_Add("First parent")
%OutputVar1% := %RightpartLine1%
%OutputVar2% := %RightpartLine2%
%OutputVar3% := %RightpartLine3%
etc.



Unfortunately this always gives the following error: The following variable name contains an illegal character: TV_Add("First parent") However, I know the variable is correct. Is this a bug? Or am I doing something wrong? Is there a/another way to accomplish the loading of the treeview from a file?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 5th, 2009, 1:57 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
Module doesn't load or save. There are just test samples I provided too feel the API. Save / Load is entierly your responsibility.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 6th, 2009, 9:25 am 
Offline

Joined: February 5th, 2007, 12:19 pm
Posts: 192
Location: Osnabrück, Germany
@rexx
when moving an item the iconplace is empty.
Is there something wrong or missing in this example?

Code:
ImageListID := IL_Create(10) 
Loop 10 
    IL_Add(ImageListID, "shell32.dll", A_Index)  ;
 
   Gui, Add, TreeView, h400 w300 vMyTree ImageList%ImageListID%
   root  := TV_Add("Root", "" , "Expand")
   loop, 10
      P     := TV_Add(A_Index, root, "Icon" . A_Index) 

   TVX("MyTree", "Handler", "HasRoot CollapseOnMove","",ImageList%ImageListID%)
   
   Gui, Show,  autosize
return

Handler:
return

#include TVX_rexx.ahk   


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 9th, 2009, 1:20 am 
A load module would be nice.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 11th, 2010, 5:43 am 
Offline

Joined: July 9th, 2009, 1:13 am
Posts: 140
I found this while looking for ways to create and save checklists. majkinetor you rock!

I spent all day working on a save/load system for this. I also modified the TreeView to use checkboxes (my original intent was a checklist, after all), which the load function uses. I needed to modify majkinetor's save function to get the checkboxes and loading to work they way I wanted them to.

I also modified the library file to change the behavior of Inserted Items and Groups to reflect what I thought was a more intuitive behavior. These changes are unrelated to the save/load system, and are personal taste changes only.

I plan on cleaning this up (though would not turn down help in this area), and creating a file select option. Currently the save/load location are not changable by the user, and use a default location. I want to make a file select option to allow different checklists to be saved and loaded.

I have provided a working version of what I have so far. Save both of the scripts below (make sure they are in the same DIR), and run the example. The checklist starts out blank, but when you hit save everything will be stored in a file (checklist.txt, in the same DIR). When the example is reloaded, it will load the checklist.txt file into the listview, checkboxes and all.

Example
Code:
#NoEnv
#SingleInstance force
   
   UserToDoPath := "Checklist.txt"
   gosub CreateGui
   gosub FillTV


   TVX("MyTree", "Handler", "HasRoot CollapseOnMove ", "aTooltip")      ;!!!!!
   Gui, Show, h410 w430, To-Do Checklist
return


Handler:
   if A_GuiEvent = S
      Tooltip % aTooltip%A_EventInfo%, 0, 0
return

;-------------------------------------------------------------------------------

Save:
   TVX_Walk(root, "SaveHandler", Event, Item)
return

SaveHandler:
   TV_GetText(txt, Item)
   if Event = +
   {
      ChecklistToSave :=
      line := "|-"
   }

   if Event = E
      StringTrimRight, line, line, 1
   
   if Event in I,M
   {
      if TV_Get(Item, "Checked")
         line .= "µ"
      ChecklistToSave .=   line txt "`n"
      StringReplace, line, line, µ,,all
   }

   if Event = M
      line .= "-"
   
   if Event = -
      {
      StringTrimRight, ChecklistToSave, ChecklistToSave, 1
      FileDelete, %UserToDoPath%
      FileAppend, %ChecklistToSave%, %UserToDoPath%
      }
return

;---------------------------------------------------------------------------------

Modify:

   if A_GuiControl=Delete
       ControlSend, SysTreeView321, {DELETE}

   if A_GuiControl=Insert
       ControlSend, SysTreeView321, {INSERT}

   if A_GuiControl=Insert Submenu
   {
       ControlSend, SysTreeView321, {SHIFT down}
       ControlSend, SysTreeView321, {INSERT}
      Sleep 50
       ControlSend, SysTreeView321, {SHIFT up}
   }
return

;---------------------------------------------------------------------------------

FillTV:
   root := TV_Add("To-Do Checklist", "" , "Expand")
   FileRead, LVToCreate, %UserToDoPath%
   StringReplace, LVToCreate, LVToCreate, `r`n, `n, all
   LV_PrevNodeIteration=0
   LV_Parent=root
   RegExParentNode := "(.+?)_(\d+)$"
   RegExNodeDiff := "_\d+$"
   loop, parse, LVToCreate, `n
      {
      
      LineChecked := InStr(A_Loopfield, "µ")
      StringReplace, I_Loopfield, A_Loopfield, µ,,all
      StringReplace, I_Loopfield, I_Loopfield, `|,,all
      StringReplace, I_Loopfield, I_Loopfield, `-,, UseErrorLevel
      LV_NodeLevel := ErrorLevel
      if (LV_NodeLevel=1)
         {
         LV_PrevNodeIteration++
         LV_Nodename := "root_" LV_PrevNodeIteration
         %LV_Nodename% := TV_Add(I_Loopfield, root, "Expand Check" . LineChecked)
         LV_PrevNodeLevel=1
         LV_PrevNodeName := LV_Nodename
         }
      else if (LV_NodeLevel>LV_PrevNodeLevel)
         {
         LV_Nodename := LV_PrevNodeName "_1"
         %LV_Nodename% := TV_Add(I_Loopfield, %LV_PrevNodeName%, "Expand Check" . LineChecked)
         LV_PrevNodeLevel := LV_NodeLevel
         LV_PrevNodeName := LV_Nodename
         }
      else if (LV_NodeLevel=LV_PrevNodeLevel)
         {
         RegExMatch(LV_PrevNodeName, RegExParentNode, RegNodeOut)
         LV_Parent := RegNodeOut1
         RegNodeOut2++
         LV_Nodename := LV_Parent "_" RegNodeOut2
         %LV_Nodename% := TV_Add(I_Loopfield, %LV_Parent%, "Expand Check" . LineChecked)
         LV_PrevNodeLevel := LV_NodeLevel
         LV_PrevNodeName := LV_Nodename
         }
      else if (LV_NodeLevel<LV_PrevNodeLevel)
         {
         LV_NodeLevelDiff := LV_PrevNodeLevel-LV_NodeLevel
         ;msgbox, NodeDiff: %LV_NodeLevelDiff%
         LV_PrevNodeName := RegExReplace(LV_PrevNodeName, RegExNodeDiff, "", RegExTrash, %LV_NodeLevelDiff%)
         RegExMatch(LV_PrevNodeName, RegExParentNode, RegNodeOut)
         LV_Parent := RegExParentNode1
         RegExParentNode2++
         LV_Nodename := LV_Parent "_" RegExParentNode2
         %LV_Nodename% := TV_Add(I_Loopfield, %LV_PrevNodeName%, "Expand Check" . LineChecked)
         LV_PrevNodeLevel := LV_NodeLevel
         LV_PrevNodeName := LV_Nodename      
         }
      
      }
return

;---------------------------------------------------------------------------------

CreateGui:
   Gui, 15:Destroy
   Gui, 15:Default

   Gui, Add, TreeView, h400 w300 vMyTree Checked
   ;Gui, Add, Button, w100 x+10 , Up
   ;Gui, Add, Button, wp ,Down

   Gui, Add, Button, w100 x+10 gModify, Insert
   Gui, Add, Button, wp gModify, Insert Submenu

   Gui, Add, Button, y+20 wp gModify, Delete
   Gui, Add, Button, y+20 wp gSave, Save to file
return

;---------------------------------------------------------------------------------

Edit:
    Gui, Submit, Nohide
    c := TV_GetSelection()
    aTooltip%c% := MyEdit
return

15GuiEscape:
15GuiClose:
Gui, 15:Destroy
Return

GuiClose:
GuiEscape:
    ExitApp
return

F9::Reload

#include TVX.ahk



Modified Library
Code:
;Title: TreeViewX
;      TreeViewX  extends standard TreeView control to support moving, deleting & inserting.

;----------------------------------------------------------------------------------------
; 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")
;>
TVX( pTree, pSub, pOptions="", pUserData="" ) {
   global

   if InStr(pOptions, "HasRoot")   {
      TVX_HasRoot  := 1
      TVX_root := TV_GetNext()
   }
   
   if InStr(pOptions, "CollapseOnMove")
        TVX_CollapseOnMove := 1

   if InStr(pOptions, "EditOnInsert")
      TVX_EditOnInsert   :=    1

   TVX_userData := pUserData
   TVX_sub := pSub
   GuiControl, +AltSubmit -ReadOnly +gTVX_OnEvent, %pTree%
}

;----------------------------------------------------------------------------------------
; 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)
;
TVX_Walk(root, label, ByRef event_type, ByRef event_param){
   local n, t, p, c,   pref, bSetEnd, lastParent, rootsParent, tmp

   ; start event for menus
   event_type := "+"
   event_param := root
   GoSub %label%

   if !TV_GetChild(root)
      return
   
   ; this will be exit condition. If we come to roots parent, stop walking.
   rootsParent := TV_GetParent(root)
   
   lastParent := root
   c := root
   loop {
      c := TV_GetNext(c, "Full")
      TV_GetText(tmp, c)

      ; Check if this item is submenu. If so, set the lastParent
      if ( TV_GetChild(c) ){   
         lastParent := c
         event_type := "M"
      }
      else event_type := "I"         ; not a submenu, it is normal item

      event_param := c
      GoSub %label%      
   

      ; Check if c is the last item in the current submenu
      ; Do so by taking the next item and checking its parent.
      ; If the parent is different then "lastParent" current item is
      ;  at the end of the its submenu.
      n := TV_GetNext(c, "FULL")
      if (n)
      {
         p := TV_GetParent(n)
         if ( p != lastParent){   
            t := lastParent
            lastParent := p
         }
         else continue

         ; It is the last child
         Loop {   ; rise "E" (end of menu) event
            event_type := "E"
            event_param := t
            GoSub %label%

            t := TV_GetParent(t)
            if (t = rootsParent) {   ; rise "-" (end of walk) event
               event_type := "-"
               event_param := t
               GoSub %label%
               return
            }
            if (p = t)
               break
         }

      } else
         Loop {
             ;this is the end of the complite menu, so close all open submenus, if any
             if (lastParent = root)    {
               event_type := "-"
               event_param := root
               GoSub %label%
               return
             }
            
             event_type := "E"
             event_param := lastParent
             GoSub %label%
             lastParent := TV_GetParent(lastParent)
         }   
   }
}

;----------------------------------------------------------------------------------------------
; 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.
;
TVX_Move(item, direction){
   local newc, newp, t, p, n

   p := TV_GetPrev(item)
   n := TV_GetNext(item)

   if (TVX_HasRoot)
   {
       if   TV_GetNext()=item
         return

       if (direction="u")
       {
          if (p = 0 && TV_GetParent(item)=TV_GetNext())         ;don't let item go above root
          {
            TV_Modify(item)
            TVX_sel:=item
            return
          }
       }
    }


   ; Do so by coping an item bellow calculated item and deleting the old one.
   ; Return handle of new item
    
   ; newc - calculated child after which "item" should be created.
   ; newp -  ... and its parent

   ; if moving down
   if (direction = "d")
   {
      ; handle end of submenu
      if !n
      {
         newc := TV_GetParent(item)

         ; check the end of the entire list
         if (TVX_HasRoot && newc = TVX_root)
            return

         if TVX_CollapseOnMove
            TV_Modify(newc, "-Expand")

         newp := TV_GetParent(newc)
      }
      ; somewhere in the middle
      else
      {
            ; if submenu, go into it
         t := TV_Get(n, "E")
         if (t = n)
         {
            newp := n
            newc := "First"
         }
         ; not a submenu
         else
         {
            newc := n
            newp := TV_GetParent(n)
         }   
      }
   }

   ; if moving up
   if (direction = "u")
   {
      ;going up - handle start of the submenu
      if !p
      {
         t := TV_GetParent(item)
         if TVX_CollapseOnMove
            TV_Modify(t, "-Expand")
                                                                
         newc := TV_GetPrev(t)
                                                                                  
         ; handle start of the menu again
         if !newc
         {
            newp := TV_GetParent(t)
            newc := "First"
         }
         else
            newp := TV_GetParent(newc)
      }
      ; somewhere in the middle
      else
      {
            ; if submenu is expanded, go into it
         t := TV_Get(p, "E")
         if (t = p)
         {
            newc := "First"
            newp := t
         }
         else
         {
            t := TV_GetPrev(p)
            ;check the top of the list
            if !t
            {
               newc := "First"
               newp := TV_GetParent(p)            
            }
            else
            {
               newc := t
               newp := TV_GetParent(newc)
            }
         }
      }
   }

   newc := TVX_CopyItem(newc, newp, item)
   TV_Delete(item)
   return newc
}


;---------------------------------------------------------------------------------------------
; TVX_Walk event handler wrapped in the function
;   
; Function that copies menu item to the destination item.
; Handle of destination item is specified in the global variable TVX_copyDest.
;
TVX_CopyProc(iType, item) {
   local c, txt
   static lastParent
   
   TV_GetText(txt, item)
   if iType in +
   {
      lastParent := TVX_copyDest
      TV_Modify(TVX_copyDest, "", txt)
      
      if TVX_userData
      {
         %TVX_userData%%TVX_copyDest% := %TVX_userData%%item%
         %TVX_userData%%item% := ""
      }
   }

   if iType in I,M
   {
      c := TV_Add(txt, lastParent)
      if iType = M
         lastParent := c

      if TVX_userData
      {
         %TVX_userData%%c% := %TVX_userData%%item%
         %TVX_userData%%item% := ""
      }
   }

   if iType = E
      lastParent := TV_GetParent(lastParent)   
}

;----------------------------------------------

_TVX_CopyProc:
   TVX_CopyProc(TVX_itemType, TVX_param)
return

;-----------------------------------------------------------------------------------------------
; Create new item after the child "destc" with parent "destp" and copy the "source" item into it
;
TVX_CopyItem(destc, destp, source){
   global

   ;create the holder and call the copy function
   TVX_copyDest := TV_Add("", destp , destc )
   TVX_Walk(source, "_TVX_CopyProc", TVX_itemType, TVX_param)

   return TVX_copyDest
}

;----------------------------------------------------------------------------------------------
; Used to control moving
;
TVX_OnItemSelect(pItemId){
   global

   if (TVX_bSelfSelect)   {   
      TVX_bSelfSelect := false
      return true
   }   

   TVX_prevSel := TVX_sel
   TVX_sel := pItemId

   if GetKeyState("Shift") && (TVX_lastKey=38 || TVX_lastKey=40)
    if (pItemId != TVX_root)
    {
        TVX_sel := TVX_Move( TVX_prevSel, TVX_lastKey=40 ? "d" : "u")
      TVX_prevSel := pItemId

      
      TVX_bSelfSelect := true
      TV_Modify(TVX_sel, "Select Bold")
      return true
    }

    return false
}

;----------------------------------------------------------------------------------------------

TVX_OnKeyPress(pKey){
   local tp, sel

   TVX_lastKey := pKey

   if (TVX_bSelfPress)   {   
      TVX_bSelfPress := false
      return true
   }   

   ;delete
   if pKey = 46
   {
      ; use GetSelection instead Editor_sel since if key is pressed and hold
      ; TVX_OnSelect handler may not be called before delete to set the TVX_sel

      sel := TV_GetSelection()
      if (TVX_HasRoot && sel = TVX_root)
         return false

      ; is shift delete is pressed return - some problems with this combination
      if (GetKeyState("Shift"))
         return false

      TV_Delete(sel)
      return true
   }

   ;insert
   if pKey = 45
   {
      tp := TV_GetParent(TVX_sel)
      if (TVX_sel = TVX_root)
         tp := TVX_root

      sp := TV_GetSelection()
      if GetKeyState("Shift")
      {
         TV_Add("New", sp, "Expand Bold First ")
      }
      else
      {
         tp := TV_Add("New", tp, "Expand Bold " . TVX_sel)
      }
      if (TVX_EditOnInsert)
      {
         TVX_bSelfPress := TVX_bSelfSelect := true
         TV_Modify(tp, "Select")
         Send, {F2}
      }

      return true
   }

   return false
}

;----------------------------------------------------------------------------------------------
; g soubroutine for Tree View
;
TVX_OnEvent:
   if (A_GuiEvent="S")
      if TVX_OnItemSelect(A_EventInfo)
         return

   if (A_GuiEvent="K")
      if TVX_OnKeyPress(A_EventInfo)
         return
   
   ;if not the Xtended property send event to the caller
   gosub %TVX_sub%
return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 12th, 2010, 1:33 am 
Offline

Joined: July 9th, 2009, 1:13 am
Posts: 140
Ok, I found a few bugs in my save/load system, and I have corrected them. I also modified the GUI in <Example>. It looks a little better (personal taste) and uses an Edit field to allow naming entries before they are entered. Here are the updated files.

Example:
Code:
#NoEnv
#SingleInstance force
   
   UserToDoPath := "Checklist.txt"
   gosub CreateGui
   gosub FillTV


   TVX("MyTree", "Handler", "HasRoot CollapseOnMove ", "aTooltip")      ;!!!!!
   Gui, Show, Autosize center, To-Do Checklist
return


Handler:
   if A_GuiEvent = S
      Tooltip % aTooltip%A_EventInfo%, 0, 0
return

;-------------------------------------------------------------------------------

Save:
   TVX_Walk(root, "SaveHandler", Event, Item)
return

SaveHandler:
   TV_GetText(txt, Item)
   if Event = +
   {
      ChecklistToSave :=
      line := "|-"
   }

   if Event = E
      StringTrimRight, line, line, 1
   
   if Event in I,M
   {
      if TV_Get(Item, "Checked")
         line .= "µ"
      ChecklistToSave .=   line txt "`n"
      StringReplace, line, line, µ,,all
   }

   if Event = M
      line .= "-"
   
   if Event = -
      {
      StringTrimRight, ChecklistToSave, ChecklistToSave, 1
      FileDelete, %UserToDoPath%
      FileAppend, %ChecklistToSave%, %UserToDoPath%
      }
return

;---------------------------------------------------------------------------------

Modify:
   Gui, Submit, NoHide
   nl := NewInsertLabel
   if A_GuiControl=Delete
       ControlSend, SysTreeView321, {DELETE}

   if A_GuiControl=Insert
       ControlSend, SysTreeView321, {INSERT}

   if A_GuiControl=Insert Submenu
   {
       ControlSend, SysTreeView321, {SHIFT down}
       ControlSend, SysTreeView321, {INSERT}
      Sleep 50
       ControlSend, SysTreeView321, {SHIFT up}
   }
return

;---------------------------------------------------------------------------------

FillTV:
   root := TV_Add("To-Do Checklist", "" , "Expand")
   FileRead, LVToCreate, %UserToDoPath%
   StringReplace, LVToCreate, LVToCreate, `r`n, `n,all
   ; P1 := TV_Add( "Project 1", root, "")
   LV_PrevNodeIteration=0
   LV_Parent=root
   RegExParentNode := "(.+?)_(\d+)$"
   RegExNodeDiff := "_\d+$"
   loop, parse, LVToCreate, `n
      {
      LineChecked := InStr(A_Loopfield, "µ")
      StringReplace, I_Loopfield, A_Loopfield, µ,,all
      StringReplace, I_Loopfield, I_Loopfield, `|,,all
      StringReplace, I_Loopfield, I_Loopfield, `-,, UseErrorLevel
      LV_NodeLevel := ErrorLevel
      if (LV_NodeLevel=1)
         {
         LV_PrevNodeIteration++
         LV_Nodename := "root_" LV_PrevNodeIteration
         %LV_Nodename% := TV_Add(I_Loopfield, root, "Expand Check" . LineChecked)
         LV_PrevNodeLevel=1
         LV_PrevNodeName := LV_Nodename
         }
      else if (LV_NodeLevel>LV_PrevNodeLevel)
         {
         LV_Nodename := LV_PrevNodeName "_1"
         %LV_Nodename% := TV_Add(I_Loopfield, %LV_PrevNodeName%, "Expand Check" . LineChecked)
         LV_PrevNodeLevel := LV_NodeLevel
         LV_PrevNodeName := LV_Nodename
         }
      else if (LV_NodeLevel=LV_PrevNodeLevel)
         {
         RegExMatch(LV_PrevNodeName, RegExParentNode, RegNodeOut)
         LV_Parent := RegNodeOut1
         RegNodeOut2++
         LV_Nodename := LV_Parent "_" RegNodeOut2
         %LV_Nodename% := TV_Add(I_Loopfield, %LV_Parent%, "Expand Check" . LineChecked)
         LV_PrevNodeLevel := LV_NodeLevel
         LV_PrevNodeName := LV_Nodename
         }
      else if (LV_NodeLevel<LV_PrevNodeLevel)
         {
         LV_NodeLevelDiff := LV_PrevNodeLevel-LV_NodeLevel
         LV_PrevNodeName := RegExReplace(LV_PrevNodeName, RegExNodeDiff, "", RegExTrash, LV_NodeLevelDiff)
         RegExMatch(LV_PrevNodeName, RegExParentNode, RegNodeOut)
         LV_Parent := RegNodeOut1
         RegNodeOut2++
         LV_Nodename := LV_Parent "_" RegNodeOut2
         %LV_Nodename% := TV_Add(I_Loopfield, %LV_Parent%, "Expand Check" . LineChecked)
         LV_PrevNodeLevel := LV_NodeLevel
         LV_PrevNodeName := LV_Nodename      
         }
      
      }
return

;---------------------------------------------------------------------------------

CreateGui:
   Gui, 15:Destroy
   Gui, 15:Default
   
   Gui, Add, Edit, x5 y10 h20 w120 Section vNewInsertLabel,
   Gui, Add, Button, w80 xp+130 yp gModify, Insert
   Gui, Add, Button, xp+90 wp gModify, Insert SubItem
   
   Gui, Add, TreeView, h400 w300 xs ys+30 vMyTree Checked
   ;Gui, Add, Button, w100 x+10 , Up
   ;Gui, Add, Button, wp ,Down

   Gui, Add, Button, yp+410 xp w80 gModify, Delete
   Gui, Add, Button, yp xp+90 wp gSave, Save to file
return

;---------------------------------------------------------------------------------

Edit:
    Gui, Submit, Nohide
    c := TV_GetSelection()
    aTooltip%c% := MyEdit
return

15GuiEscape:
15GuiClose:
Gui, 15:Destroy
Return

GuiClose:
GuiEscape:
    ExitApp
return

F9::Reload

#include TVX.ahk


Library TVX:
Code:
;Title: TreeViewX
;      TreeViewX  extends standard TreeView control to support moving, deleting & inserting.

;----------------------------------------------------------------------------------------
; 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")
;>
TVX( pTree, pSub, pOptions="", pUserData="" ) {
   global

   if InStr(pOptions, "HasRoot")   {
      TVX_HasRoot  := 1
      TVX_root := TV_GetNext()
   }
   
   if InStr(pOptions, "CollapseOnMove")
        TVX_CollapseOnMove := 1

   if InStr(pOptions, "EditOnInsert")
      TVX_EditOnInsert   :=    1

   TVX_userData := pUserData
   TVX_sub := pSub
   GuiControl, +AltSubmit -ReadOnly +gTVX_OnEvent, %pTree%
}

;----------------------------------------------------------------------------------------
; 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)
;
TVX_Walk(root, label, ByRef event_type, ByRef event_param){
   local n, t, p, c,   pref, bSetEnd, lastParent, rootsParent, tmp

   ; start event for menus
   event_type := "+"
   event_param := root
   GoSub %label%

   if !TV_GetChild(root)
      return
   
   ; this will be exit condition. If we come to roots parent, stop walking.
   rootsParent := TV_GetParent(root)
   
   lastParent := root
   c := root
   loop {
      c := TV_GetNext(c, "Full")
      TV_GetText(tmp, c)

      ; Check if this item is submenu. If so, set the lastParent
      if ( TV_GetChild(c) ){   
         lastParent := c
         event_type := "M"
      }
      else event_type := "I"         ; not a submenu, it is normal item

      event_param := c
      GoSub %label%      
   

      ; Check if c is the last item in the current submenu
      ; Do so by taking the next item and checking its parent.
      ; If the parent is different then "lastParent" current item is
      ;  at the end of the its submenu.
      n := TV_GetNext(c, "FULL")
      if (n)
      {
         p := TV_GetParent(n)
         if ( p != lastParent){   
            t := lastParent
            lastParent := p
         }
         else continue

         ; It is the last child
         Loop {   ; rise "E" (end of menu) event
            event_type := "E"
            event_param := t
            GoSub %label%

            t := TV_GetParent(t)
            if (t = rootsParent) {   ; rise "-" (end of walk) event
               event_type := "-"
               event_param := t
               GoSub %label%
               return
            }
            if (p = t)
               break
         }

      } else
         Loop {
             ;this is the end of the complite menu, so close all open submenus, if any
             if (lastParent = root)    {
               event_type := "-"
               event_param := root
               GoSub %label%
               return
             }
            
             event_type := "E"
             event_param := lastParent
             GoSub %label%
             lastParent := TV_GetParent(lastParent)
         }   
   }
}

;----------------------------------------------------------------------------------------------
; 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.
;
TVX_Move(item, direction){
   local newc, newp, t, p, n

   p := TV_GetPrev(item)
   n := TV_GetNext(item)

   if (TVX_HasRoot)
   {
       if   TV_GetNext()=item
         return

       if (direction="u")
       {
          if (p = 0 && TV_GetParent(item)=TV_GetNext())         ;don't let item go above root
          {
            TV_Modify(item)
            TVX_sel:=item
            return
          }
       }
    }


   ; Do so by coping an item bellow calculated item and deleting the old one.
   ; Return handle of new item
    
   ; newc - calculated child after which "item" should be created.
   ; newp -  ... and its parent

   ; if moving down
   if (direction = "d")
   {
      ; handle end of submenu
      if !n
      {
         newc := TV_GetParent(item)

         ; check the end of the entire list
         if (TVX_HasRoot && newc = TVX_root)
            return

         if TVX_CollapseOnMove
            TV_Modify(newc, "-Expand")

         newp := TV_GetParent(newc)
      }
      ; somewhere in the middle
      else
      {
            ; if submenu, go into it
         t := TV_Get(n, "E")
         if (t = n)
         {
            newp := n
            newc := "First"
         }
         ; not a submenu
         else
         {
            newc := n
            newp := TV_GetParent(n)
         }   
      }
   }

   ; if moving up
   if (direction = "u")
   {
      ;going up - handle start of the submenu
      if !p
      {
         t := TV_GetParent(item)
         if TVX_CollapseOnMove
            TV_Modify(t, "-Expand")
                                                                
         newc := TV_GetPrev(t)
                                                                                  
         ; handle start of the menu again
         if !newc
         {
            newp := TV_GetParent(t)
            newc := "First"
         }
         else
            newp := TV_GetParent(newc)
      }
      ; somewhere in the middle
      else
      {
            ; if submenu is expanded, go into it
         t := TV_Get(p, "E")
         if (t = p)
         {
            newc := "First"
            newp := t
         }
         else
         {
            t := TV_GetPrev(p)
            ;check the top of the list
            if !t
            {
               newc := "First"
               newp := TV_GetParent(p)            
            }
            else
            {
               newc := t
               newp := TV_GetParent(newc)
            }
         }
      }
   }

   newc := TVX_CopyItem(newc, newp, item)
   TV_Delete(item)
   return newc
}


;---------------------------------------------------------------------------------------------
; TVX_Walk event handler wrapped in the function
;   
; Function that copies menu item to the destination item.
; Handle of destination item is specified in the global variable TVX_copyDest.
;
TVX_CopyProc(iType, item) {
   local c, txt
   static lastParent
   
   TV_GetText(txt, item)
   if iType in +
   {
      lastParent := TVX_copyDest
      TV_Modify(TVX_copyDest, "", txt)
      
      if TVX_userData
      {
         %TVX_userData%%TVX_copyDest% := %TVX_userData%%item%
         %TVX_userData%%item% := ""
      }
   }

   if iType in I,M
   {
      c := TV_Add(txt, lastParent)
      if iType = M
         lastParent := c

      if TVX_userData
      {
         %TVX_userData%%c% := %TVX_userData%%item%
         %TVX_userData%%item% := ""
      }
   }

   if iType = E
      lastParent := TV_GetParent(lastParent)   
}

;----------------------------------------------

_TVX_CopyProc:
   TVX_CopyProc(TVX_itemType, TVX_param)
return

;-----------------------------------------------------------------------------------------------
; Create new item after the child "destc" with parent "destp" and copy the "source" item into it
;
TVX_CopyItem(destc, destp, source){
   global

   ;create the holder and call the copy function
   TVX_copyDest := TV_Add("", destp , destc )
   TVX_Walk(source, "_TVX_CopyProc", TVX_itemType, TVX_param)

   return TVX_copyDest
}

;----------------------------------------------------------------------------------------------
; Used to control moving
;
TVX_OnItemSelect(pItemId){
   global

   if (TVX_bSelfSelect)   {   
      TVX_bSelfSelect := false
      return true
   }   

   TVX_prevSel := TVX_sel
   TVX_sel := pItemId

   if GetKeyState("Shift") && (TVX_lastKey=38 || TVX_lastKey=40)
    if (pItemId != TVX_root)
    {
        TVX_sel := TVX_Move( TVX_prevSel, TVX_lastKey=40 ? "d" : "u")
      TVX_prevSel := pItemId

      
      TVX_bSelfSelect := true
      TV_Modify(TVX_sel, "Select Bold")
      return true
    }

    return false
}

;----------------------------------------------------------------------------------------------

TVX_OnKeyPress(pKey){
   local tp, sel

   TVX_lastKey := pKey

   if (TVX_bSelfPress)   {   
      TVX_bSelfPress := false
      return true
   }   

   ;delete
   if pKey = 46
   {
      ; use GetSelection instead Editor_sel since if key is pressed and hold
      ; TVX_OnSelect handler may not be called before delete to set the TVX_sel

      sel := TV_GetSelection()
      if (TVX_HasRoot && sel = TVX_root)
         return false

      ; is shift delete is pressed return - some problems with this combination
      if (GetKeyState("Shift"))
         return false

      TV_Delete(sel)
      return true
   }

   ;insert
   if pKey = 45
   {
      if (nl="")
         nl := "New"
      tp := TV_GetParent(TVX_sel)
      if (TVX_sel = TVX_root)
         tp := TVX_root

      sp := TV_GetSelection()
      if GetKeyState("Shift")
      {
         TV_Add(nl, sp, "Expand Bold First ")
      }
      else
      {
         tp := TV_Add(nl, tp, "Expand Bold " . TVX_sel)
      }
      if (TVX_EditOnInsert)
      {
         TVX_bSelfPress := TVX_bSelfSelect := true
         TV_Modify(tp, "Select")
         Send, {F2}
      }

      return true
   }

   return false
}

;----------------------------------------------------------------------------------------------
; g soubroutine for Tree View
;
TVX_OnEvent:
   if (A_GuiEvent="S")
      if TVX_OnItemSelect(A_EventInfo)
         return

   if (A_GuiEvent="K")
      if TVX_OnKeyPress(A_EventInfo)
         return
   
   ;if not the Xtended property send event to the caller
   gosub %TVX_sub%
return


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Multiple GUI
PostPosted: May 11th, 2011, 8:11 pm 
Hi

I love this function.

Can someone tell me how to make it work with a gui other than the defult?
Such as:
Gui 49

Here is my effort - but it doesn't work anymore :(

I'll I've done is change the DOWNLOAD EXAMPLE - to try and use a different gui number.


Thanks

Code:
#NoEnv
#SingleInstance force
   
   gosub CreateGui49
   gosub FillTV


   TVX("MyTree", "Handler", "HasRoot CollapseOnMove ", "aTooltip")      ;!!!!!
   Gui 49: Show, h410 w430
return


Handler:
   if A_GuiEvent = S
      Tooltip % aTooltip%A_EventInfo%, 0, 0
return

;-------------------------------------------------------------------------------

Save:
   TVX_Walk(root, "SaveHandler", Event, Item)
return

SaveHandler:
   TV_GetText(txt, Item)
   if Event = +
   {
      FileDelete, _out.txt
      FileAppend %txt%`n, _out.txt
      line := "|-"
   }

   if Event = E
      StringTrimRight, line, line, 2
   
   if Event in I,M
   {
      FileAppend %line%%txt%, _out.txt
      FileAppend % "    " aTooltip%item% "`n", _out.txt
   }

   if Event = M
      line .= "--"
   
   if Event = -
        Msgbox, TVX saved in _out.txt
return

;---------------------------------------------------------------------------------

OnButton:
    ControlSend, SysTreeView321, {SHIFT down}
   ControlSend, SysTreeView321, {%A_GuiControl%}
   sleep 50   
    ControlSend, SysTreeView321, {SHIFT up}

;   h := TVX_Move(TV_GetSelection(), A_GuiControl="Up" ? "u" : "d")
;   TV_Modify(h, "Select")
return

Modify:

   if A_GuiControl=Delete
       ControlSend, SysTreeView321, {DELETE}

   if A_GuiControl=Insert
       ControlSend, SysTreeView321, {INSERT}

   if A_GuiControl=Insert Submenu
   {
       ControlSend, SysTreeView321, {SHIFT down}
       ControlSend, SysTreeView321, {INSERT}
      Sleep 50
       ControlSend, SysTreeView321, {SHIFT up}
   }
return

;---------------------------------------------------------------------------------

FillTV:
   root  := TV_Add("Root", "" , "Expand")
   TV_Modify( root, "", A_Index "    " root)
   loop, 10 {
      P     := TV_Add("", root)
      TV_Modify( P, "", A_Index "    " P)
      aTooltip%P% := "My Tooltip " A_Index
   }

   
   P2  := TV_Add("", P),      aTooltip%P2% := "My Tooltip 2.1"
   TV_Modify( P2, "", "2.1    " P2)

   P2   := TV_Add("", P),       aTooltip%P2% := "My Tooltip 2.2"
   TV_Modify( P2, "", "2.2    " P2)
   
   P3   := TV_Add("", P2),      aTooltip%P3% := "My Tooltip 2.2.1"
   TV_Modify( P3, "", "2.2.1    " P3)
   
   P3   := TV_Add("", P2),      aTooltip%P3% := "My Tooltip 2.2.2"
   TV_Modify( P3, "", "2.2.2   " P3)
   
   P3   := TV_Add("", P2),      aTooltip%P3% := "My Tooltip 2.2.3"
   TV_Modify( P3, "", "2.2.3    " P3)
return

;---------------------------------------------------------------------------------

CreateGui49:
Gui 49:Add, TreeView, h400 w300 vMyTree
Gui 49:Add, Button, w100 gOnButton x+10 , Up
Gui 49:Add, Button, wp gOnButton,Down

Gui 49:Add, Button, y+20 wp gModify, Insert
Gui 49:Add, Button, wp gModify, Insert Submenu

Gui 49:Add, Button, y+20 wp gModify, Delete

Gui 49:Add, Edit, y+50 wp vMyEdit gEdit,
Gui 49:Add, Text, yp-30 wp, Change tooltip for selection

Gui 49:Add, Button, y+150 w100 gSave, Save to file
return

;---------------------------------------------------------------------------------

Edit:
    Gui 49:Submit, Nohide
    c := TV_GetSelection()
    aTooltip%c% := MyEdit
return

49GuiClose:
49GuiEscape:
    ExitApp
return

#include TVX.ahk


Report this post
Top
  
Reply with quote  
 Post subject: Bug?
PostPosted: May 18th, 2011, 8:05 pm 
Hi

I found that - just needed to sent defult window :)

However - I've noticed a different problem.

When you save files such as:

|-1
|--1.1
|---1.1.1
|---1.1.2
|---1.1.3
|--1.2
|---1.2.1
|---1.2.2
|---1.2.3
|--1.3
|-2


The 1.2 is placed under the 1.1.3
But it should be in line with the 1.1

Can someone confirm this - so I know it isn't just my pc (it does some strnage thing).

If it is a bug - I think it is in the regular expression being used...but can't see where.

Thanks

Pip


Report this post
Top
  
Reply with quote  
 Post subject: Re: Bug?
PostPosted: May 19th, 2011, 12:56 am 
Pip wrote:
When you save files such as:

|-1
|--1.1
|---1.1.1
|---1.1.2
|---1.1.3
|--1.2
|---1.2.1
|---1.2.2
|---1.2.3
|--1.3
|-2


The 1.2 is placed under the 1.1.3
But it should be in line with the 1.1

Can someone confirm this - so I know it isn't just my pc (it does some strnage thing).


I think that's correct functioning. The tree has to go down each single branch to the end before going to a shallower level again. So 1.1.1- 1.1.3 have to be under 1.1. When you open a branch in windows explorer it shows children of current parent item before the next parent ;)

If you fill in the full path might make more sense eg.

1
1\1.1
1\1.1\1.1.1
...
1\1.2
1\1.2\1.2.1

etc

I think if you do a file loop and save a list of the full paths this is the same order you get

Btw havent used this function to save/load trees, how does it deal with item names if they start with "-"?


Report this post
Top
  
Reply with quote  
 Post subject: Loading tree-order
PostPosted: May 19th, 2011, 4:52 am 
Quote:
So 1.1.1- 1.1.3 have to be under 1.1


Yes - that works fine, the problem is that the 1.2 is loaded under the 1.1.3
It sould be under the 1

Quote:
Btw havent used this function to save/load trees, how does it deal with item names if they start with "-"?


Other than this one problem, the load and save functions work brilliantly, but as you point out, you can't use "-"...unless you change the script to replace the load/save to use a different symbol.

I've been playing around with it and I'm pretty sure it's something to do with the small section:

Code:
      else if (LV_NodeLevel<LV_PrevNodeLevel)
         {
         LV_NodeLevelDiff := LV_PrevNodeLevel-LV_NodeLevel
         ;msgbox, NodeDiff: %LV_NodeLevelDiff%
         LV_PrevNodeName := RegExReplace(LV_PrevNodeName, RegExNodeDiff, "", RegExTrash, %LV_NodeLevelDiff%)
         RegExMatch(LV_PrevNodeName, RegExParentNode, RegNodeOut)
         LV_Parent := RegExParentNode1
         RegExParentNode2++
         LV_Nodename := LV_Parent "_" RegExParentNode2
         %LV_Nodename% := TV_Add(I_Loopfield, %LV_PrevNodeName%, "Check" . LineChecked)
         LV_PrevNodeLevel := LV_NodeLevel
         LV_PrevNodeName := LV_Nodename       
         }


I can't find the problem - but it cuts of the "root_" bit from the LV_Nodename

I'm not great with regular-expressions, but I think it may be the "RegExParentNode1" or the "RegExParentNode2"


Report this post
Top
  
Reply with quote  
 Post subject: Have a try
PostPosted: May 19th, 2011, 5:07 am 
Just in case someone wants to test it and see - I've combined the "include" so you can just do a quick try::

Code:
#NoEnv
#SingleInstance force
   
   UserToDoPath := "Checklist.txt"
   gosub CreateGui
   gosub FillTV


   TVX("MyTree", "Handler", "HasRoot CollapseOnMove ", "aTooltip")      ;!!!!!
   Gui, Show, h410 w430, To-Do Checklist
return


Handler:
   if A_GuiEvent = S
      Tooltip % aTooltip%A_EventInfo%, 0, 0
return

;-------------------------------------------------------------------------------

Save:
   TVX_Walk(root, "SaveHandler", Event, Item)
return

SaveHandler:
   TV_GetText(txt, Item)
   if Event = +
   {
      ChecklistToSave :=
      line := "|-"
   }

   if Event = E
      StringTrimRight, line, line, 1
   
   if Event in I,M
   {
      if TV_Get(Item, "Checked")
         line .= "µ"
      ChecklistToSave .=   line txt "`n"
      StringReplace, line, line, µ,,all
   }

   if Event = M
      line .= "-"
   
   if Event = -
      {
      StringTrimRight, ChecklistToSave, ChecklistToSave, 1
      FileDelete, %UserToDoPath%
      FileAppend, %ChecklistToSave%, %UserToDoPath%
      }
return

;---------------------------------------------------------------------------------

Modify:

   if A_GuiControl=Delete
       ControlSend, SysTreeView321, {DELETE}

   if A_GuiControl=Insert
       ControlSend, SysTreeView321, {INSERT}

   if A_GuiControl=Insert Submenu
   {
       ControlSend, SysTreeView321, {SHIFT down}
       ControlSend, SysTreeView321, {INSERT}
      Sleep 50
       ControlSend, SysTreeView321, {SHIFT up}
   }
return

;---------------------------------------------------------------------------------

FillTV:
   root := TV_Add("To-Do Checklist", "" , "Expand")
   FileRead, LVToCreate, %UserToDoPath%
   StringReplace, LVToCreate, LVToCreate, `r`n, `n, all
   LV_PrevNodeIteration=0
   LV_Parent=root
   RegExParentNode := "(.+?)_(\d+)$"
   RegExNodeDiff := "_\d+$"
   loop, parse, LVToCreate, `n
      {
       
      LineChecked := InStr(A_Loopfield, "µ")
      StringReplace, I_Loopfield, A_Loopfield, µ,,all
      StringReplace, I_Loopfield, I_Loopfield, `|,,all
      StringReplace, I_Loopfield, I_Loopfield, `-,, UseErrorLevel
      LV_NodeLevel := ErrorLevel
      if (LV_NodeLevel=1)
         {
         LV_PrevNodeIteration++
         LV_Nodename := "root_" LV_PrevNodeIteration
         %LV_Nodename% := TV_Add(I_Loopfield, root, "Expand Check" . LineChecked)
         LV_PrevNodeLevel=1
         LV_PrevNodeName := LV_Nodename
         }
      else if (LV_NodeLevel>LV_PrevNodeLevel)
         {
         LV_Nodename := LV_PrevNodeName "_1"
         %LV_Nodename% := TV_Add(I_Loopfield, %LV_PrevNodeName%, "Expand Check" . LineChecked)
         LV_PrevNodeLevel := LV_NodeLevel
         LV_PrevNodeName := LV_Nodename
         }
      else if (LV_NodeLevel=LV_PrevNodeLevel)
         {
         RegExMatch(LV_PrevNodeName, RegExParentNode, RegNodeOut)
         LV_Parent := RegNodeOut1
         RegNodeOut2++
         LV_Nodename := LV_Parent "_" RegNodeOut2
         %LV_Nodename% := TV_Add(I_Loopfield, %LV_Parent%, "Expand Check" . LineChecked)
         LV_PrevNodeLevel := LV_NodeLevel
         LV_PrevNodeName := LV_Nodename
         }
      else if (LV_NodeLevel<LV_PrevNodeLevel)
         {
         LV_NodeLevelDiff := LV_PrevNodeLevel-LV_NodeLevel
         ;msgbox, NodeDiff: %LV_NodeLevelDiff%
         LV_PrevNodeName := RegExReplace(LV_PrevNodeName, RegExNodeDiff, "", RegExTrash, %LV_NodeLevelDiff%)
         RegExMatch(LV_PrevNodeName, RegExParentNode, RegNodeOut)
         LV_Parent := RegExParentNode1
         RegExParentNode2++
         LV_Nodename := LV_Parent "_" RegExParentNode2
         %LV_Nodename% := TV_Add(I_Loopfield, %LV_PrevNodeName%, "Expand Check" . LineChecked)
         LV_PrevNodeLevel := LV_NodeLevel
         LV_PrevNodeName := LV_Nodename       
         }
       
      }
return

;---------------------------------------------------------------------------------

CreateGui:
   Gui, 15:Destroy
   Gui, 15:Default

   Gui, Add, TreeView, h400 w300 vMyTree Checked
   ;Gui, Add, Button, w100 x+10 , Up
   ;Gui, Add, Button, wp ,Down

   Gui, Add, Button, w100 x+10 gModify, Insert
   Gui, Add, Button, wp gModify, Insert Submenu

   Gui, Add, Button, y+20 wp gModify, Delete
   Gui, Add, Button, y+20 wp gSave, Save to file
return

;---------------------------------------------------------------------------------

Edit:
    Gui, Submit, Nohide
    c := TV_GetSelection()
    aTooltip%c% := MyEdit
return

15GuiEscape:
15GuiClose:
Gui, 15:Destroy
Return

GuiClose:
GuiEscape:
    ExitApp
return

F9::Reload

; #include TVX_Tyrsius.ahk

;Title: TreeViewX
;      TreeViewX  extends standard TreeView control to support moving, deleting & inserting.

;----------------------------------------------------------------------------------------
; 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")
;>
TVX( pTree, pSub, pOptions="", pUserData="" ) {
   global

   if InStr(pOptions, "HasRoot")   {
      TVX_HasRoot  := 1
      TVX_root := TV_GetNext()
   }
   
   if InStr(pOptions, "CollapseOnMove")
        TVX_CollapseOnMove := 1

   if InStr(pOptions, "EditOnInsert")
      TVX_EditOnInsert   :=    1

   TVX_userData := pUserData
   TVX_sub := pSub
   GuiControl, +AltSubmit -ReadOnly +gTVX_OnEvent, %pTree%
}

;----------------------------------------------------------------------------------------
; 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)
;
TVX_Walk(root, label, ByRef event_type, ByRef event_param){
   local n, t, p, c,   pref, bSetEnd, lastParent, rootsParent, tmp

   ; start event for menus
   event_type := "+"
   event_param := root
   GoSub %label%

   if !TV_GetChild(root)
      return
   
   ; this will be exit condition. If we come to roots parent, stop walking.
   rootsParent := TV_GetParent(root)
   
   lastParent := root
   c := root
   loop {
      c := TV_GetNext(c, "Full")
      TV_GetText(tmp, c)

      ; Check if this item is submenu. If so, set the lastParent
      if ( TV_GetChild(c) ){   
         lastParent := c
         event_type := "M"
      }
      else event_type := "I"         ; not a submenu, it is normal item

      event_param := c
      GoSub %label%       
   

      ; Check if c is the last item in the current submenu
      ; Do so by taking the next item and checking its parent.
      ; If the parent is different then "lastParent" current item is
      ;  at the end of the its submenu.
      n := TV_GetNext(c, "FULL")
      if (n)
      {
         p := TV_GetParent(n)
         if ( p != lastParent){   
            t := lastParent
            lastParent := p
         }
         else continue

         ; It is the last child
         Loop {   ; rise "E" (end of menu) event
            event_type := "E"
            event_param := t
            GoSub %label%

            t := TV_GetParent(t)
            if (t = rootsParent) {   ; rise "-" (end of walk) event
               event_type := "-"
               event_param := t
               GoSub %label%
               return
            }
            if (p = t)
               break
         }

      } else
         Loop {
             ;this is the end of the complite menu, so close all open submenus, if any
             if (lastParent = root)    {
               event_type := "-"
               event_param := root
               GoSub %label%
               return
             }
             
             event_type := "E"
             event_param := lastParent
             GoSub %label%
             lastParent := TV_GetParent(lastParent)
         }   
   }
}

;----------------------------------------------------------------------------------------------
; 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.
;
TVX_Move(item, direction){
   local newc, newp, t, p, n

   p := TV_GetPrev(item)
   n := TV_GetNext(item)

   if (TVX_HasRoot)
   {
       if   TV_GetNext()=item
         return

       if (direction="u")
       {
          if (p = 0 && TV_GetParent(item)=TV_GetNext())         ;don't let item go above root
          {
            TV_Modify(item)
            TVX_sel:=item
            return
          }
       }
    }


   ; Do so by coping an item bellow calculated item and deleting the old one.
   ; Return handle of new item
     
   ; newc - calculated child after which "item" should be created.
   ; newp -  ... and its parent

   ; if moving down
   if (direction = "d")
   {
      ; handle end of submenu
      if !n
      {
         newc := TV_GetParent(item)

         ; check the end of the entire list
         if (TVX_HasRoot && newc = TVX_root)
            return

         if TVX_CollapseOnMove
            TV_Modify(newc, "-Expand")

         newp := TV_GetParent(newc)
      }
      ; somewhere in the middle
      else
      {
            ; if submenu, go into it
         t := TV_Get(n, "E")
         if (t = n)
         {
            newp := n
            newc := "First"
         }
         ; not a submenu
         else
         {
            newc := n
            newp := TV_GetParent(n)
         }   
      }
   }

   ; if moving up
   if (direction = "u")
   {
      ;going up - handle start of the submenu
      if !p
      {
         t := TV_GetParent(item)
         if TVX_CollapseOnMove
            TV_Modify(t, "-Expand")
                                                                 
         newc := TV_GetPrev(t)
                                                                                   
         ; handle start of the menu again
         if !newc
         {
            newp := TV_GetParent(t)
            newc := "First"
         }
         else
            newp := TV_GetParent(newc)
      }
      ; somewhere in the middle
      else
      {
            ; if submenu is expanded, go into it
         t := TV_Get(p, "E")
         if (t = p)
         {
            newc := "First"
            newp := t
         }
         else
         {
            t := TV_GetPrev(p)
            ;check the top of the list
            if !t
            {
               newc := "First"
               newp := TV_GetParent(p)             
            }
            else
            {
               newc := t
               newp := TV_GetParent(newc)
            }
         }
      }
   }

   newc := TVX_CopyItem(newc, newp, item)
   TV_Delete(item)
   return newc
}


;---------------------------------------------------------------------------------------------
; TVX_Walk event handler wrapped in the function
;   
; Function that copies menu item to the destination item.
; Handle of destination item is specified in the global variable TVX_copyDest.
;
TVX_CopyProc(iType, item) {
   local c, txt
   static lastParent
   
   TV_GetText(txt, item)
   if iType in +
   {
      lastParent := TVX_copyDest
      TV_Modify(TVX_copyDest, "", txt)
       
      if TVX_userData
      {
         %TVX_userData%%TVX_copyDest% := %TVX_userData%%item%
         %TVX_userData%%item% := ""
      }
   }

   if iType in I,M
   {
      c := TV_Add(txt, lastParent)
      if iType = M
         lastParent := c

      if TVX_userData
      {
         %TVX_userData%%c% := %TVX_userData%%item%
         %TVX_userData%%item% := ""
      }
   }

   if iType = E
      lastParent := TV_GetParent(lastParent)   
}

;----------------------------------------------

_TVX_CopyProc:
   TVX_CopyProc(TVX_itemType, TVX_param)
return

;-----------------------------------------------------------------------------------------------
; Create new item after the child "destc" with parent "destp" and copy the "source" item into it
;
TVX_CopyItem(destc, destp, source){
   global

   ;create the holder and call the copy function
   TVX_copyDest := TV_Add("", destp , destc )
   TVX_Walk(source, "_TVX_CopyProc", TVX_itemType, TVX_param)

   return TVX_copyDest
}

;----------------------------------------------------------------------------------------------
; Used to control moving
;
TVX_OnItemSelect(pItemId){
   global

   if (TVX_bSelfSelect)   {   
      TVX_bSelfSelect := false
      return true
   }   

   TVX_prevSel := TVX_sel
   TVX_sel := pItemId

   if GetKeyState("Shift") && (TVX_lastKey=38 || TVX_lastKey=40)
    if (pItemId != TVX_root)
    {
        TVX_sel := TVX_Move( TVX_prevSel, TVX_lastKey=40 ? "d" : "u")
      TVX_prevSel := pItemId

       
      TVX_bSelfSelect := true
      TV_Modify(TVX_sel, "Select Bold")
      return true
    }

    return false
}

;----------------------------------------------------------------------------------------------

TVX_OnKeyPress(pKey){
   local tp, sel

   TVX_lastKey := pKey

   if (TVX_bSelfPress)   {   
      TVX_bSelfPress := false
      return true
   }   

   ;delete
   if pKey = 46
   {
      ; use GetSelection instead Editor_sel since if key is pressed and hold
      ; TVX_OnSelect handler may not be called before delete to set the TVX_sel

      sel := TV_GetSelection()
      if (TVX_HasRoot && sel = TVX_root)
         return false

      ; is shift delete is pressed return - some problems with this combination
      if (GetKeyState("Shift"))
         return false

      TV_Delete(sel)
      return true
   }

   ;insert
   if pKey = 45
   {
      tp := TV_GetParent(TVX_sel)
      if (TVX_sel = TVX_root)
         tp := TVX_root

      sp := TV_GetSelection()
      if GetKeyState("Shift")
      {
         TV_Add("New", sp, "Expand Bold First ")
      }
      else
      {
         tp := TV_Add("New", tp, "Expand Bold " . TVX_sel)
      }
      if (TVX_EditOnInsert)
      {
         TVX_bSelfPress := TVX_bSelfSelect := true
         TV_Modify(tp, "Select")
         Send, {F2}
      }

      return true
   }

   return false
}

;----------------------------------------------------------------------------------------------
; g soubroutine for Tree View
;
TVX_OnEvent:
   if (A_GuiEvent="S")
      if TVX_OnItemSelect(A_EventInfo)
         return

   if (A_GuiEvent="K")
      if TVX_OnKeyPress(A_EventInfo)
         return
   
   ;if not the Xtended property send event to the caller
   gosub %TVX_sub%
return


It saves the file perfectly as:

Code:
|-1
|--1.1
|---1.1.1
|---1.1.2
|--1.2
|-2
|-3


But loads the 1.2 into the wrong place.


Report this post
Top
  
Reply with quote  
 Post subject: Please help
PostPosted: May 19th, 2011, 8:18 pm 
I've spent all day on this and can't get anywhere. :(

I've added more message boxes, displaying more variable than I could ever have imagined...but I still can't see the problem. :oops:

Can someone who knows what they are doing please help me?


Report this post
Top
  
Reply with quote  
 Post subject: Got it
PostPosted: May 19th, 2011, 9:53 pm 
At last!

Replace
Code:
else if (LV_NodeLevel=LV_PrevNodeLevel)
         {
         RegExMatch(LV_PrevNodeName, RegExParentNode, RegNodeOut)
         LV_Parent := RegNodeOut1
         RegNodeOut2++
         LV_Nodename := LV_Parent "_" RegNodeOut2
         %LV_Nodename% := TV_Add(I_Loopfield, %LV_Parent%, "Check" . LineChecked)
         LV_PrevNodeLevel := LV_NodeLevel
         LV_PrevNodeName := LV_Nodename
         }
      else if (LV_NodeLevel<LV_PrevNodeLevel)
         {
         LV_NodeLevelDiff := LV_PrevNodeLevel-LV_NodeLevel
         ;msgbox, NodeDiff: %LV_NodeLevelDiff%
         LV_PrevNodeName := RegExReplace(LV_PrevNodeName, RegExNodeDiff, "", RegExTrash, %LV_NodeLevelDiff%)
         RegExMatch(LV_PrevNodeName, RegExParentNode, RegNodeOut)
         LV_Parent := RegExParentNode1
         RegExParentNode2++
         LV_Nodename := LV_Parent "_" RegExParentNode2
         %LV_Nodename% := TV_Add(I_Loopfield, %LV_PrevNodeName%, "Check" . LineChecked)
         LV_PrevNodeLevel := LV_NodeLevel
         LV_PrevNodeName := LV_Nodename       
         }


With

Code:
else ;if (LV_NodeLevel=LV_PrevNodeLevel) OR (LV_NodeLevel<LV_PrevNodeLevel)
         {
      LV_NodeLevelDiff := LV_PrevNodeLevel-LV_NodeLevel+1
       RegNodeOut1 := LV_PrevNodeName
       Loop, %LV_NodeLevelDiff%
         RegExMatch(RegNodeOut1, RegExParentNode, RegNodeOut)
         LV_Parent := RegNodeOut1
         RegNodeOut2++
         LV_Nodename := LV_Parent "_" RegNodeOut2
         %LV_Nodename% := TV_Add(I_Loopfield, %LV_Parent%, "Check" . LineChecked)
         LV_PrevNodeLevel := LV_NodeLevel
         LV_PrevNodeName := LV_Nodename
         }


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 29 posts ]  Go to page Previous  1, 2

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 24 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group