private function btnSetUndefined_Click():Void
    {
     rgpSex.selection.selected=false;
     rgpSex.selection.data="" face="Courier New">undefined;
     lblValue.text="Value:"+rgpSex.selection.data.toString();
    }

On 12/9/05, Matt Chotin <[EMAIL PROTECTED]> wrote:

The only way to do this is undocumented and therefore probably won't work in Flex 2.0.  Set rgpSex.selectedRadio = undefined;

 

Normally I don't think a UI lets you de-select a radio group though, instead you should have an option for "none"

 

Matt

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of huhgawz
Sent: Wednesday, December 07, 2005 6:11 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] How to deselect a RadioButtonGroup?

 

How to deselect a RadioButtonGroup?

I try it using the next code but fails.

After the application is loaded, I click the "getValue" button and the
label displays "Value: undefined" (this behaviour is ok). Then I click
the "Female" RadioButton and click the "getValue" button and the label
displays "Value: F" (this behaviour is ok too). Finally, I click the
"setUndefined" button to make the RadioButtonGroup selection undefined.

In fact, the RadioButtonGroup has nothing selected visually but
when I click the "getValue" button the label displays "Value: F". I
wish the label displays again "Value: undefined"


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml ">
      <mx:Script>
      <![CDATA[
            function btnGetValue_Click():Void {
                  lblValue.text="Value: "+rgpSex.selectedData.toString();
            } // btnGetValue_Click
           
            function btnSetUndefined_Click():Void {
                  rgpSex.selection.selected=false ;
                  rgpSex.selection=undefined;
            } // btnSetUndefined_Click
      ]]>
      </mx:Script>
     
      <mx:RadioButtonGroup id="rgpSex" />
      <mx:RadioButton id="optM" label="Male" groupName="rgpSex" data="" />
      <mx:RadioButton id="optF" label="Female" groupName="rgpSex" data="" />
     
      <mx:Button label="getValue" click="btnGetValue_Click()" />
      <mx:Button label="setUndefined" click="btnSetUndefined_Click()" />
     
      <mx:Label id="lblValue" />
</mx:Application>









--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




YAHOO! GROUPS LINKS






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to