Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shortcuts not working in latest release candidate #2041

Closed
quasado opened this issue Jul 3, 2014 · 2 comments
Closed

Shortcuts not working in latest release candidate #2041

quasado opened this issue Jul 3, 2014 · 2 comments

Comments

@quasado
Copy link

quasado commented Jul 3, 2014

hi,

using latest release 010-rc1 that says to have menu item shortcut support doesn't work neither on mac or windows. Just tried it with the original test (tests/manual_tests/menu_shortcut) which does neither show shortcuts in menu or execute any of them?

@gitchs
Copy link
Contributor

gitchs commented Jul 4, 2014

@quasado
We need to create window menu in a workaround method, and I forget to update the test case.
I will update the code and submit the PR later.

Here is the index.html code you could used to test. If there are any bugs on Linux or Windows, please @ me because I wrote those code. And I will check it again on OSX later.

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf8">
    <title>test</title>
  </head>
  <body>
      <h1>it works!</h1>
    <h2>
      <ol>
        <li>Press Ctrl+Alt+i. Console will print "hello world" !</li>
        <li>Press Ctrl+q. This app will quit!</li>
      </ol>
    </h2>
    <script type="text/javascript">
      var gui = require('nw.gui');
      var win = gui.Window.get();
      var menubar = new gui.Menu({ type: 'menubar' });

      var menubar_file = new gui.MenuItem({"label":"File"});
      menubar.append(menubar_file);
      var file_menu = new gui.Menu();
      var file_quit_item = new gui.MenuItem({
        "label":"Quit",
        "click":function(){
          gui.App.quit();
        },
        "key":"q",
        "modifiers":"ctrl"
      });
      var file_info_item = new gui.MenuItem({
        "label":"Info",
        "click":function(){
          console.log("hello world");
        },
        "key":"i",
        "modifiers":"ctrl+alt"
      });
      file_menu.append(file_info_item);
      file_menu.append(file_quit_item);

      var file_about_item = new gui.MenuItem({
        "label":"About us!",
        "key":"U",
        "modifiers":"ctrl",
        "click":function(){
          console.log("About Info");
        }
      });
      file_menu.insert(file_about_item,0);

      menubar_file.submenu = file_menu;
      win.menu = menubar;

    </script>
  </body>
</html>

@gitchs
Copy link
Contributor

gitchs commented Jul 4, 2014

@quasado On OSX the window menu shortcut should works.
The version I use is v0.10.0-rc1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants