- // Toolbar radio buttons have a (display at least, didn't look at the code)
- // bug: click on second button, then click again on it - the second button
- // will get deselected and the first button will get selected. Of course,
- // you might argue that it inherits from form.ToggleButton and thus it's
- // toggled "off" when you click the second time. But in this case, the
- // object should be called ToggleButton and not RadioButton. Another issue
- // with this behaviour is that when I click the second time, the execute
- // event is executed on the second button (the one that gets deactivated)
- // and not on the first, which gets activated.
- var button1 = new qx.ui.toolbar.RadioButton("First Button");
- var button2 = new qx.ui.toolbar.RadioButton("Second Button");
- var button3 = new qx.ui.toolbar.RadioButton("Third Button");
- /*
- // The problem I found here is that if I click a second time on the already
- // selected button, I'll still get an execute event and I see no reason to
- // that.
- var button1 = new qx.ui.form.RadioButton("First Button");
- var button2 = new qx.ui.form.RadioButton("Second Button");
- var button3 = new qx.ui.form.RadioButton("Third Button");
- */
- new qx.ui.form.RadioGroup(button1, button2, button3);
- var doc = this.getRoot();
- doc.add(button1, {left : 100, top : 50});
- doc.add(button2, {left : 100, top : 100});
- doc.add(button3, {left : 100, top : 150});
- // Alas, there is one thing which I find missing: the ability to cancel
- // the selection of a button. Let's say I've clicked the second button, some
- // changes occured in the pages and if I were to click on the first button,
- // I'd lose my changes. So, naturally, I'd like to display a confirmation
- // dialog and allow the user to choose whether he wants to allow the change.
- button1.addListener("execute", function(e) {
- alert("first");
- });
- button2.addListener("execute", function(e) {
- alert("second");
- });
- button3.addListener("execute", function(e) {
- alert("third");
- });