Why does OpenFileDialog have a "New Folder" button?

I just noticed than on m Mac (don’t know about Windows) that the OpenFileDialog has a “New Folder” button

Now I can see being able to create a new folder on the fly useful for as Save dialog, but why is it on an open dialog? Seems to me that could only confuse some users…

Yes I know this is not new… It is just the first time I really thought about it!

  • karen
1 Like

It is not the standard appearance on a Mac for an Open Dialog so I would consider it a “bug” or at least “undesirable”. IMO, it would be reasonable to report it to Feedback.

This comes from the fact that the NSOpenPanel panel is a subclass of the NSSavePanel, which has the property

var canCreateDirectories: Bool { get set }

In other languages, you’re in control of this property.

let panel = NSOpenPanel()
panel.allowsMultipleSelection = false
panel.canCreateDirectories    = false

You have two choices with Xojo, file a feedback request or replace the open dialog with declares / plugins.

2 Likes

But this is the OS default behavior, right? It’s usually best to leave this stuff alone, so it matches user expectations from elsewhere in the system.

Not really. I tried it with a handful of applications on my Mac and none of them had the “New Folder” option in their Open File Dialogs.

Rowlands mentions two options: use declares or submit Feedback.

The third is to ignore it. :slightly_smiling_face:.

I had not noticed it and neither had the OP for a long time.

On Windows, if not present as something clickable, we usually always have a “New Folder” option, we just right-click in the current folder being navigated and options pop-up, one of those is the “create New Folder”, then you can create it, rename it, navigate to it, and even drag a file into it before selecting such folder, that’s why New Folder is important, shortening a task on the fly.

That said, having a granular control of what the user can or can’t is the best option, if possible.

I found one which has: Music.

1 Like

If you want more control, I have classes for this on GitHub:

6 Likes

I don’t think it is, in the other IDE/Language that I’m using, you have to add code to make this button appear.

Please call me Sam or 山姆, not used to being addressed by my surname.

Good job.

Greg’s library works a treat. It can even be used to add accessory panels to Open and Save dialog boxes. Great stuff. For example:

1 Like

The “New Folder” button is also present on OpenFileDialog in Windows too.

I have given little thought, if any to this issue, before seeing this thread. Since I already use MBS it was pretty simple to address it in the Mac versions of my projects.

As to Windows, I’ve tried several apps, including Word, and “New Folder” appears in every Open dialog I’ve checked. So it looks like an “is what it is” thing, unless I’m missing something.

Thank you, can you select multiple files for opening with your library? I don’t know why this hasn’t been available on Xojo.

I realize you were addressing Greg, but multiple file selection is available in Xojo. Set the option in an instance of the OpenFileDialog class.

1 Like

Yes. It has most of the features offered by Apple, including attaching an accessory view.

It also has a finer control over which things are enabled when selecting files, including an event that lets you decide on a file-by-file basis.

1 Like

FYI — some people don’t realise that you can drag and drop a file or folder into the Open dialog to change where it is focussing.

1 Like

That’s correct. I hadn’t seen it. Thank you very much :slight_smile: Here’s the link to the documentation AllowMultipleSelections