Merge pull request #4029 from leethomas/show-message-box-default-button
Show message box default button
This commit is contained in:
commit
edcd34d4ce
7 changed files with 60 additions and 22 deletions
|
@ -41,6 +41,7 @@ namespace {
|
|||
|
||||
void ShowMessageBox(int type,
|
||||
const std::vector<std::string>& buttons,
|
||||
int default_id,
|
||||
int cancel_id,
|
||||
int options,
|
||||
const std::string& title,
|
||||
|
@ -54,12 +55,13 @@ void ShowMessageBox(int type,
|
|||
if (mate::Converter<atom::MessageBoxCallback>::FromV8(args->isolate(),
|
||||
peek,
|
||||
&callback)) {
|
||||
atom::ShowMessageBox(window, (atom::MessageBoxType)type, buttons, cancel_id,
|
||||
options, title, message, detail, icon, callback);
|
||||
atom::ShowMessageBox(window, (atom::MessageBoxType)type, buttons,
|
||||
default_id, cancel_id, options, title,
|
||||
message, detail, icon, callback);
|
||||
} else {
|
||||
int chosen = atom::ShowMessageBox(window, (atom::MessageBoxType)type,
|
||||
buttons, cancel_id, options, title,
|
||||
message, detail, icon);
|
||||
buttons, default_id, cancel_id,
|
||||
options, title, message, detail, icon);
|
||||
args->Return(chosen);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,6 +95,7 @@ module.exports =
|
|||
options.message ?= ''
|
||||
options.detail ?= ''
|
||||
options.icon ?= null
|
||||
options.defaultId ?= -1
|
||||
|
||||
# Choose a default button to get selected when dialog is cancelled.
|
||||
unless options.cancelId?
|
||||
|
@ -108,6 +109,7 @@ module.exports =
|
|||
|
||||
binding.showMessageBox messageBoxType,
|
||||
options.buttons,
|
||||
options.defaultId,
|
||||
options.cancelId,
|
||||
flags,
|
||||
options.title,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue