defaultbuttontest.xml

来自「在流览器上仿CS界面的JAVASCRIPT脚本」· XML 代码 · 共 70 行

XML
70
字号
<?xml version="1.0"?><!--	This one tests the support for default button support for BiApplicationWindow	Pressing ESC should trigger the action on the cancelButton for the window	Pressing ENTER should trigger the action on the acceptButton for the window--><application>	<window caption="Default Button Test" width="400" height="470" centered="true"/>	<resources>		<script><![CDATA[function DefaultButtonTest() {	var win = application.getWindow();	var okButton = new BiButton("OK");	var cancelButton = new BiButton("Cancel");	var applyButton = new BiButton("Apply");	win.add(okButton);	win.add(cancelButton);	win.add(applyButton);	applyButton.setEnabled(false);	applyButton.setRight(5);	applyButton.setBottom(5);	applyButton.setWidth(75);	cancelButton.setRight(applyButton.getRight() + applyButton.getWidth() + 5);	cancelButton.setBottom(5);	cancelButton.setWidth(75);	okButton.setRight(cancelButton.getRight() + cancelButton.getWidth() + 5);	okButton.setBottom(5);	okButton.setWidth(75);	// event listeners	okButton.addEventListener("action", this.onAction, this);	cancelButton.addEventListener("action", this.onAction, this);	applyButton.addEventListener("action", this.onAction, this);	okButton._element.setAttribute("type", "submit");	win.setAcceptButton(okButton);	win.setCancelButton(cancelButton);	var textField = new BiTextField("Text field");	textField.setLocation(5, 5);	textField.setRight(5);	win.add(textField);	var textArea = new BiTextArea("Text area");	textArea.setLocation(5, textField.getTop() + textField.getHeight() + 5);	textArea.setRight(5);	win.add(textArea);}DefaultButtonTest.prototype.onAction = function (e) {	alert(e.getTarget().getText());};DefaultButtonTest.main = function () { new DefaultButtonTest(); };		]]></script>	</resources></application>

⌨️ 快捷键说明

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