📄 preferredsizetest.xml
字号:
<Application> <Window caption="PreferredSize Test" width="300" height="200"/> <Resources> <Script><![CDATA[function PreferredSizeTest() { var win = application.getWindow(); var ta = new BiTextArea; var cb = new BiCheckBox("Word Wrap", true); var l = new BiLabel; var b = new BiButton("Windows Pref Size"); var fsb = new BiLabel(); // fake status bar this.l = l; this.ta = ta; this.fsb = fsb; win.add(ta); win.add(cb); win.add(l); win.add(b); win.add(fsb); ta.setLocation(5,5); ta.setRight(5); ta.setHeight(50); cb.setLocation(5, 60); cb.setRight(5); fsb.setBorder(new BiBorder(1, "inset")); fsb.setLeft(0); fsb.setRight(0); fsb.setBottom(0); b.setRight(5); b.setBottom(fsb.getBottom() + fsb.getHeight() + 5); l.setBackColor("ThreeDShadow"); l.setForeColor("ThreeDHighlight"); l.setLocation(5, cb.getTop() + cb.getHeight() + 5); l.setRight(5); l.setBottom(b.getBottom() + b.getHeight() + 5); l.setWrap(true); ta.addEventListener("textchanged", function () { l.setText(ta.getText()); this.setStatus(); }, this); cb.addEventListener("change", function () { l.setWrap( cb.getChecked() ); ta.setWrap( cb.getChecked() ); this.setStatus(); }, this); win.addEventListener("resize", this.setStatus, this); b.addEventListener("click", function () { alert(win.getPreferredWidth() + ", " + win.getPreferredHeight()); }); ta.setText("text area"); //win.pack();}PreferredSizeTest.prototype.setStatus = function () { this.fsb.setText( "label: (" + this.l.getPreferredWidth() + ", " + this.l.getPreferredHeight() + ")" + ", text area: (" + this.ta.getPreferredWidth() + ", " + this.ta.getPreferredHeight() + ")" );};PreferredSizeTest.main = function () { new PreferredSizeTest; }; ]]></Script> </Resources></Application>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -