Add support for checkbox with dialog.showMessageBox
This adds the `checkboxLabel` and `checkboxChecked` options to display a checkbox in the message box. Fixes #6048.
This commit is contained in:
parent
9163b601a4
commit
c8c11e68c6
10 changed files with 155 additions and 61 deletions
|
@ -178,7 +178,10 @@ module.exports = {
|
|||
}
|
||||
}
|
||||
|
||||
let {buttons, cancelId, defaultId, detail, icon, message, title, type} = options
|
||||
let {
|
||||
buttons, cancelId, checkboxLabel, checkboxChecked, defaultId, detail,
|
||||
icon, message, title, type
|
||||
} = options
|
||||
|
||||
if (type == null) {
|
||||
type = 'none'
|
||||
|
@ -217,6 +220,14 @@ module.exports = {
|
|||
throw new TypeError('Detail must be a string')
|
||||
}
|
||||
|
||||
checkboxChecked = !!checkboxChecked
|
||||
|
||||
if (checkboxLabel == null) {
|
||||
checkboxLabel = ''
|
||||
} else if (typeof checkboxLabel !== 'string') {
|
||||
throw new TypeError('checkboxLabel must be a string')
|
||||
}
|
||||
|
||||
if (icon == null) {
|
||||
icon = null
|
||||
}
|
||||
|
@ -239,8 +250,8 @@ module.exports = {
|
|||
|
||||
const flags = options.noLink ? messageBoxOptions.noLink : 0
|
||||
return binding.showMessageBox(messageBoxType, buttons, defaultId, cancelId,
|
||||
flags, title, message, detail, icon, window,
|
||||
callback)
|
||||
flags, title, message, detail, checkboxLabel,
|
||||
checkboxChecked, icon, window, callback)
|
||||
},
|
||||
|
||||
showErrorBox: function (...args) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue