Jump to content
Sign in to follow this  
gzd

showing folders structures

Recommended Posts

gzd

Hi,

I have a folder with some sub folders inside.

Is there an easy way to insert the sub folders names into a listbox?

Also, is there an option to turn treeview into a diretory structure view?

Thanks

Share this post


Link to post
Share on other sites
smashly

Hi, list sub folders of a directory in a listbox is pretty easy..

#include<GuiConstants.au3>
#include <File.au3>

$Gui = GUICreate("List Folders", 400, 300)
$List = GUICtrlCreateList("",10,10,380,250)
$Button = GUICtrlCreateButton("Browse", 160, 270, 80, 20)
GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button
            Local $FSF = FileSelectFolder("Browse for folder.", "")
            If Not @error And FileExists($FSF) Then
                Dim $FL2A = _FileListToArray($FSF, "*", 2)
                If Not @error Then
                    WinSetTitle($Gui, "", $FL2A[0] & " folder(s) found in " & $FSF)
                    GUICtrlSetData($List, "")
                    For $i = 1 to $FL2A[0]
                        GUICtrlSetData($List, $FL2A[$i])
                    Next
                EndIf   
            EndIf
    EndSwitch
WEnd

As for the treeview part of your question I didn't quite understand it..

Elaborate a bit more on what you mean and I could probably answer your question.

Cheers

Edit: removed not needed style from listbox.. lol

Edited by smashly

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  

×