<command>

An element that sends events in response to keyboard input.

JavaScript: LzCommand

Extends Node
<canvas height="130" debug="true">
  <command onselect="Debug.write('the enter key was pressed');" 
            key="['Enter']" />
</canvas>

Sample applications that use the <command> tag:

Also, see lzkeys.
Attributes
Name Usage Type (Tag) Type (JS) Default Category
active Tag & JS boolean Boolean   readonly
  true if the command is currently active. The default is true.

key Tag & JS expression Array of String   setter
  Use setAttribute or setKeys to set the group of keys associated with this command from JavaScript. For example: setAttribute('key', ['a', 'shift']) or setKeys(['j', 'control'])

keys JS only Array of String   readonly
  array of keys (strings) that, when pressed together, cause the onselect event of the command to be sent.

onselect Tag only script   eventhandler


Attributes inherited from Node

class, classroot, cloneManager, datapath, defaultplacement, id, ignoreAttribute, ignoreplacement, immediateparent, initstage, name, nodeLevel, onconstruct, oninit, parent, placement, subnodes


Methods

execute()
LzCommand.execute(d)

Sends the command's onselect event.

Parameters
Name Type Desc
d any this optional parameter is passed to the onselect event


keysToString()
LzCommand.keysToString()

This is a utility method that returns a string that describes the key combination that causes this command to be invoked.

Returns
Type Desc
String A string containing the key combination that causes this command to be invoked.


setKeys()
LzCommand.setKeys(k)

This registers the given key array so that the command is executed when the key array is pressed.

Parameters
Name Type Desc
k [String] An array of keys, given as strings.


Methods inherited from LzNode

animate, applyConstraint, applyData, childOf, completeInstantiation, construct, createChildren, dataBindAttribute, destroy, determinePlacement, getAttribute, getOption, getUID, init, lookupSourceLocator, searchImmediateSubnodes, searchSubnodes, setAttribute, setDatapath, setID, setName, setOption


Events
Name Description
onselect None

Events inherited from LzNode

onconstruct, ondata, oninit