keystroke.zul

来自「ZK是一个Ajax Java Web框架」· ZUL 代码 · 共 81 行

ZUL
81
字号
<?xml version="1.0" encoding="UTF-8"?><!--keystroke.zul{{IS_NOTE	Purpose:			Description:			History:		Tue Nov 18 15:40:31     2008, Created by jumperchen}}IS_NOTECopyright (C) 2008 Potix Corporation. All Rights Reserved.{{IS_RIGHT}}IS_RIGHT--><window id="demo" apply="org.zkoss.zkdemo.userguide.DemoWindowComposer">	<html><![CDATA[   		<h4>onOK, onCancel and onCtrlKey</h4>
   		<p>Special keypress event for ENTER, ESC, CTRL key are 
   		handled via three special event listeners, onOK, onCancel, and onCtrlKey respectivly. Note that function keys are deemed as CTRL keys.</p>
   		<p>Try to press "ENTER", "ESC", "CTRL+A", "F2" and see what happened.(Note that the focus must be inside the demo widow when pressing the key.)</p>	]]></html>	<separator/>	<tabbox width="100%" tabscroll="false">		<tabs>			<tab id="demoView" label="Demo"/>			<tab id="srcView" label="View Source"/>		</tabs>		<tabpanels>			<tabpanel>				<window id="view">				</window>			</tabpanel>						<tabpanel>				<panel>					<panelchildren>						<textbox id="codeView" class="code" rows="20" width="95%">			<attribute name="value"><![CDATA[<zk>
	<grid fixedLayout="true" width="400px">
		<rows>
			<row>
				Password
				<textbox id="inp" onOK="doOk()" onCancel="doCancel()" ctrlKeys="^a#f2" onCtrlKey="doCtrlKey()" type="password" value="123456789" width="150px" />
			</row>
		</rows>
	</grid>
	<zscript>{
		void doOk() {
			Messagebox.show("ENTER key is pressed", "OK", Messagebox.OK, Messagebox.EXCLAMATION);
			inp.focus();
		}
		void doCancel() {
			Messagebox.show("ESC key is pressed", "CANCEL", Messagebox.OK, Messagebox.EXCLAMATION);
			inp.focus();
		}
		void doCtrlKey() {
			Messagebox.show(event.getKeyCode()+" is pressed", "CtrlKey", Messagebox.OK, Messagebox.EXCLAMATION);
			inp.focus();
		}
		inp.focus();
	}</zscript>
</zk>			]]></attribute>						</textbox>					</panelchildren>					<toolbar mold="panel">
						<button id="tryBtn" label="Try me!"/>						<button id="reloadBtn" label="Reload" height="18px"/>					</toolbar>				</panel>			</tabpanel>		</tabpanels>	</tabbox></window>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?