<command>
An element that sends events in response to keyboard input.

JavaScript: lz.command
extends <node> » lz.Eventable »
<canvas height="130" debug="true">
            <command onselect="Debug.debug('the enter key was pressed');" key="['Enter']"/>
            
            </canvas>

Sample applications that use the <command> tag:

Also, see lz.KeysService.LzKeys.

Attributes

Name (CSS property) Type (tag) Type (js) Default Category
active boolean Boolean true read/write
  true if the command is currently active. The default is true.
keys expression [String] null read/write
  array of keys (strings) that, when pressed together, cause the onselect event of the command to be sent. For example: setAttribute('key', ['a', 'shift'])

Class Attributes

Name (CSS property) Type (tag) Type (js) Default Category
DisplayKeys expression Dictionary {control:'Ctrl', shift:'Shift', alt:'Alt'} readonly
  Mapping from key names to display strings used by keysToString

Methods

execute()
command.execute(d : any);
Sends the command's onselect event.
Parameter Name Type Description
d any this optional parameter is passed to the onselect event

keysToString()
command.keysToString();
This is a utility method that returns a string that describes the key combination that causes this command to be invoked.
Returns Type Description
  String A string containing the key combination that causes this command to be invoked.

setKeys()
command.setKeys(k : [String]);
[Caution] This method is deprecated
Use setAttribute('key', ...) instead.
This registers the given key array so that the command is executed when the key array is pressed.
Parameter Name Type Description
k [String] An array of keys, given as strings.

Methods inherited from lz.Eventable

destroy, setAttribute

Events

Name Description
onselect If the command is active, this event is sent when the keys array are pressed simultaneously.

Events inherited from <node>

onconstruct, ondata, oninit

Events inherited from lz.Eventable

ondestroy