Note: groups.io will be down for maintenance on Monday, September 26th, starting at 9AM Pacific Time (4PM Monday September 26, 2022 UTC), for approximately one hour.
How to have users select a directory
toggle quoted messageShow quoted text
I’d stick with the button, because its clickability shouldn’t be in doubt.
The text field, if it’s just a label, is not generally assumed to be clickable, and if you show it as editable, that sends the message that you’re expected to type something. NSPathControl is also a good choice for displaying the path, since it deals with excessive length more intelligently than a text field, and also shows icons (optionally), which can be helpful. NSPathControl can be made an active control, but I don’t think it works very well for choosing a directory.
Also, consider the case of when no folder has been set. When an app is sandboxed, this is very often the case when your app first launches, since until you pick something you don’t have the necessary security privileges to display a path. After choosing a location, you would create a security-scoped bookmark to persist that choice, but on first run you can’t so that. So your text field will be initially blank, and only the button offers any clue that you’re expected to do something. You can of course back that up with a sheet alert that prompts you to pick a folder when that UI first appears and there’s no folder set. You should also set the placeholder text (of the text label or NSPathControl) to instruct the user to choose a folder - it will be displayed automatically when that path is empty.
Here’s all I do in one of my apps - this is a button and an NSPathControl used passively.