📄 radiobuttontest.xml
字号:
<?xml version="1.0" encoding="UTF-8"?><Application> <Window caption="Radio Button Test" width="318" height="336" centered="true" resizable="true" fullScreen="false"> </Window> <Resources> <Script><![CDATA[function RadioButtonTest() { var win = application.getWindow(); var rg = new BiRadioGroup(); var rb = new BiRadioButton("Vanilla"); rb.setName("vanilla"); rb.setMnemonic("v"); rb.setAccessKey("v"); rb.setLocation(5, 5); win.add(rb); var rb2 = new BiRadioButton("Chocolate", true); rb2.setName("chocolate"); rb2.setMnemonic("c"); rb2.setAccessKey("c"); rb2.setLocation(5, rb.getTop() + rb.getHeight() + 5); win.add(rb2); var rb3 = new BiRadioButton("Strawberry"); rb3.setName("strawberry"); rb3.setMnemonic("s"); rb3.setAccessKey("s"); rb3.setLocation(5, rb2.getTop() + rb2.getHeight() + 5); win.add(rb3); var rb4 = new BiRadioButton("Banana"); rb4.setName("banana"); rb4.setMnemonic("b"); rb4.setAccessKey("b"); rb4.setLocation(5, rb3.getTop() + rb3.getHeight() + 5); //rb4.setGroup(rg); rb3.setEnabled(false); win.add(rb4); var out = new BiLabel; out.setTabIndex(2); out.setBorder(new BiBorder(1, "solid", "ThreeDDarkShadow")); out.setBackColor("window"); out.setOverflow("auto"); out.setPadding(2); out.setLocation(5, rb4.getTop() + rb4.getHeight() + 5); //out.setSize(300, 200); out.setRight(5); out.setBottom(5); win.add(out); this._outLabel = out; rb.addEventListener("change", this.onRadioButtonChange, this); rb2.addEventListener("change", this.onRadioButtonChange, this); rb3.addEventListener("change", this.onRadioButtonChange, this); rb4.addEventListener("change", this.onRadioButtonChange, this); rg.addEventListener("change", this.onRadioGroupChange, this); this.setWindowSize(); rb.setGroup(rg); rb2.setGroup(rg); rb3.setGroup(rg); rg.add(rb4);/* var m = new BiMenu; var mi = new BiMenuItem("Clear"); m.add(mi); mi.addEventListener("action", function (e) { out.setText(""); }); out.setContextMenu(m);*/}RadioButtonTest.prototype.onRadioButtonChange = function (e) { this.print(e.getTarget().getName() + " changed to " + e.getTarget().getChecked());};RadioButtonTest.prototype.onRadioGroupChange = function (e) { var r = e.getTarget().getSelected(); if (r) { this.print("<span style=\"color:red\">" + r.getName() + " is now selected</span>"); }};RadioButtonTest.prototype.setWindowSize = function () { var win = application.getWindow(); var lc = win.getLastChild(); win.setSize( lc.getLeft() + lc.getWidth() + 5 + win.getInsetLeft() + win.getInsetRight(), lc.getTop() + lc.getHeight() + 5 + win.getInsetTop() + win.getInsetBottom() );};RadioButtonTest.prototype.print = function (s) { this._outLabel.setHtml(this._outLabel.getHtml() + s + "<br>"); this._outLabel.setScrollTop(9999999);};RadioButtonTest.main = function () { new RadioButtonTest;}; ]]></Script> </Resources></Application>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -