focustest.xml

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

XML
98
字号
<?xml version="1.0"?><!--	This tests the focusin, focusout, focus and bour events--><application>	<window caption="Focus Test" width="300" height="500"/>	<resources>		<script><![CDATA[function FocusTest() {	var win = application.getWindow();	var tf = new BiTextField;	var pf = new BiPasswordField;	var out = new BiLabel;	var blurButton = new BiButton("Blur");	//tf.setHeight( 22 )	//pf.setHeight( 22 )	//tf.setTabIndex( 1 );	//pf.setTabIndex( 1 );	blurButton.setTabIndex(-1);	blurButton.setHideFocus( true );	out.setBorder(new BiBorder(1, "solid", "ThreeDDarkShadow"));	out.setBackColor("window");	out.setOverflow("auto");	out.setPadding(2);	out.setTabIndex(1);	//out.setCanSelect(true);	win.add(tf);	win.add(pf);	win.add(out);	win.add(blurButton);	tf.setLocation(5, 5);	tf.setRight(5);	pf.setLocation(5, tf.getTop() + tf.getHeight() + 5);	pf.setRight(blurButton.getWidth() + 10);	blurButton.setTop(tf.getTop() + tf.getHeight() + 5);	blurButton.setRight(5)	out.setLocation(5, pf.getTop() +pf.getHeight() + 5);	out.setRight(5);	out.setBottom(5);	tf.setText("text");	pf.setText("password");	tf.addEventListener("focus", this.onfocusevent, this);	tf.addEventListener("blur", this.onfocusevent, this);	tf.addEventListener("focusin", this.onfocusevent, this);	tf.addEventListener("focusout", this.onfocusevent, this);	pf.addEventListener("focus", this.onfocusevent, this);	pf.addEventListener("blur", this.onfocusevent, this);	pf.addEventListener("focusin", this.onfocusevent, this);	pf.addEventListener("focusout", this.onfocusevent, this);	blurButton.addEventListener("action", function (e) {		pf.setFocused(false);	});	this.out = out;/*	var m = new BiMenu;	var mi = new BiMenuItem("Clear");	m.add(mi);	mi.addEventListener("action", function (e) {		out.setText("");	});	out.setContextMenu(m);*/}FocusTest.prototype.onfocusevent = function (e) {	var s = "type: <b>" + e.getType() + "</b><br>" +		"target: " + e.getTarget() + "<br>" +		"relatedTarget: " + e.getRelatedTarget() + "<hr>";	this.out.setHtml(this.out.getHtml() + s);	this.out.setScrollTop(9999999);};FocusTest.main = function () { new FocusTest; };		]]></script>	</resources></application>

⌨️ 快捷键说明

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