The Radio Buttons in 0.8.3pre do not allow you set a user defined value. 
getValue() returns either true/false.  setValue(userVal) throws an error if
userVal is not a boolean.

Assertion error! Invalid incoming value for property 'value' of class
'qx.ui.form.RadioButton': Expected value to be a boolean but found XXXX

The new selection API makes them much harder to use and a lot less
intuitive.

The Radiobutton Demos show using the Label for a value, but this is less
than optimal for translated applications.

Given the following:

var bnt1 =  new qx.ui.form.RadioButton(this.tr("Green"));
var bnt2 =  new qx.ui.form.RadioButton(this.tr("Blue"));

var colorGroup = new qx.ui.form.RadioGroup(btn1, btn2);

this.colorGroup.addListener("changeSelection", this.onChangeColor, this);
...
onChangeType : function(event) {
  var value = event.getData()[0].getLabel();
  if (value == this.tr("Green")) {
   //This does not work - probably because it is comparing localized  string
objects - not string characters
   alert("You are looking at the grass");
  }
  else {

   alert("You are looking at the sky");
  }

++++

I can do the following

onChangeType : function(event) {
  var value = event.getData()[0].getLabel().toString();
  if (value == this.tr("Green").toString()) {
   alert("You are looking at the grass");
  }
  else {

   alert("You are looking at the sky");
  }

++++

But it would be much simpler and more intuitive to allow user defined
values.

var bnt1 =  new qx.ui.form.RadioButton(this.tr("Green"));
btn1.setUserValue("green");

var bnt2 =  new qx.ui.form.RadioButton(this.tr("Blue"));
btn2.setUserValue("blue");

var colorGroup = new qx.ui.form.RadioGroup(btn1, btn2);

this.colorGroup.addListener("changeSelection", this.onChangeColor, this);
...
onChangeType : function(event) {
  var value = event.getData()[0].getUserValue();
  if (value == "green")) {
   alert("You are looking at the grass");
  }
  else {

   alert("You are looking at the sky");
  }


The previous approach (pre 0.8.3) was much more intuitive where the
RadioButton had a label and a  user defined value.

Mike

-- 
View this message in context: 
http://www.nabble.com/RadioButton-problems-in-0.8.3pre-tp23657798p23657798.html
Sent from the qooxdoo-devel mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to