PDA

View Full Version : help : radiogroup always selected


olp
06-18-2007, 04:07 AM
Hello all,

I want to set the text of button on radio button selection, but not before that, and thing with <radiogroup> is that, it always has ONE by default selection, which I do not want... I am using onselect event to get the value of radiobuttons


<radiogroup name="group1" x="20" y="20">
<handler name="onselect" args="cursel">
mybutton.setText(cursel.value);
</handler>
<radiobutton value="one" text="one"/>
<radiobutton value="two" text="two"/>
<radiobutton value="three" text="three"/>
</radiogroup>


please help me out here, am I doing something wrong, whats the difference between onselect and onclick event in terms of radiogroup/radiobutton.

thanks for your help

olp

olp
06-19-2007, 10:24 AM
is there any workaround for this

senshi
06-19-2007, 12:37 PM
"defaultselection" must be set to "null", wasn't too hard, was it? :)


<canvas debug="true" >

<radiogroup name="group1" x="20" y="20" defaultselection="null" >
<attribute name="lastsel" value="null" />

<handler name="onselect" args="cursel">
if( cursel != lastsel ){
if( cursel ){
Debug.write( "selection: " + cursel.value );
} else {
Debug.write( "no selection" );
}
}
this.lastsel = cursel;
</handler>

<radiobutton value="'one'" text="one" />
<radiobutton value="'two'" text="two" />
<radiobutton value="'three'" text="three" />
</radiogroup>

</canvas>

olp
06-19-2007, 06:38 PM
ya, that was really easy.

thanks for your help

olp