Jump to content
Sign in to follow this  
DucViet321

TreeView: Duplicate items with the same name

Recommended Posts

DucViet321

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
Next
By the way, I really want to get the full file link when doubleclick on its name in my TreeView, still thinking... Edited by DucViet321

$Money = ControlGetMoney(@Life,"People","Pocket4")If $Money Then $Rich = TrueElse $Risk = True _RunAwayFromPolice("Fastest")EndIf

Share this post


Link to post
Share on other sites
FireFox

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.

  • Like 1

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
DucViet321

@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 by DucViet321

$Money = ControlGetMoney(@Life,"People","Pocket4")If $Money Then $Rich = TrueElse $Risk = True _RunAwayFromPolice("Fastest")EndIf

Share this post


Link to post
Share on other sites
DucViet321

Anyone? T_T


$Money = ControlGetMoney(@Life,"People","Pocket4")If $Money Then $Rich = TrueElse $Risk = True _RunAwayFromPolice("Fastest")EndIf

Share this post


Link to post
Share on other sites
FireFox

Please wait at least 24 hours before bumping.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
FireFox

How do you want the files to be listed?

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
DucViet321

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

Share this post


Link to post
Share on other sites
FireFox

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.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×