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
Window menu shortcut with non alphanumeric key #2807
Comments
By testing it out, I found that part of thoose can be mapped using specific charcode (which don't match javascript keycode): key = String.fromCharCode(28); // arrow left
key = String.fromCharCode(29); // arrow right
key = String.fromCharCode(30); // arrow up
key = String.fromCharCode(31); // arrow down
key = String.fromCharCode(27); // escape
key = String.fromCharCode(11); // Page up
key = String.fromCharCode(12); // Page down For some others (like Tab, Backspace), when using the corresponding ascii character, the window menu display well the shortcut (on mac only #2153) but it is not mapped successfully. And I failed to find a charCode for Function keys (F1 to F12) and Home/End |
I believe better documentation is needed here about which keys can be used and the fact that String.fromCharCode is a good alternative. |
Just added a note to the documentation: https://github.com/rogerwang/node-webkit/wiki/MenuItem#menuitemkey |
Great, thanks! |
It should not be closed because the String.fromCharCode workaround does not works with all keys. As I previously said, for example Function keys (F1 to F12) and Home/End cannot be mapped this way. The issue with thoose keys is that the character code to display the shortcut in the menu is not equals to the keyboard code. So the key attribute should be splitted in keyCode and charCode and should accept multiple bytes. |
So this issue should be reopened |
@tommor or @rogerwang can you please reopen this issue. I added a note to the documentation with a partial workaround but the issue is not fixed and there is no fully working workaround. |
@felicienfrancois just a side note, tommor =/= tommoor, got a notification to an issue i dont take part in ;p. But from what i know in C++ you should use extended ascii codes (IBM PC Keyboard Scan Codes) for function keys that is an array of two rather than one. For expample F1 is (00,59). |
Sorry @tommor for the mistake. I tried to use arrays but it does not work. It seems Additionally, the main issue here is that this parameter is both used for key mapping AND to display the shortcut in the window menu. It works for alphanumeric character (key mapping code = char code to display) but it does not work for some special characters (like tab, backspace) and for array key codes ((00,59) VS "F1"). Thank you anyway for your help ;-) |
Hi guys, The following is not working (tested with 0.11.5 win32):
and for comparison, this one is working:
Best regards |
The MenuItem.key option accepts only a char.
It would be very useful to be able to map non alphanumeric keys:
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: