Page 1 of 1

wxDirDialog with multiple selections?

Posted: Tue Apr 21, 2020 6:52 pm
by david_mtl
Hi everyone, how would you go about adding the ability to select multiple folders when using wxDirDialog?

I could use wxGenericDirCtrl to implement my own solution but I wonder if there isn't a more straightforward way of doing it with wxDirDialog.

Thx, stay safe.

Re: wxDirDialog with multiple selections?

Posted: Fri Apr 24, 2020 1:58 pm
by david_mtl
Pumping this question up in case someone's got an idea.

Re: wxDirDialog with multiple selections?

Posted: Fri Apr 24, 2020 2:24 pm
by Kvaz1r
It's not possible because wxDirDialog hold only one selected item.

Re: wxDirDialog with multiple selections?

Posted: Fri Apr 24, 2020 2:46 pm
by doublemax
I don't remember to have ever seen a dir dialog which allows multiple selections. So the main question is: Does any of the native controls on the 3 major platforms support this?

Re: wxDirDialog with multiple selections?

Posted: Fri Apr 24, 2020 4:51 pm
by david_mtl
doublemax wrote:
Fri Apr 24, 2020 2:46 pm
I don't remember to have ever seen a dir dialog which allows multiple selections. So the main question is: Does any of the native controls on the 3 major platforms support this?
Yep

IFileDialog(win32 api) supports both the flag FOS_ALLOWMULTISELECT and FOS_PICKFOLDERS at the same time.

IFileDialog: https://docs.microsoft.com/en-us/window ... setoptions
Flags: https://docs.microsoft.com/en-us/window ... logoptions

Turns out Mac too: https://developer.apple.com/documentati ... eselection
A Boolean that indicates whether the user can choose directories in the panel.
GTK too apparently
FileChooserDialog: https://valadoc.org/gtk+-3.0/Gtk.FileChooserDialog.html
flag: SELECT_FOLDER and the function set_select_multiple from the base class FileChooser.

It's a useful feature when you need to select multiple folders...

Re: wxDirDialog with multiple selections?

Posted: Fri Apr 24, 2020 4:57 pm
by doublemax
Thanks. Please open a request ticket at http://trac.wxwidgets.org and include that information.

Re: wxDirDialog with multiple selections?

Posted: Fri Apr 24, 2020 6:00 pm
by david_mtl
Done.
http://trac.wxwidgets.org/ticket/18736

Meanwhile, if anyone's got any pointers on how to modify wxFileDialog to create a version that selects folders instead of files, I'am all ears.

Thx

Re: wxDirDialog with multiple selections?

Posted: Fri Apr 24, 2020 7:44 pm
by ONEEYEMAN
Hi,
david_mtl wrote:
Fri Apr 24, 2020 4:51 pm
doublemax wrote:
Fri Apr 24, 2020 2:46 pm
I don't remember to have ever seen a dir dialog which allows multiple selections. So the main question is: Does any of the native controls on the 3 major platforms support this?
Yep

IFileDialog(win32 api) supports both the flag FOS_ALLOWMULTISELECT and FOS_PICKFOLDERS at the same time.

IFileDialog: https://docs.microsoft.com/en-us/window ... setoptions
Flags: https://docs.microsoft.com/en-us/window ... logoptions

Turns out Mac too: https://developer.apple.com/documentati ... eselection
A Boolean that indicates whether the user can choose directories in the panel.
Mac probably doesn't support it - it just an indication that the dialog/panel supports selecting the directories vs files.
Did you check it?

Thank you.
david_mtl wrote:
Fri Apr 24, 2020 4:51 pm
GTK too apparently
FileChooserDialog: https://valadoc.org/gtk+-3.0/Gtk.FileChooserDialog.html
flag: SELECT_FOLDER and the function set_select_multiple from the base class FileChooser.

It's a useful feature when you need to select multiple folders...

Re: wxDirDialog with multiple selections?

Posted: Fri Apr 24, 2020 8:27 pm
by david_mtl
Mac probably doesn't support it - it just an indication that the dialog/panel supports selecting the directories vs files.
Did you check it?
I don't understand what you mean. That's the SDK to write apps on MacOS.
Here's the api for the file dialog: https://developer.apple.com/documentati ... guage=objc
Notice the section "Configuring the Open Panel".
You'll see both:

Code: Select all

canChooseDirectories
A Boolean that indicates whether the user can choose directories in the panel.

allowsMultipleSelection
A Boolean that indicates whether the user may select multiple files and directories.
I'm not a Mac developper but that does look like selecting multiple folders is supported by the sdk.

Re: wxDirDialog with multiple selections?

Posted: Sat Jul 11, 2020 5:01 pm
by PB
Just for future reference, support for multiple selection in wxDirDialog has just been added:
https://github.com/wxWidgets/wxWidgets/ ... 195af6bc32