<!-- saved from url=(0026)http://www.naturaldocs.org -->
<divid=Content><divclass="CClass"><divclass=CTopicid=MainTopic><h1class=CTitle><aname="mxDefaultKeyHandler"></a>mxDefaultKeyHandler</h1><divclass=CBody><p>Binds keycodes to actionnames in an editor. This aggregates an internal <ahref="#mxDefaultKeyHandler.handler"class=LVariableid=link12onMouseOver="ShowTip(event, 'tt5', 'link12')"onMouseOut="HideTip('tt5')">handler</a> and extends the implementation of <ahref="../handler/mxKeyHandler-js.html#mxKeyHandler.escape"class=LFunctionid=link13onMouseOver="ShowTip(event, 'tt9', 'link13')"onMouseOut="HideTip('tt9')">mxKeyHandler.escape</a> to not only cancel the editing, but also hide the properties dialog and fire an <mxEditor.escape> event via <ahref="#mxDefaultKeyHandler.editor"class=LVariableid=link14onMouseOver="ShowTip(event, 'tt4', 'link14')"onMouseOut="HideTip('tt4')">editor</a>. An instance of this class is created by <ahref="mxEditor-js.html#mxEditor"class=LClassid=link15onMouseOver="ShowTip(event, 'tt3', 'link15')"onMouseOut="HideTip('tt3')">mxEditor</a> and stored in <ahref="mxEditor-js.html#mxEditor.keyHandler"class=LVariableid=link16onMouseOver="ShowTip(event, 'tt10', 'link16')"onMouseOut="HideTip('tt10')">mxEditor.keyHandler</a>.</p><h4class=CHeading>Example</h4><p>Bind the delete key to the delete action in an existing editor.</p><blockquote><preclass="prettyprint">var keyHandler = new mxDefaultKeyHandler(editor);
keyHandler.bindAction(46, 'delete');</pre></blockquote><h4class=CHeading>Codec</h4><p>This class uses the <ahref="../io/mxDefaultKeyHandlerCodec-js.html#mxDefaultKeyHandlerCodec"class=LClassid=link17onMouseOver="ShowTip(event, 'tt11', 'link17')"onMouseOut="HideTip('tt11')">mxDefaultKeyHandlerCodec</a> to read configuration data into an existing instance. See <ahref="../io/mxDefaultKeyHandlerCodec-js.html#mxDefaultKeyHandlerCodec"class=LClassid=link18onMouseOver="ShowTip(event, 'tt11', 'link18')"onMouseOut="HideTip('tt11')">mxDefaultKeyHandlerCodec</a> for a description of the configuration format.</p><h4class=CHeading>Keycodes</h4><p>See <ahref="../handler/mxKeyHandler-js.html#mxKeyHandler"class=LClassid=link19onMouseOver="ShowTip(event, 'tt6', 'link19')"onMouseOut="HideTip('tt6')">mxKeyHandler</a>.</p><p>An <ahref="../util/mxEvent-js.html#mxEvent.ESCAPE"class=LVariableid=link20onMouseOver="ShowTip(event, 'tt12', 'link20')"onMouseOut="HideTip('tt12')">mxEvent.ESCAPE</a> event is fired via the editor if the escape key is pressed.</p><!--START_ND_SUMMARY--><divclass=Summary><divclass=STitle>Summary</div><divclass=SBorder><tableborder=0cellspacing=0cellpadding=0class=STable><trclass="SMain"><tdclass=SEntry><ahref="#mxDefaultKeyHandler">mxDefaultKeyHandler</a></td><tdclass=SDescription>Binds keycodes to actionnames in an editor. </td></tr><trclass="SGroup SIndent1"><tdclass=SEntry><ahref="#mxDefaultKeyHandler.Functions">Functions</a></td><tdclass=SDescription></td></tr><trclass="SFunction SIndent2 SMarked"><tdclass=SEntry><ahref="#mxDefaultKeyHandler.mxDefaultKeyHandler"id=link1onMouseOver="ShowTip(event, 'tt1', 'link1')"onMouseOut="HideTip('tt1')">mxDefaultKeyHandler</a></td><tdclass=SDescription>Constructs a new default key handler for the <ahref="mxEditor-js.html#mxEditor.graph"class=LVariableid=link2onMouseOver="ShowTip(event, 'tt2', 'link2')"onMouseOut="HideTip('tt2')">mxEditor.graph</a> in the given <ahref="mxEditor-js.html#mxEditor"class=LClassid=link3onMouseOver="ShowTip(event, 'tt3', 'link3')"onMouseOut="HideTip('tt3')">mxEditor</a>. </td></tr><trclass="SGroup SIndent1"><tdclass=SEntry><ahref="#mxDefaultKeyHandler.Variables">Variables</a></td><tdclass=SDescription></td></tr><trclass="SVariable SIndent2 SMarked"><tdclass=SEntry><ahref="#mxDefaultKeyHandler.editor"id=link4onMouseOver="ShowTip(event, 'tt4', 'link4')"onMouseOut="HideTip('tt4')">editor</a></td><tdclass=SDescription>Reference to the enclosing <ahref="mxEditor-js.html#mxEditor"class=LClassid=link5onMouseOver="ShowTip(event, 'tt3', 'link5')"onMouseOut="HideTip('tt3')">mxEditor</a>.</td></tr><trclass="SVariable SIndent2"><tdclass=SEntry><ahref="#mxDefaultKeyHandler.handler"id=link6onMouseOver="ShowTip(event, 'tt5', 'link6')"onMouseOut="HideTip('tt5')">handler</a></td><tdclass=SDescription>Holds the <ahref="../handler/mxKeyHandler-js.html#mxKeyHandler"class=LClassid=link7onMouseOver="ShowTip(event, 'tt6', 'link7')"onMouseOut="HideTip('tt6')">mxKeyHandler</a> for key event handling.</td></tr><trclass="SGroup SIndent1"><tdclass=SEntry><ahref="#mxDefaultKeyHandler.Functions">Functions</a></td><tdclass=SDescription></td></tr><trclass="SFunction SIndent2 SMarked"><tdclass=SEntry><ahref="#mxDefaultKeyHandler.bindAction"id=link8onMouseOver="ShowTip(event, 'tt7', 'link8')"onMouseOut="HideTip('tt7')">bindAction</a></td><tdclass=SDescription>Binds the specified keycode to the given action in <ahref="#mxDefaultKeyHandler.editor"class=LVariableid=link9onMouseOver="ShowTip(event, 'tt4', 'link9')"onMouseOut="HideTip('tt4')">editor</a>. </td></tr><trclass="SFunction SIndent2"><tdclass=SEntry><ahref="#mxDefaultKeyHandler.destroy"id=link10onMouseOver="ShowTip(event, 'tt8', 'link10')"onMouseOut="HideTip('tt8')">destroy</a></td><tdclass=SDescription>Destroys the <ahref="#mxDefaultKeyHandler.handler"class=LVariableid=link11onMouseOver="ShowTip(event, 'tt5', 'link11')"onMouseOut="HideTip('tt5')">handler</a> associated with this object. </td></tr></table></div><
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxDefaultKeyHandler.mxDefaultKeyHandler"></a>mxDefaultKeyHandler</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function mxDefaultKeyHandler(</td><tdclass=PParameternowrap>editor</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Constructs a new default key handler for the <ahref="mxEditor-js.html#mxEditor.graph"class=LVariableid=link21onMouseOver="ShowTip(event, 'tt2', 'link21')"onMouseOut="HideTip('tt2')">mxEditor.graph</a> in the given <ahref="mxEditor-js.html#mxEditor"class=LClassid=link22onMouseOver="ShowTip(event, 'tt3', 'link22')"onMouseOut="HideTip('tt3')">mxEditor</a>. (The editor may be null if a prototypical instance for a <ahref="../io/mxDefaultKeyHandlerCodec-js.html#mxDefaultKeyHandlerCodec"class=LClassid=link23onMouseOver="ShowTip(event, 'tt11', 'link23')"onMouseOut="HideTip('tt11')">mxDefaultKeyHandlerCodec</a> is created.)</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>editor</td><tdclass=CDLDescription>Reference to the enclosing <ahref="mxEditor-js.html#mxEditor"class=LClassid=link24onMouseOver="ShowTip(event, 'tt3', 'link24')"onMouseOut="HideTip('tt3')">mxEditor</a>.</td></tr></table></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxDefaultKeyHandler.editor"></a>editor</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>mxDefaultKeyHandler.prototype.editor</td></tr></table></blockquote><p>Reference to the enclosing <ahref="mxEditor-js.html#mxEditor"class=LClassid=link25onMouseOver="ShowTip(event, 'tt3', 'link25')"onMouseOut="HideTip('tt3')">mxEditor</a>.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxDefaultKeyHandler.handler"></a>handler</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>mxDefaultKeyHandler.prototype.handler</td></tr></table></blockquote><p>Holds the <ahref="../handler/mxKeyHandler-js.html#mxKeyHandler"class=LClassid=link26onMouseOver="ShowTip(event, 'tt6', 'link26')"onMouseOut="HideTip('tt6')">mxKeyHandler</a> for key event handling.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxDefaultKeyHandler.bindAction"></a>bindAction</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>mxDefaultKeyHandler.prototype.bindAction = function (</td><tdclass=PParameternowrap>code,</td></tr><tr><td></td><tdclass=PParameternowrap>action,</td></tr><tr><td></td><tdclass=PParameternowrap>control</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Binds the specified keycode to the given action in <ahref="#mxDefaultKeyHandler.editor"class=LVariableid=link27onMouseOver="ShowTip(event, 'tt4', 'link27')"onMouseOut="HideTip('tt4')">editor</a>. The optional control flag specifies if the control key must be pressed to trigger the action.</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>action</td><tdclass=CDLDescription>Name of the action to execute in <ahref="#mxDefaultKeyHandler.editor"class=LVariableid=link28onMouseOver="ShowTip(event, 'tt4', 'link28')"onMouseOut="HideTip('tt4')">editor</a>.</td></tr><tr><tdclass=CDLEntry>control</td><tdclass=CDLDescription>Optional boolean that specifies if control must be pressed. Default is false.</td></tr></table></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxDefaultKeyHandler.destroy"></a>destroy</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>mxDefaultKeyHandler.prototype.destroy = function ()</td></tr></table></blockquote><p>Destroys the <ahref="#mxDefaultKeyHandler.handler"class=LVariableid=link29onMouseOver="ShowTip(event, 'tt5', 'link29')"onMouseOut="HideTip('tt5')">handler</a> associated with this object. This does normally not need to be called, the <ahref="#mxDefaultKeyHandler.handler"class=LVariableid=link30onMouseOver="ShowTip(event, 'tt5', 'link30')"onMouseOut="HideTip('tt5')">handler</a> is destroyed automatically when the window unloads (in IE) by <ahref="mxEditor-js.html#mxEditor"class=LClassid=link31onMouseOver="ShowTip(event, 'tt3', 'link31')"onMouseOut="HideTip('tt3')">mxEditor</a>.</p></div></div></div>
</div><!--Content-->
<divid=Footer><ahref="http://www.naturaldocs.org">Generated by Natural Docs</a></div><!--Footer-->
<divclass=CToolTipid="tt1"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function mxDefaultKeyHandler(</td><tdclass=PParameternowrap>editor</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote>Constructs a new default key handler for the mxEditor.graph in the given mxEditor. </div></div><divclass=CToolTipid="tt2"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>mxEditor.prototype.graph</td></tr></table></blockquote>Holds a mxGraph for displaying the diagram. </div></div><divclass=CToolTipid="tt3"><divclass=CClass>Extends mxEventSource to implement a application wrapper for a graph that adds actions, I/O using mxCodec, auto-layout using mxLayoutManager, command history using undoManager, and standard dialogs and widgets, eg. </div></div><divclass=CToolTipid="tt4"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>mxDefaultKeyHandler.prototype.editor</td></tr></table></blockquote>Reference to the enclosing mxEditor.</div></div><divclass=CToolTipid="tt5"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>mxDefaultKeyHandler.prototype.handler</td></tr></table></blockquote>Holds the mxKeyHandler for key event handling.</div></div><divclass=CToolTipid="tt6"><divclass=CClass>Event handler that listens to keystroke events. </div></div><divclass=CToolTipid="tt7"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>mxDefaultKeyHandler.prototype.bindAction = function (</td><tdclass=PParameternowrap>code,</td></tr><tr><td></td><tdclass=PParameternowrap>action,</td></tr><tr><td></td><tdclass=PParameternowrap>control</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote>Binds the specified keycode to the given action in editor. </div></div><divclass=CToolTipid="tt8"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>mxDefaultKeyHandler.prototype.destroy = function ()</td></tr></table></blockquote>Destroys the handler associated with this object. </div></div><divclass=CToolTipid="tt9"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>mxKeyHandler.prototype.escape = function(</td><tdclass=PParameternowrap>evt</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote>Hook to process ESCAPE keystrokes. </div></div><divclass=CToolTipid="tt10"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>mxEditor.prototype.keyHandler</td></tr></table></blockquote>Holds a mxDefaultKeyHandler for handling keyboard events. </div></div><divclass=CToolTipid="tt11"><divclass=CClass>Custom codec for configuring mxDefaultKeyHandlers. </div></div><divclass=CToolTipid="tt12"><divclass=CVariable>Specifies the event name for escape.</div></div><!--END_ND_TOOLTIPS-->