Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

I am using Windows OS and (supposedly) nw.gui provides a more "native" look to menus. Personally it doesn't look any different than when I just use the Menu constructor. I am curious what the exact difference is. The code I am using for both scenarios is below with screenshot.


var menu = new nw.Menu({
    type: 'menubar'
});



var submenu = new nw.Menu();

submenu.append(new nw.MenuItem({
    label: 'Item A'
}));

submenu.append(new nw.MenuItem({
    label: 'Item B'
}));



menu.append(new nw.MenuItem({
    label: 'First Menu',
    submenu: submenu
}));



// Assign it to `window.menu` to get the menu displayed
nw.Window.get().menu = menu;

Image of render:

enter image description here


nw.gui example

var gui = require('nw.gui');

var win = gui.Window.get();

var menubar = new gui.Menu({
    type: 'menubar'
});

var file = new gui.Menu();

var subMenu = new gui.Menu();

file.append(new gui.MenuItem({
    label: 'Item A'
}));

file.append(new gui.MenuItem({
    label: 'Item B'
}));

menubar.append(new gui.MenuItem({
    label: 'First Menu',
    submenu: file
}));

win.menu = menubar;

Image of render

enter image description here

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.