nw.js: MenuItem click functions do not work in 0.94.0
Issue Type
Bug Report. MenuItem click functions do not work in 0.94.0
Additional Info
- Operating System: any
- NW.js Version: 0.94
- Repro Link: nwjsMenu_Bug.zip
- Code snippet:
var gui = require('nw.gui');
gui.Window.get().showDevTools();
//menubar stuff- needs osx as well
var your_menu = new nw.Menu({ type: 'menubar' });
if(process.platform == "darwin"){
your_menu.createMacBuiltin("Crocotile3D"); //I need to change some values in files for mac to this name instead of nwjs
your_menu.removeAt(0);
your_menu.removeAt(0);
}
var strArray = ['a','shift'];
var loadItem = new nw.MenuItem({ label: 'Load Scene', key: strArray[0], modifiers: strArray[1], click: function() { test(); } });
var fileSubmenu = new nw.Menu();
fileSubmenu.append(loadItem);
// the menu item appended should have a submenu
your_menu.append(new nw.MenuItem({ label: 'File', submenu: fileSubmenu, click: function(){ } }));
gui.Window.get().menu = your_menu;
function test(){
console.log("selected menu item");
}
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 16 (2 by maintainers)
Commits related to this issue
- NWJS 0.94 bug - https://github.com/nwjs/nw.js/issues/8240 - Revert "update nwjs" This reverts commit ee327faf0facadf24482fef8fda7aa085114a3f2. — committed to vankasteelj/frak by vankasteelj 2 years ago
I think this issue is similar to https://github.com/nwjs/nw.js/issues/8248