wxDirDialog with multiple selections?

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
david_mtl
Earned a small fee
Earned a small fee
Posts: 20
Joined: Fri Jan 10, 2020 4:13 pm

wxDirDialog with multiple selections?

Post by david_mtl » Tue Apr 21, 2020 6:52 pm

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.

david_mtl
Earned a small fee
Earned a small fee
Posts: 20
Joined: Fri Jan 10, 2020 4:13 pm

Re: wxDirDialog with multiple selections?

Post by david_mtl » Fri Apr 24, 2020 1:58 pm

Pumping this question up in case someone's got an idea.

Kvaz1r
Super wx Problem Solver
Super wx Problem Solver
Posts: 251
Joined: Tue Jun 07, 2016 1:07 pm

Re: wxDirDialog with multiple selections?

Post by Kvaz1r » Fri Apr 24, 2020 2:24 pm

It's not possible because wxDirDialog hold only one selected item.

User avatar
doublemax
Moderator
Moderator
Posts: 15291
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxDirDialog with multiple selections?

Post by doublemax » 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?
Use the source, Luke!

david_mtl
Earned a small fee
Earned a small fee
Posts: 20
Joined: Fri Jan 10, 2020 4:13 pm

Re: wxDirDialog with multiple selections?

Post by david_mtl » 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.
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...

User avatar
doublemax
Moderator
Moderator
Posts: 15291
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxDirDialog with multiple selections?

Post by doublemax » Fri Apr 24, 2020 4:57 pm

Thanks. Please open a request ticket at http://trac.wxwidgets.org and include that information.
Use the source, Luke!

david_mtl
Earned a small fee
Earned a small fee
Posts: 20
Joined: Fri Jan 10, 2020 4:13 pm

Re: wxDirDialog with multiple selections?

Post by david_mtl » Fri Apr 24, 2020 6:00 pm

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

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4543
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxDirDialog with multiple selections?

Post by ONEEYEMAN » Fri Apr 24, 2020 7:44 pm

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...

david_mtl
Earned a small fee
Earned a small fee
Posts: 20
Joined: Fri Jan 10, 2020 4:13 pm

Re: wxDirDialog with multiple selections?

Post by david_mtl » Fri Apr 24, 2020 8:27 pm

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.

PB
Part Of The Furniture
Part Of The Furniture
Posts: 2676
Joined: Sun Jan 03, 2010 5:45 pm

Re: wxDirDialog with multiple selections?

Post by PB » Sat Jul 11, 2020 5:01 pm

Just for future reference, support for multiple selection in wxDirDialog has just been added:
https://github.com/wxWidgets/wxWidgets/ ... 195af6bc32

Post Reply