在Mac上的Electron 5中使用dialog.showMessageBox时,无法使用键盘快捷键/加速键。感谢任何指针。
我搜索了但没有找到任何可行的示例,这使我怀疑我可能做错了什么。 我试图将选项normalizeAccessKeys设置为true和1-均无效。 我没有在Windows或Linux上尝试过 。
function f_project_ask_save_or_not(){
var return_value;
dialog.showMessageBox({
window_main, title: "Save project before creating a new?",
message: "Do you want to save the changes you made to the current project?",
detail: "You have unsaved changes. Only one project can be opened at any time. Your changes will be lost if you don't save them.",
buttons: ["&Save","&Cancel","&Don't save"],
icon: "./app/images/appicon/icon-1024@2x-128.png",
defaultId: 0,
cancelId: 1,
normalizeAccessKeys: 1
},
response => {
if (response == 0) { return_value = "save"; }
if (response == 1) { return_value = "cancel"; }
if (response == 2) { return_value = "discard"; }
});
return return_value;
}
我希望获得“保存”,“取消”和“不保存”对话框按钮的快捷键。我没有视觉指示器(带下划线的字符)或快捷键。
谢谢。