Tsukihime Posted May 9, 2011 Share Posted May 9, 2011 (edited) What's a clean way to loop through all of the children in a tree and print the structure out, using maybe spaces or hyphens to show the depth? I'm thinking recursion..but is there a way to do it with just loops? Edited May 9, 2011 by Tsukihime Link to comment Share on other sites More sharing options...
rudi Posted May 9, 2011 Share Posted May 9, 2011 Hi. What kind of tree are you talking about? File System - files - folders? Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
spudw2k Posted May 9, 2011 Share Posted May 9, 2011 Hi.What kind of tree are you talking about? File System - files - folders?Regards, Rudi.Why does it matter?Tsukihime,Check out the _GUICtrlTreeView_Level() and _GUICtrlTreeView_GetNext() functions from the help file. They should be enough to get you started. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
rudi Posted May 10, 2011 Share Posted May 10, 2011 (edited) Why does it matter?Because I imagined, he want's to process a filesystem structure tree.You imagine, he's asking about..._GUICtrlTreeView_Level()_GUICtrlTreeView_GetNext()But as he didn't answer neither your nor my question, it really doesn't matter Regards, Rudi. Edited May 10, 2011 by rudi Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
spudw2k Posted May 11, 2011 Share Posted May 11, 2011 (edited) I was just going off of the OP, and it simply asked how to iterate through a treeview control. To me that doesn't denote specific usage to be tailored too. I prefer to the modular approach; If you start broad enough you could "write" something that could work for many "treeview" control scenarios. edit: I didn't ask a question either. Just gave my response. Edited May 11, 2011 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Tsukihime Posted May 11, 2011 Author Share Posted May 11, 2011 I ended up just using a recursive function cause using a loop was too complicated to get it to do what I wanted =/ Func getChildren($root, $depth) If _GUICtrlTreeView_GetChildren($hObjTree, $root) Then $child = _GUICtrlTreeView_GetFirstChild($hObjTree, $root) while $child getChildren($child, $depth + 1) $child = _GUICtrlTreeView_GetNextChild($hObjTree, $child) WEnd EndIf return EndFunc Hi. What kind of tree are you talking about? File System - files - folders? Regards, Rudi. Nothing specific. It is just a function that will loop through any arbitrary TreeView object. Link to comment Share on other sites More sharing options...
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