DucViet321 Posted August 23, 2013 Share Posted August 23, 2013 (edited) Hi, like what I have done with ListView recently, I managed to add a list of Folders => Subfolder => Files into ListView and now I'm moving to TreeView. The problem is when the subfolder has more than one file, my code creates 2 same name item instead.$aList = _RecFileListToArray(@ScriptDir & "\test", "*.txt;*.pxt;*.bee", 1, 1, 1, 1) ; Loop through file list For $i = 1 To $aList[0] Local $j = 1, $cItem[4] ; Split path on "\" $aSplit = StringSplit($aList[$i], "\") $pItem = GUICtrlCreateTreeViewItem($aSplit[1], $TreeView) $cItem[1] = $pItem While $aSplit[0] > $j $j += 1 $cItem[$j] = GUICtrlCreateTreeViewItem($aSplit[$j], $cItem[$j-1]) WEnd NextBy the way, I really want to get the full file link when doubleclick on its name in my TreeView, still thinking... Edited August 23, 2013 by DucViet321 $Money = ControlGetMoney(@Life,"People","Pocket4")If $Money Then $Rich = TrueElse $Risk = True _RunAwayFromPolice("Fastest")EndIf Link to comment Share on other sites More sharing options...
FireFox Posted August 23, 2013 Share Posted August 23, 2013 Hi,It would be fine to create a simple GUI so that we don't have to do it, I mean a working example Br, FireFox. DucViet321 1 Link to comment Share on other sites More sharing options...
DucViet321 Posted August 23, 2013 Author Share Posted August 23, 2013 (edited) @FireFox: Here you go, Its not quiet nice cuz I removed things which are not related#include <RecFileListToArray.au3> #include <Constants.au3> #include <GUIConstantsEx.au3> #include <Array.au3> $Form = GUICreate("Beenice 2", 729, 557, 339, 228) $TreeView = GUICtrlCreateTreeView(0, 30, 225, 485) GUISetState(@SW_SHOW) ; Get sorted list of files $aList = _RecFileListToArray(@ScriptDir & "\test", "*.txt;*.pxt;*.bee", 1, 1, 1, 1) ; Loop through file list For $i = 1 To $aList[0] Local $j = 1, $cItem[4] ; Split path on "\" $aSplit = StringSplit($aList[$i], "\") $pItem = GUICtrlCreateTreeViewItem($aSplit[1], $TreeView) $cItem[1] = $pItem While $aSplit[0] > $j $j += 1 $cItem[$j] = GUICtrlCreateTreeViewItem($aSplit[$j], $cItem[$j-1]) WEnd Next ;~ _ArrayDisplay($aList) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Form EndSwitch WEnd*RecFileListToArray by M23: '?do=embed' frameborder='0' data-embedContent>>Duc Viet Edited August 23, 2013 by DucViet321 $Money = ControlGetMoney(@Life,"People","Pocket4")If $Money Then $Rich = TrueElse $Risk = True _RunAwayFromPolice("Fastest")EndIf Link to comment Share on other sites More sharing options...
DucViet321 Posted August 24, 2013 Author Share Posted August 24, 2013 Anyone? T_T $Money = ControlGetMoney(@Life,"People","Pocket4")If $Money Then $Rich = TrueElse $Risk = True _RunAwayFromPolice("Fastest")EndIf Link to comment Share on other sites More sharing options...
FireFox Posted August 24, 2013 Share Posted August 24, 2013 Please wait at least 24 hours before bumping. Link to comment Share on other sites More sharing options...
FireFox Posted August 24, 2013 Share Posted August 24, 2013 How do you want the files to be listed?Br, FireFox. Link to comment Share on other sites More sharing options...
DucViet321 Posted August 24, 2013 Author Share Posted August 24, 2013 How do you want the files to be listed? Br, FireFox. Simple:  [+] Folder 1 -----[+] Subfolder ----------- File ----------- File ----------- File ----------- File -----[+] Subfolder ----------- File [+] Folder 2 -----[+] Subfolder -----------[+] Subsubfolder ----------------- File  I've done it but if the main folders are same name, these aren't mergred $Money = ControlGetMoney(@Life,"People","Pocket4")If $Money Then $Rich = TrueElse $Risk = True _RunAwayFromPolice("Fastest")EndIf Link to comment Share on other sites More sharing options...
FireFox Posted August 24, 2013 Share Posted August 24, 2013 I don't know what you had in mind but your script is totally wrong it can't work like that.Search on the forum, there is maybe an algorithm existing for this.Br, FireFox. Link to comment Share on other sites More sharing options...
robertcollier4 Posted August 24, 2013 Share Posted August 24, 2013 '?do=embed' frameborder='0' data-embedContent>> ?do=embed#entry576433'' frameborder='0' data-embedContent>> Link to comment Share on other sites More sharing options...
AZJIO Posted August 26, 2013 Share Posted August 26, 2013 >Create_list_files : _AddFileList() My other projects or all 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