📄 defaultbuttontest2.xml
字号:
<?xml version="1.0"?><!-- This one tests the support for default button support for BiWindow 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 2" width="400" height="470" centered="true"/> <Resources> <Script><![CDATA[function DefaultButtonTest2() { var appWin = application.getWindow(); var desktopPane = new BiDesktopPane; desktopPane.setLocation(0, 0); desktopPane.setRight(0); desktopPane.setBottom(0); appWin.add(desktopPane); var win = new BiWindow("Window with default Buttons"); win.setSize(300, 300); desktopPane.add(win); var cp = win.getContentPane(); var okButton = new BiButton("OK"); var cancelButton = new BiButton("Cancel"); var applyButton = new BiButton("Apply"); cp.add(okButton); cp.add(cancelButton); cp.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); cp.add(textField); var textArea = new BiTextArea("Text area"); textArea.setLocation(5, textField.getTop() + textField.getHeight() + 5); textArea.setRight(5); cp.add(textArea); textField.setFocused(true);}DefaultButtonTest2.prototype.onAction = function (e) { alert(e.getTarget().getText());};DefaultButtonTest2.main = function () { new DefaultButtonTest2(); }; ]]></Script> </Resources></Application>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -