locked
Custom Keyboard Shortcuts RRS feed

  • Question

  • How do I create custom keyboard shortcuts for my application?  I am designing a touch-first interface but I also want to make it keyboard friendly....

    www.emadibrahim.com

    Saturday, May 26, 2012 6:21 PM

Answers

  • Hi

    The Metro style app using JavaScript platform supports shortcut key functionality for setting focus or invoking elements, but you must implement shortcut keys in JavaScript by using keyboard event handlers.

    <script>
        var sendButton = document.getElementById('sendButton');
        sendButton.addEventListener('keyup', function(e) {
            var itm = e.srcElement;
            if (e.ctrlKey && e.keyCode === 83 ) {
                // Invoke send functionality.
            }
        });
    </script>

    Please refer to this link for more details.

    http://msdn.microsoft.com/en-us/library/windows/apps/hh700327.aspx

    Search: Keyboard shortcuts (optional)    to get the scenario.

    Hope it helpful.

    Thanks.

    • Proposed as answer by Dino He Monday, May 28, 2012 12:43 PM
    • Marked as answer by Dino He Friday, June 1, 2012 7:32 AM
    Monday, May 28, 2012 3:18 AM