Keystroke Handling"

From Documentation
Line 1: Line 1:
 
{{ZKDevelopersReferencePageHeader}}
 
{{ZKDevelopersReferencePageHeader}}
 +
 +
__TOC__
 +
 +
Keystroke handling is generic. Any component inherited from <javadoc>org.zkoss.zul.impl.XulElement</javadoc> can handle the key event in the same way.
  
 
=ENTER and ESC=
 
=ENTER and ESC=
 +
 +
To handle ENTER, you could listen to the onOK event (notice O and K are both in upper case). To handle ESC, you could listen to the onCancel event. For example,
 +
 +
<source lang="xml">
 +
<grid id="form" apply="foo.Login">
 +
    <rows>
 +
        <row>Username: <textbox id="username"/></row>
 +
        <row>Password: <textbox id="password" type="password"/></row>
 +
        <row><button label="Login" forward="form.onOK"/><button label="Reset" forward="form.onCancel"/></row>
 +
    </rows>
 +
</grid>
 +
</source>
 +
 
=Control Keys=
 
=Control Keys=
 
=Version History=
 
=Version History=

Revision as of 08:34, 21 December 2010


Keystroke Handling


Keystroke handling is generic. Any component inherited from XulElement can handle the key event in the same way.

ENTER and ESC

To handle ENTER, you could listen to the onOK event (notice O and K are both in upper case). To handle ESC, you could listen to the onCancel event. For example,

<grid id="form" apply="foo.Login">
    <rows>
        <row>Username: <textbox id="username"/></row>
        <row>Password: <textbox id="password" type="password"/></row>
        <row><button label="Login" forward="form.onOK"/><button label="Reset" forward="form.onCancel"/></row>
    </rows>
</grid>

Control Keys

Version History

Last Update : 2010/12/21


Version Date Content
     



Last Update : 2010/12/21

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.