Hello mike,
sorry for the delay in answering. I'm still not in the office due to
my broken hand. But i just read your mail and want to answer it
immediately.
I would suggest the following code to solve this even without a string
to use.
var btn1 = new qx.ui.form.RadioButton(this.tr("Green"));
var btn2 = 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 btn = event.getData()[0];
if (btn == btn1) ;
alert("You are looking at the grass");
}
else {
alert("You are looking at the sky");
}
That way, you dont have to take care of the content of the label at all.
Best,
Martin
Am 21.05.2009 um 20:05 schrieb mshillin:
>
> 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
>
>
------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises
looking to deploy the next generation of Solaris that includes the latest
innovations from Sun and the OpenSource community. Download a copy and
enjoy capabilities such as Networking, Storage and Virtualization.
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel