messageBoxTypes = ['none', 'info', 'warning', 'error', 'question']
+messageBoxOptions =
+ noLink: 1 << 0
+
parseArgs = (window, options, callback) ->
unless window is null or window?.constructor is BrowserWindow
# Shift.
options.cancelId = i
break
+ flags = if options.noLink then messageBoxOptions.noLink else 0
+
binding.showMessageBox messageBoxType,
options.buttons,
options.cancelId,
- 0,
+ flags,
options.title,
options.message,
options.detail,
MessageBoxType type,
const std::vector<base::string16>& buttons,
int cancel_id,
+ int options,
const base::string16& title,
const base::string16& message,
const base::string16& detail,
if (dialog_buttons.size() > 0) {
config.pButtons = &dialog_buttons.front();
config.cButtons = dialog_buttons.size();
- config.dwFlags |= TDF_USE_COMMAND_LINKS; // custom buttons as links.
+ if (!(options & MESSAGE_BOX_NO_LINK))
+ config.dwFlags |= TDF_USE_COMMAND_LINKS; // custom buttons as links.
}
int id = 0;
type,
utf16_buttons,
cancel_id,
+ options,
base::UTF8ToUTF16(title),
base::UTF8ToUTF16(message),
base::UTF8ToUTF16(detail),
}
void ShowErrorBox(const base::string16& title, const base::string16& content) {
- ShowMessageBoxUTF16(NULL, MESSAGE_BOX_TYPE_ERROR, {}, 0, L"Error", title,
+ ShowMessageBoxUTF16(NULL, MESSAGE_BOX_TYPE_ERROR, {}, 0, 0, L"Error", title,
content, gfx::ImageSkia());
}
instead of clicking the buttons of the dialog. By default it is the index
of the buttons that have "cancel" or "no" as label, or 0 if there is no such
buttons. On OS X and Windows the index of "Cancel" button will always be
- used as `cancelId`, not matter whether it is already specified.
+ used as `cancelId`, not matter whether it is already specified
+ * `noLink` Boolean - On Windows Electron would try to figure out which ones of
+ the `buttons` are common buttons (like "Cancel" or "Yes"), and show the
+ others as command links in the dialog, this can make the dialog appear in
+ the style of modern Windows apps. If you don't like this behavior, you can
+ specify `noLink` to `true`
* `callback` Function
Shows a message box, it will block until the message box is closed. It returns