📄 focustest.xml
字号:
<?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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -