- Run the code below:
package.json:
{
"name": "helloworld",
"main": "index.html"
}
index.html:
<!DOCTYPE html>
<html>
<head>
<title>Hello World!</title>
<script>
var menu = new nw.Menu({type: 'menubar'});
var submenu_one = new nw.Menu();
submenu_one.append(new nw.MenuItem({
label: 'Item A',
click: function() { console.log("Item A"); }
}));
submenu_one.append(new nw.MenuItem({
label: 'Item B',
click: function() { console.log("Item B"); }
}));
var submenu_two = new nw.Menu();
submenu_two.append(new nw.MenuItem({
label: 'Item C',
click: function() { console.log("Item C"); }
}));
submenu_two.append(new nw.MenuItem({
label: 'Item D',
click: function() { console.log("Item D"); }
}));
var submenu_three = new nw.Menu();
submenu_three.append(new nw.MenuItem({
label: 'Item F',
click: function() { console.log("Item F"); }
}));
submenu_three.append(new nw.MenuItem({
label: 'Item G',
click: function() { console.log("Item G"); }
}));
menu.append(new nw.MenuItem({
label: 'First Menu',
submenu: submenu_one
}));
menu.append(new nw.MenuItem({
label: 'Second Menu',
submenu: submenu_two
}));
menu.append(new nw.MenuItem({
label: 'Third Menu',
submenu: submenu_three
}));
nw.Window.get().menu = menu;
</script>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>
- Click "ctrl-shift-i" to bring up devtools, and click "Console" to show the console.
- In the main window click "First Menu" and release the mouse button. It should bring up the submenu.
- Without clicking the mouse again, move the mouse to hover over "Third Menu". It should show the submenu for "Third Menu".
- In the submenu, click "Item F".
Bug! It should print out "Item F" to the console, but it doesn't print. The click callback function isn't getting called.
Operating System: Windows 7 (But it also has happened on Ubuntu 14.04, Debian Jessie, and
arch. Haven't check OSX yet...)
Version: 0.14.2 SDK x64 for Windows
Reproducible case: see above
package.json:
index.html:
Bug! It should print out "Item F" to the console, but it doesn't print. The click callback function isn't getting called.
Operating System: Windows 7 (But it also has happened on Ubuntu 14.04, Debian Jessie, and
arch. Haven't check OSX yet...)
Version: 0.14.2 SDK x64 for Windows
Reproducible case: see above