Jump to content

Multiple Folders Selector


Nine
 Share

Recommended Posts

I made this because I wanted a specific behavior when selecting multiple folders at once.  With this UDF, you select the folders you want by checking the TreeView checkbox of each folder.  Automatically, it will show in the selection ListBox at the right of the TreeView.  If you uncheck the folder, it will be removed from the ListBox.  By selecting (highlighting) a folder, a list of the files included in that specific folder will replace the selection ListBox.  If you check/uncheck a folder, the selection ListBox will reappear.

I also needed a Root Selector that enables Drives and Network (UNC) selection that can serve to start the Multiple Folders Selector.  This is practical if you need to select a large number of folders from a specific part of the tree.  Be careful though when selecting a Root that includes hundreds of subfolders.  Selecting C:\ as a root can take quite some time to be shown.

Version 2024-05-01

* Added support for horizontal scrollbars in folders and files list boxes when appropriate

Version 2021-03-04

* Added optional list of folders to be pre-checked (must be full path name and 0-based)

 

Here a simple example :

#include <Array.au3>
#include "MultiFoldersSelectorUDF.au3"

; Select root folder and return all chosen folders
Local $sSelectedRoot = _MFS_SelectRootFolder()
If @error Then Exit
Local $aListFolder = _MFS_SelectMultipleFolders($sSelectedRoot)
If Not @error Then _ArrayDisplay($aListFolder)

; Pre-check all folders starting with "Aut" in AutoIt3 root folder and returns new checked/unchecked list of folders
Local $aPreChecked = _FileListToArrayRec(@ProgramFilesDir & "\AutoIt3", "Aut*", $FLTAR_FOLDERS, $FLTAR_RECUR, $FLTAR_SORT, $FLTAR_FULLPATH)
_ArrayDelete($aPreChecked, 0)
$aListFolder = _MFS_SelectMultipleFolders(@ProgramFilesDir & "\AutoIt3", $aPreChecked)
If Not @error Then _ArrayDisplay($aListFolder)

Let me know if you find it useful. 

MultiFoldersSelectorUDF.au3

 

Edited by Nine
Link to comment
Share on other sites

  • 3 years later...
Posted (edited)

@mike1950r  You must mean horizontal scrollbar ?  Because vertical scrollbar are automatically enabled.  You must also mean in folder list, right ?

ps. if you meant horizontal, you are right, they do not appear automatically, I will review the code accordingly.  Thanks.  Good catch.

Edited by Nine
Link to comment
Share on other sites

29 minutes ago, Nine said:

@mike1950r  You must mean horizontal scrollbar ?  Because vertical scrollbar are automatically enabled.  You must also mean in folder list, right ?

ps. if you meant horizontal, you are right, they do not appear automatically, I will review the code accordingly.  Thanks.  Good catch.

Hi Nine,

this is exactly what mean:
folder view and horizontal.

I see you have new version.
Will download and check.

Thanks

Cheers mike

Link to comment
Share on other sites

Hi Nine,

this works now fine activating horizontal scrollbar.

I find it difficult to size the listbox same as the treeview.

Is there a reason for that?

_GUICtrlTreeView_Create($hGUI, 30, 50, 320, 396
_GUICtrlListBox_Create($hGUI, "", 370, 50, 360, 421

The last values ( height) should be same, but they are 396 and 421 to get them looking same height.
Even the second value (top) is a bit different. In my case I had to mount this value for listbox higher by 1.

Ofcourse this is not a question of your library. This is caused by GuiTreeView.au3 and GuiListBox.au3.

Do you know, why this is?

Cheers mike

Link to comment
Share on other sites

Glad it now works. :)

I remember struggling with the size of the boxes.  I first thought it was an UDF problem, but it is not.  Both (TV and LB) use the same method to create the control (CreateWindowEX).  So it is Windows making a different decision based on the class of the object.  I felt, at the time, that both classes do not treat horizontal scrollbar the same way.  But never got to test it to find if my impression was right or wrong. 

41 minutes ago, mike1950r said:

Even the second value (top) is a bit different. In my case I had to mount this value for listbox higher by 1.

I don't have that issue on my side.  They are perfectly aligned. (Win10).  I did check it in Ms-Paint to make sure...

Link to comment
Share on other sites

  • 2 weeks later...

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...