<divid=Content><divclass="CClass"><divclass=CTopicid=MainTopic><h1class=CTitle><aname="mxKeyHandler"></a>mxKeyHandler</h1><divclass=CBody><p>Event handler that listens to keystroke events. This is not a singleton, however, it is normally only required once if the target is the document element (default).</p><p>This handler installs a key event listener in the topmost DOM node and processes all events that originate from descandants of <mxGraph.container> or from the topmost DOM node. The latter means that all unhandled keystrokes are handled by this object regardless of the focused state of the <ahref="#mxKeyHandler.graph"class=LVariableid=link30onMouseOver="ShowTip(event, 'tt2', 'link30')"onMouseOut="HideTip('tt2')">graph</a>.</p><h4class=CHeading>Example</h4><p>The following example creates a key handler that listens to the delete key (46) and deletes the selection cells if the graph is enabled.</p><blockquote><preclass="prettyprint">var keyHandler = new mxKeyHandler(graph);
});</pre></blockquote><h4class=CHeading>Keycodes</h4><p>See <ahref="http://tinyurl.com/yp8jgl"class=LURLtarget=_top>http://tinyurl.com/yp8jgl</a> or <ahref="http://tinyurl.com/229yqw"class=LURLtarget=_top>http://tinyurl.com/229yqw</a> for a list of keycodes or install a key event listener into the document element and print the key codes of the respective events to the console.</p><p>To support the Command key and the Control key on the Mac, the following code can be used.</p><blockquote><preclass="prettyprint">keyHandler.getFunction = function(evt)
};</pre></blockquote><!--START_ND_SUMMARY--><divclass=Summary><divclass=STitle>Summary</div><divclass=SBorder><tableborder=0cellspacing=0cellpadding=0class=STable><trclass="SMain"><tdclass=SEntry><ahref="#mxKeyHandler">mxKeyHandler</a></td><tdclass=SDescription>Event handler that listens to keystroke events. </td></tr><trclass="SGroup SIndent1"><tdclass=SEntry><ahref="#mxKeyHandler.Functions">Functions</a></td><tdclass=SDescription></td></tr><trclass="SFunction SIndent2 SMarked"><tdclass=SEntry><ahref="#mxKeyHandler.mxKeyHandler"id=link1onMouseOver="ShowTip(event, 'tt1', 'link1')"onMouseOut="HideTip('tt1')">mxKeyHandler</a></td><tdclass=SDescription>Constructs an event handler that executes functions bound to specific keystrokes.</td></tr><trclass="SGroup SIndent1"><tdclass=SEntry><ahref="#mxKeyHandler.Variables">Variables</a></td><tdclass=SDescription></td></tr><trclass="SVariable SIndent2 SMarked"><tdclass=SEntry><ahref="#mxKeyHandler.graph"id=link2onMouseOver="ShowTip(event, 'tt2', 'link2')"onMouseOut="HideTip('tt2')">graph</a></td><tdclass=SDescription>Reference to the <ahref="../view/mxGraph-js.html#mxGraph"class=LClassid=link3onMouseOver="ShowTip(event, 'tt3', 'link3')"onMouseOut="HideTip('tt3')">mxGraph</a> associated with this handler.</td></tr><trclass="SVariable SIndent2"><tdclass=SEntry><ahref="#mxKeyHandler.target"id=link4onMouseOver="ShowTip(event, 'tt4', 'link4')"onMouseOut="HideTip('tt4')">target</a></td><tdclass=SDescription>Reference to the target DOM, that is, the DOM node where the key event listeners are installed.</td></tr><trclass="SVariable SIndent2 SMarked"><tdclass=SEntry><ahref="#mxKeyHandler.normalKeys"id=link5onMouseOver="ShowTip(event, 'tt5', 'link5')"onMouseOut="HideTip('tt5')">normalKeys</a></td><tdclass=SDescription>Maps from keycodes to functions for non-pressed control keys.</td></tr><trclass="SVariable SIndent2"><tdclass=SEntry><ahref="#mxKeyHandler.shiftKeys"id=link6onMouseOver="ShowTip(event, 'tt6', 'link6')"onMouseOut="HideTip('tt6')">shiftKeys</a></td><tdclass=SDescription>Maps from keycodes to functions for pressed shift keys.</td></tr><trclass="SVariable SIndent2 SMarked"><tdclass=SEntry><ahref="#mxKeyHandler.controlKeys"id=link7onMouseOver="ShowTip(event, 'tt7', 'link7')"onMouseOut="HideTip('tt7')">controlKeys</a></td><tdclass=SDescription>Maps from keycodes to functions for pressed control keys.</td></tr><trclass="SVariable SIndent2"><tdclass=SEntry><ahref="#mxKeyHandler.controlShiftKeys"id=link8onMouseOver="ShowTip(event, 'tt8', 'link8')"onMouseOut="HideTip('tt8')">controlShiftKeys</a></td><tdclass=SDescription>Maps from keycodes to functions for pressed control and shift keys.</td></tr><trclass="SVariable SIndent2 SMarked"><tdclass=SEntry><ahref="#mxKeyHandler.enabled"id=link9onMouseOver="ShowTip(event, 'tt9', 'link9')"onMouseOut="HideTip('tt9')">enabled</a></td><tdclass=SDescription>Specifies if events are handled. </td></tr><trclass="SGroup SIndent1"><tdclass=SEntry><ahref="#mxKeyHandler.Functions">Functions</a></td><tdclass=SDescription></td></tr><trclass="SFunction SIndent2 SMarked"><tdclass=SEntry><ahref="#mxKeyHandler.isEnabled"id=link10onMouseOver="ShowTip(event, 'tt10', 'link10')"onMouseOut="HideTip('tt10')">isEnabled</a></td><tdclass=SDescription>Returns true if events are handled. </td></tr><trclass="SFunction SIndent2"><tdclass=SEntry><ahref="#mxKeyHandler.setEnabled"id=link11onMouseOver="ShowTip(event, 'tt11', 'link11')"onMouseOut="HideTip('tt11')">setEnabled</a></td><tdclass=SDescription>Enables or disables event handling by updating <ahref="#mxKeyHandler.enabled"class=LVariableid=link12onMouseOver="ShowTip(event, 'tt9', 'link12')"onMouseOut="HideTip('tt9')">enabled</a>.</td></tr><trclass="SFunction SIndent2 SMarked"><tdclass=SEntry><ahref="#mxKeyHandler.bindKey"id=link13onMouseOver="ShowTip(event, 'tt12', 'link13')"onMouseOut="HideTip('tt12')">bindKey</a></td><tdclass=SDescription>Binds the specified keycode to the given function. </td></tr><trclass
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxKeyHandler.mxKeyHandler"></a>mxKeyHandler</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass="PBeforeParameters prettyprint "nowrap>function mxKeyHandler(</td><tdclass="PParameter prettyprint "nowrap>graph,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>target</td><tdclass="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Constructs an event handler that executes functions bound to specific keystrokes.</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>graph</td><tdclass=CDLDescription>Reference to the associated <ahref="../view/mxGraph-js.html#mxGraph"class=LClassid=link31onMouseOver="ShowTip(event, 'tt3', 'link31')"onMouseOut="HideTip('tt3')">mxGraph</a>.</td></tr><tr><tdclass=CDLEntry>target</td><tdclass=CDLDescription>Optional reference to the event target. If null, the document element is used as the event target, that is, the object where the key event listener is installed.</td></tr></table></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxKeyHandler.graph"></a>graph</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxKeyHandler.prototype.graph</td></tr></table></blockquote><p>Reference to the <ahref="../view/mxGraph-js.html#mxGraph"class=LClassid=link32onMouseOver="ShowTip(event, 'tt3', 'link32')"onMouseOut="HideTip('tt3')">mxGraph</a> associated with this handler.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxKeyHandler.target"></a>target</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxKeyHandler.prototype.target</td></tr></table></blockquote><p>Reference to the target DOM, that is, the DOM node where the key event listeners are installed.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxKeyHandler.normalKeys"></a>normalKeys</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxKeyHandler.prototype.normalKeys</td></tr></table></blockquote><p>Maps from keycodes to functions for non-pressed control keys.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxKeyHandler.shiftKeys"></a>shiftKeys</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxKeyHandler.prototype.shiftKeys</td></tr></table></blockquote><p>Maps from keycodes to functions for pressed shift keys.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxKeyHandler.controlKeys"></a>controlKeys</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxKeyHandler.prototype.controlKeys</td></tr></table></blockquote><p>Maps from keycodes to functions for pressed control keys.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxKeyHandler.controlShiftKeys"></a>controlShiftKeys</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxKeyHandler.prototype.controlShiftKeys</td></tr></table></blockquote><p>Maps from keycodes to functions for pressed control and shift keys.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxKeyHandler.enabled"></a>enabled</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxKeyHandler.prototype.enabled</td></tr></table></blockquote><p>Specifies if events are handled. Default is true.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxKeyHandler.isEnabled"></a>isEnabled</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxKeyHandler.prototype.isEnabled = function()</td></tr></table></blockquote><p>Returns true if events are handled. This implementation returns <ahref="#mxKeyHandler.enabled"class=LVariableid=link33onMouseOver="ShowTip(event, 'tt9', 'link33')"onMouseOut="HideTip('tt9')">enabled</a>.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxKeyHandler.setEnabled"></a>setEnabled</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass="PBeforeParameters prettyprint "nowrap>mxKeyHandler.prototype.setEnabled = function(</td><tdclass="PParameter prettyprint "nowrap>enabled</td><tdclass="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Enables or disables event handling by updating <ahref="#mxKeyHandler.enabled"class=LVariableid=link34onMouseOver="ShowTip(event, 'tt9', 'link34')"onMouseOut="HideTip('tt9')">enabled</a>.</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>enabled</td><tdclass=CDLDescription>Boolean that specifies the new enabled state.</td></tr></table></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxKeyHandler.bindKey"></a>bindKey</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass="PBeforeParameters prettyprint "nowrap>mxKeyHandler.prototype.bindKey = function(</td><tdclass="PParameter prettyprint "nowrap>code,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>funct</td><tdclass="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Binds the specified keycode to the given function. This binding is used if the control key is not pressed.</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>code</td><tdclass=CDLDescription>Integer that specifies the keycode.</td></tr><tr><tdclass=CDLEntry>funct</td><tdclass=CDLDescription>JavaScript function that takes the key event as an argument.</td></tr></table></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxKeyHandler.bindShiftKey"></a>bindShiftKey</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass="PBeforeParameters prettyprint "nowrap>mxKeyHandler.prototype.bindShiftKey = function(</td><tdclass="PParameter prettyprint "nowrap>code,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>funct</td><tdclass="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Binds the specified keycode to the given function. This binding is used if the shift key is pressed.</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>code</td><tdclass=CDLDescription>Integer that specifies the keycode.</td></tr><tr><tdclass=CDLEntry>funct</td><tdclass=CDLDescription>JavaScript function that takes the key event as an argument.</td></tr></table></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxKeyHandler.bindControlKey"></a>bindControlKey</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass="PBeforeParameters prettyprint "nowrap>mxKeyHandler.prototype.bindControlKey = function(</td><tdclass="PParameter prettyprint "nowrap>code,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>funct</td><tdclass="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Binds the specified keycode to the given function. This binding is used if the control key is pressed.</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>code</td><tdclass=CDLDescription>Integer that specifies the keycode.</td></tr><tr><tdclass=CDLEntry>funct</td><tdclass=CDLDescription>JavaScript function that takes the key event as an argument.</td></tr></table></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxKeyHandler.bindControlShiftKey"></a>bindControlShiftKey</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass="PBeforeParameters prettyprint "nowrap>mxKeyHandler.prototype.bindControlShiftKey = function(</td><tdclass="PParameter prettyprint "nowrap>code,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>funct</td><tdclass="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Binds the specified keycode to the given function. This binding is used if the control and shift key are pressed.</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>code</td><tdclass=CDLDescription>Integer that specifies the keycode.</td></tr><tr><tdclass=CDLEntry>funct</td><tdclass=CDLDescription>JavaScript function that takes the key event as an argument.</td></tr></table></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxKeyHandler.isControlDown"></a>isControlDown</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass="PBeforeParameters prettyprint "nowrap>mxKeyHandler.prototype.isControlDown = function(</td><tdclass="PParameter prettyprint "nowrap>evt</td><tdclass="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Returns true if the control key is pressed. This uses <ahref="../util/mxEvent-js.html#mxEvent.isControlDown"class=LFunctionid=link35onMouseOver="ShowTip(event, 'tt25', 'link35')"onMouseOut="HideTip('tt25')">mxEvent.isControlDown</a>.</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>evt</td><tdclass=CDLDescription>Key event whose control key pressed state should be returned.</td></tr></table></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxKeyHandler.getFunction"></a>getFunction</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass="PBeforeParameters prettyprint "nowrap>mxKeyHandler.prototype.getFunction = function(</td><tdclass="PParameter prettyprint "nowrap>evt</td><tdclass="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Returns the function associated with the given key event or null if no function is associated with the given event.</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>evt</td><tdclass=CDLDescription>Key event whose associated function should be returned.</td></tr></table></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxKeyHandler.isGraphEvent"></a>isGraphEvent</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass="PBeforeParameters prettyprint "nowrap>mxKeyHandler.prototype.isGraphEvent = function(</td><tdclass="PParameter prettyprint "nowrap>evt</td><tdclass="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Returns true if the event should be processed by this handler, that is, if the event source is either the target, one of its direct children, a descendant of the <mxGraph.container>, or the <ahref="../view/mxGraph-js.html#mxGraph.cellEditor"class=LVariableid=link36onMouseOver="ShowTip(event, 'tt19', 'link36')"onMouseOut="HideTip('tt19')">mxGraph.cellEditor</a> of the <ahref="#mxKeyHandler.graph"class=LVariableid=link37onMouseOver="ShowTip(event, 'tt2', 'link37')"onMouseOut="HideTip('tt2')">graph</a>.</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>evt</td><tdclass=CDLDescription>Key event that represents the keystroke.</td></tr></table></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxKeyHandler.keyDown"></a>keyDown</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass="PBeforeParameters prettyprint "nowrap>mxKeyHandler.prototype.keyDown = function(</td><tdclass="PParameter prettyprint "nowrap>evt</td><tdclass="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Handles the event by invoking the function bound to the respective keystroke if <ahref="#mxKeyHandler.isEnabledForEvent"class=LFunctionid=link38onMouseOver="ShowTip(event, 'tt21', 'link38')"onMouseOut="HideTip('tt21')">isEnabledForEvent</a> returns true for the given event and if <ahref="#mxKeyHandler.isEventIgnored"class=LFunctionid=link39onMouseOver="ShowTip(event, 'tt22', 'link39')"onMouseOut="HideTip('tt22')">isEventIgnored</a> returns false, except for escape for which <ahref="#mxKeyHandler.isEventIgnored"class=LFunctionid=link40onMouseOver="ShowTip(event, 'tt22', 'link40')"onMouseOut="HideTip('tt22')">isEventIgnored</a> is not invoked.</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>evt</td><tdclass=CDLDescription>Key event that represents the keystroke.</td></tr></table></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxKeyHandler.isEnabledForEvent"></a>isEnabledForEvent</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass="PBeforeParameters prettyprint "nowrap>mxKeyHandler.prototype.isEnabledForEvent = function(</td><tdclass="PParameter prettyprint "nowrap>evt</td><tdclass="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Returns true if the given event should be handled. <ahref="#mxKeyHandler.isEventIgnored"class=LFunctionid=link41onMouseOver="ShowTip(event, 'tt22', 'link41')"onMouseOut="HideTip('tt22')">isEventIgnored</a> is called later if the event is not an escape key stroke, in which case <ahref="#mxKeyHandler.escape"class=LFunctionid=link42onMouseOver="ShowTip(event, 'tt23', 'link42')"onMouseOut="HideTip('tt23')">escape</a> is called. This implementation returns true if <ahref="#mxKeyHandler.isEnabled"class=LFunctionid=link43onMouseOver="ShowTip(event, 'tt10', 'link43')"onMouseOut="HideTip('tt10')">isEnabled</a> returns true for both, this handler and <ahref="#mxKeyHandler.graph"class=LVariableid=link44onMouseOver="ShowTip(event, 'tt2', 'link44')"onMouseOut="HideTip('tt2')">graph</a>, if the event is not consumed and if <ahref="#mxKeyHandler.isGraphEvent"class=LFunctionid=link45onMouseOver="ShowTip(event, 'tt18', 'link45')"onMouseOut="HideTip('tt18')">isGraphEvent</a> returns true.</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>evt</td><tdclass=CDLDescription>Key event that represents the keystroke.</td></tr></table></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxKeyHandler.isEventIgnored"></a>isEventIgnored</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass="PBeforeParameters prettyprint "nowrap>mxKeyHandler.prototype.isEventIgnored = function(</td><tdclass="PParameter prettyprint "nowrap>evt</td><tdclass="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Returns true if the given keystroke should be ignored. This returns graph.isEditing().</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>evt</td><tdclass=CDLDescription>Key event that represents the keystroke.</td></tr></table></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxKeyHandler.escape"></a>escape</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass="PBeforeParameters prettyprint "nowrap>mxKeyHandler.prototype.escape = function(</td><tdclass="PParameter prettyprint "nowrap>evt</td><tdclass="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Hook to process ESCAPE keystrokes. This implementation invokes <ahref="../view/mxGraph-js.html#mxGraph.stopEditing"class=LFunctionid=link46onMouseOver="ShowTip(event, 'tt26', 'link46')"onMouseOut="HideTip('tt26')">mxGraph.stopEditing</a> to cancel the current editing, connecting and/or other ongoing modifications.</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>evt</td><tdclass=CDLDescription>Key event that represents the keystroke. Possible keycode in this case is 27 (ESCAPE).</td></tr></table></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxKeyHandler.destroy"></a>destroy</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxKeyHandler.prototype.destroy = function()</td></tr></table></blockquote><p>Destroys the handler and all its references into the DOM. This does normally not need to be called, it is called automatically when the window unloads (in IE).</p></div></div></div>
<divclass=CToolTipid="tt1"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass="PBeforeParameters prettyprint "nowrap>function mxKeyHandler(</td><tdclass="PParameter prettyprint "nowrap>graph,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>target</td><tdclass="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Constructs an event handler that executes functions bound to specific keystrokes.</div></div><divclass=CToolTipid="tt2"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxKeyHandler.prototype.graph</td></tr></table></blockquote>Reference to the mxGraph associated with this handler.</div></div><divclass=CToolTipid="tt3"><divclass=CClass>Extends mxEventSource to implement a graph component for the browser. </div></div><divclass=CToolTipid="tt4"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxKeyHandler.prototype.target</td></tr></table></blockquote>Reference to the target DOM, that is, the DOM node where the key event listeners are installed.</div></div><divclass=CToolTipid="tt5"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxKeyHandler.prototype.normalKeys</td></tr></table></blockquote>Maps from keycodes to functions for non-pressed control keys.</div></div><divclass=CToolTipid="tt6"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxKeyHandler.prototype.shiftKeys</td></tr></table></blockquote>Maps from keycodes to functions for pressed shift keys.</div></div><divclass=CToolTipid="tt7"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxKeyHandler.prototype.controlKeys</td></tr></table></blockquote>Maps from keycodes to functions for pressed control keys.</div></div><divclass=CToolTipid="tt8"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxKeyHandler.prototype.controlShiftKeys</td></tr></table></blockquote>Maps from keycodes to functions for pressed control and shift keys.</div></div><divclass=CToolTipid="tt9"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxKeyHandler.prototype.enabled</td></tr></table></blockquote>Specifies if events are handled. </div></div><divclass=CToolTipid="tt10"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxKeyHandler.prototype.isEnabled = function()</td></tr></table></blockquote>Returns true if events are handled. </div></div><divclass=CToolTipid="tt11"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass="PBeforeParameters prettyprint "nowrap>mxKeyHandler.prototype.setEnabled = function(</td><tdclass="PParameter prettyprint "nowrap>enabled</td><tdclass="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Enables or disables event handling by updating enabled.</div></div><divclass=CToolTipid="tt12"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass="PBeforeParameters prettyprint "nowrap>mxKeyHandler.prototype.bindKey = function(</td><tdclass="PParameter prettyprint "nowrap>code,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>funct</td><tdclass="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Binds the specified keycode to the given function. </div></div><divclass=CToolTipid="tt13"><