On OS X the "Cancel" is always get selected when dialog is cancelled

This commit is contained in:
Cheng Zhao 2015-07-07 18:45:43 +08:00
parent fb537d91fc
commit df4b5f4ede

View file

@ -93,6 +93,7 @@ module.exports =
options.detail ?= ''
options.icon ?= null
# Choose a default button to get selected when dialog is cancelled.
unless options.cancelId?
options.cancelId = 0
for text, i in options.buttons
@ -100,6 +101,12 @@ module.exports =
options.cancelId = i
break
# On OS X the "Cancel" is always get selected when dialog is cancelled.
if process.platform is 'darwin'
for text, i in options.buttons when text is 'Cancel'
options.cancelId = i
break
binding.showMessageBox messageBoxType,
options.buttons,
options.cancelId,