jinyue115 Posted December 27, 2010 Posted December 27, 2010 what 's the break point in below Recursion function ? how use the Recursion function to finish Recursive traversal ? Thanks for your reading ! expandcollapse popup#include <GuiConstantsEx.au3> #include <GuiTreeView.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <file.au3> #include <array.au3> Global $filepath, $hitem, $path, $i, $j, $filelist, $filelistb $path = @DesktopDir & '\test\' $GUI = GUICreate("(UDF Created) TreeView Create", 400, 640) $hTreeView = _GUICtrlTreeView_Create($GUI, 2, 2, 396, 568);,$iStyle, $WS_EX_CLIENTEDGE) _GUICtrlTreeView_BeginUpdate($hTreeView) ;========================================================================== TreeViewList($path) ;========================================================================== _GUICtrlTreeView_EndUpdate($hTreeView) GUISetState() Do Until GUIGetMsg() = -3 Func TreeViewList($path) ;~ While 1 $filelist = _FileListToArray($path) If @error = 1 then Exit If UBound($filelist) <> '' Then For $i = 1 To $filelist[0] $hitem = _GUICtrlTreeView_Add($hTreeView, 0, $filelist[$i]) $filepath = $path & '\' & $filelist[$i] ;=========================================================================================== $filelistb = _FileListToArray($filepath) If @error = 1 Then Exit If UBound($filelistb) <> '' Then For $j = 1 To $filelistb[0] $hitemb = _GUICtrlTreeView_AddChild($hTreeView, $hitem, $filelistb[$j]) $filepath = $path & '\' & $filelist[$i] & '\' & $filelistb[$j] ;~ Recursion($filepath, $hitemb) ;========================================================================== $filelistc = _FileListToArray($filepath) If @error = 1 Then Exit If UBound($filelistc) <> '' Then For $k = 1 To $filelistc[0] $hitemc = _GUICtrlTreeView_AddChild($hTreeView,$hitemb,$filelistc[$k]) $filepath = $path & '\' & $filelist[$i] & '\' & $filelistb[$j] & '\' & $filelistc[$k] Next EndIf ;========================================================================== Next EndIf ;============================================================================================= ;~ digui($filepath, $hitem) Next EndIf ;~ WEnd EndFunc ;==>TreeViewList Func Recursion($filepath, $hitem) $filelistb = _FileListToArray($filepath) If @error = 1 Then Exit If UBound($filelistb) <> '' Then For $j = 1 To $filelistb[0] $hitemb = _GUICtrlTreeView_AddChild($hTreeView, $hitem, $filelistb[$j]) $filepath = $path & '\' & $filelist[$i] & '\' & $filelistb[$j] ;~ Recursion($filepath, $hitemb) Next EndIf EndFunc ;==>Recursion
Moderators Melba23 Posted December 27, 2010 Moderators Posted December 27, 2010 jinyue115,Please do not bump your posts within 24 hours. Remember this is not a 24/7 support forum - those who answer are only here because they like helping others and have some time to spare. You just have to wait until someone who knows something about your particular problem, and is willing to help, comes online. Be patient and someone will answer eventually - like this. There are plenty of recursive file searches on the forum - my version is in my sig (RecFileListToArray). I suggest you take a look at them to see how other coders have dealt with the recursion problem - I avoided it altogether by using a separate array! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now