Class zebkit.ui.event.ShortcutManager
extends <zebkit.ui.event.Manager>

Shortcut manager supports short cut (keys) definition and listening. The shortcuts have to be defined in zebkit JSON configuration files. There are two sections:

  • osx to keep shortcuts for Mac OS X platform
  • common to keep shortcuts for all other platforms

The JSON configuration entity has simple structure:

{ "common": { "UNDO": "Control + KeyZ", "REDO": "Control + Shift + KeyZ", ... }, "osx" : { "UNDO": "MetaLeft + KeyZ", ... } }

The configuration contains list of shortcuts. Every shortcut is bound to a key combination that triggers it. Shortcut has a name and an optional list of arguments that have to be passed to a shortcut listener method. The optional arguments can be used to differentiate two shortcuts that are bound to the same command.

On the component level shortcut can be listened by implementing "shortcutFired(e)" listener handler. Pay attention to catch shortcut your component has to be focusable - be able to hold focus. For instance, to catch "UNDO" shortcut do the following:

var pan = new zebkit.ui.Panel([
    function shortcutFired(e) {
        // handle shortcut here
        if (e.shortcut === "UNDO") {


    // visualize the component gets focus
    function focused() {

// let our panel to hold focus by setting appropriate property
pan.canHaveFocus = true;
zebkit.ui.event.ShortcutManager ( )

public void keyPressed (e)

Key pressed event handler.

public void setShortcuts (shortcuts)

Set shortcuts. Expected shortcuts format is:

 { "<ID>"  : "Control + KeyZ", ... }


  { "<ID>"  :  ["Control + KeyZ", "Control + KeyV" ], ... }

  • shortcuts <Shortcuts>