dojox/drawing/manager/keys (version 1.10)

Summary

A singleton, master object that detects keyboard keys and events Connect to it like:

dojo.connect(this.keys, "onEnter", ....);

Property Summary

  • altIndicates whether the Alt or Option key is currently pressed
  • arrowIncrementThe amount, in pixels, a selected Stencil will move on an arrow key event
  • arrowShiftIncrementThe amount, in pixels, a selected Stencil will move on an arrow key + SHIFT event
  • cmmdIndicates whether the Apple Command key is currently pressed
  • ctrlIndicates whether the Control key is currently pressed
  • listeners
  • metaIndicates whether any 'meta' key is currently pressed: shift || ctrl || cmd || alt
  • shiftIndicates whether the Shift key is currently pressed

Method Summary

  • _getLetter(evt)
  • _mixin(evt) Internal.
  • editMode(_isedit) Relinquishes control of events to another portion of Drawing; namely the TextBlock.
  • enable(_enabled) Enables or disables key events, to relinquish control to something outside of Drawing; input fields for example.
  • init() Initialize the keys object
  • register(options) Register an object and callback to be notified of events.
  • scanForFields() Scans the document for inputs and calls this automatically.

Event Summary

  • onArrow(evt) Event fires when an Arrow key is released You will have to further check if evt.keyCode is 37,38,39, or 40
  • onDelete(evt) Event fires when Delete key is released
  • onEnter(evt) Event fires when Enter key is released
  • onEsc(evt) Event fires when ESC key is released
  • onKeyDown(evt) Event fires when any key is pressed
  • onKeyUp(evt) Event fires when any key is released

Properties

alt

Indicates whether the Alt or Option key is currently pressed

arrowIncrement

The amount, in pixels, a selected Stencil will move on an arrow key event

arrowShiftIncrement

The amount, in pixels, a selected Stencil will move on an arrow key + SHIFT event

cmmd

Indicates whether the Apple Command key is currently pressed

ctrl

Indicates whether the Control key is currently pressed

listeners
meta

Indicates whether any 'meta' key is currently pressed: shift || ctrl || cmd || alt

shift

Indicates whether the Shift key is currently pressed

Methods

_getLetter(evt)
Parameter Type Description
evt undefined
Returns:undefined | null
_mixin(evt)

Internal. Mixes in key events.

Parameter Type Description
evt undefined
Returns:undefined
editMode(_isedit)

Relinquishes control of events to another portion of Drawing; namely the TextBlock.

Parameter Type Description
_isedit undefined
enable(_enabled)

Enables or disables key events, to relinquish control to something outside of Drawing; input fields for example. You may need to call this directly if you are using textareas or contenteditables. NOTE: See scanForFields

Parameter Type Description
_enabled undefined
init()

Initialize the keys object

register(options)

Register an object and callback to be notified of events. NOTE: Not really used in code, but should work. See manager.mouse for similar usage

Parameter Type Description
options undefined
scanForFields()

Scans the document for inputs and calls this automatically. However you may need to call this if you create inputs after the fact.

Events

onArrow(evt)

Event fires when an Arrow key is released You will have to further check if evt.keyCode is 37,38,39, or 40

Parameter Type Description
evt Event
onDelete(evt)

Event fires when Delete key is released

Parameter Type Description
evt Event
onEnter(evt)

Event fires when Enter key is released

Parameter Type Description
evt Event
onEsc(evt)

Event fires when ESC key is released

Parameter Type Description
evt Event
onKeyDown(evt)

Event fires when any key is pressed

Parameter Type Description
evt Event
onKeyUp(evt)

Event fires when any key is released

Parameter Type Description
evt Event
Error in the documentation? Can’t find what you are looking for? Let us know!