Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support customizing button label in Open and Save dialogs (implement Choose dialogs) #1531

Closed
roryokane opened this issue Apr 30, 2015 · 3 comments

Comments

@roryokane
Copy link

A Choose dialog is just like an Open dialog, but not only does it have a custom title, it also has a custom name for the “Open” button. Two examples where it is helpful:

  • choosing a directory where downloaded files should be saved – you “Choose” the directory
  • using a dialog to “Import” a file in a different format, not to “Open” a file in your app’s format

It is used in OS X apps: OS X Human Interface Guidelines – The Choose Dialog. I don’t know if other platforms have an equivalent.

The simplest way to support it would be accepting another option in the options parameter of dialog.showOpenDialog. The property name would be something like buttonLabel, openButtonLabel, or prompt (which is OS X’s name for it). The property should contain a string that the button will be renamed to.

To implement this for OS X, you just need to add this code to SetupDialog in file_dialog_mac.mm:

if (!prompt.empty())
  [dialog setPrompt:prompt];

And also change SetupDialog and its callers to pass prompt in, which would be extracted from the options of showOpenDialog.


I can imagine that this might be useful for Save dialogs, too – you could change the button to “Save As” or “Export” instead of “Save”. You can probably implement it for dialog.showSaveDialog in exactly the same way as for showOpenDialog. It would make sense that users could pass the same option to customize the button, since those two functions already support mostly the same options.

@davej
Copy link
Contributor

davej commented Oct 30, 2015

I also have a similar use-case, I want to save multiple files to a directory. Currently using showOpenDialog with the openDirectory property which works fine but the action button on the dialog says 'Open' which is confusing for the user as the app is performing a 'Save' operation.

@bengotow
Copy link
Contributor

Haha wow didn't realize both @jstejada and I had both filed dups about this. Guess it's about time for a fix! I'll submit a PR when I get time next week.

@bengotow bengotow self-assigned this Apr 23, 2016
@zcbenz
Copy link
Member

zcbenz commented May 16, 2016

Closed with #5509.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants