Let me explain what is going on here and why it has been done this way. 

Let's say you've got a MXML Component called myChoice. It contains three
RadioButtons, called rA, rB, & rC. You assign each of these a groupName
called myGroup. It also has a member variable called dataProvider. The way
that you use this component is that you set the dataProvider property, which
then sets the label and data properties of each of your three RadioButtons. 

Now in your main application, you instantiate three of these myChoice
components, called cA, cB, & cC. 

In this application, would you expect all nine RadioButton be part of a
single group called myGroup? No, you'd expect that there would be three
groups and that the RadioButtons within each component are only a part of
the internal group of the component. The same thing with the dataProvider
property. You wouldn't expect that this property would be shared among all
three components. 

What is happening under the covers is that a RadioButtonGroup with the id
"myGroup" is created as a member variable of the myChoice component. 

So in short, radio buttons can only share a RadioButtonGroup if they are
within the same class. (Remember that each MXML file is its own class.)

Jason

-----Original Message-----
From: jwaknitz [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 14, 2005 10:59 AM
To: [email protected]
Subject: [flexcoders] Re: Radio Button Custom Component



I tried that, to no avail.  :(




--- In [email protected], Deepa Subramaniam <[EMAIL PROTECTED]> 
wrote:
> I don't see a <mx:RadioButtonGroup> tag in your code anywhere. 
This tag is
> what defines the group which your RadioButtons will work as a 
single control
> under. You can also use this tag to specify the labelPlacement for 
all the
> RB's in the group. 
> 
> So I think what you need is outside of your Repeater this:
> 
> <mx:RadioButtonGroup id="group1" labelPlacement="right" />
> 
> Check out the ASDocs for more info.
> 
> -----Original Message-----
> From: jwaknitz [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, April 14, 2005 10:47 AM
> To: [email protected]
> Subject: [flexcoders] Re: Radio Button Custom Component
> 
> 
> 
> I went back to the script and changed the if statement to create a 
> RadioButton directly to the app and not grab a component.  This 
> fixed the group problem but is not the fix that I wanted.  
> Components is much nicer for what I want as the other way has 
> generated a few problems with my design.  
> 
> Does anyone have any input about why the groupName attribute 
doesn't 
> seem to work between components?
> 
> 
> --- In [email protected], Matthew Shirey <[EMAIL PROTECTED]> 
> wrote:
> > I am working with Jack and I am familiar with his problem. 
There's 
> a few 
> > reasons why we're using a component with a radio control inside 
> it. Our 
> > problem is that it seems to be ignoring the groupName property. 
Do 
> radio 
> > controls have to all exist inside the same parent container to 
> work as a 
> > group? I have looked in the documentation and didn't see any 
such 
> > limitation. Maybe I missed it. Shouldn't you be able to put 
radio 
> buttons 
> > anywhere in the application and as long as they all have the 
same 
> groupName 
> > they all behave as a group?
> > 
> > -- Matthew
> > 
> > On 4/13/05, Tracy Spratt <[EMAIL PROTECTED]> wrote:
> > > 
> > > 
> > > Why not just use straight mxml. The following works for me.
> > > 
> > > <mx:VBox id="vboxRG" x="3" y="3" >
> > > <mx:Repeater id="repeaterRB" 
> dataProvider="{leParameter.valuesarray}"
> > > >
> > > <mx:RadioButton id="RBParameter" groupName="RGBParameter"
> > > data="{repeaterRB.currentItem[0]}"
> > > label="{repeaterRB.currentItem[labelColumn]}"
> > > click="setParameterValue(event)"
> > > width="{this.width-6}"/>
> > > </mx:Repeater>
> > > </mx:VBox>
> > > 
> > > Tracy
> > > 
> > > -----Original Message-----
> > > From: jwaknitz [mailto:[EMAIL PROTECTED]
> > > Sent: Wednesday, April 13, 2005 1:16 PM
> > > To: [email protected]
> > > Subject: [flexcoders] Radio Button Custom Component
> > > 
> > > I'm using a repeater to grab a component that makes a 
radiobutton
> > > each time.
> > > When the app is displayed, there are 7 radiobuttons. The 
problem
> > > is, they are not in the same group. They are all individually
> > > checkable. I went into the component and gave the radiobutton a
> > > groupName="group1". All of the radiobuttons then had the same
> > > groupName. The problem was still there.
> > > 
> > > I also tried putting the component call within a 
RadioButtonGroup
> > > component and had no luck.
> > > 
> > > Anyone have any solutions to this?
> > > 
> > > *----------------------------------------* App:
> > > 
> > > <mx:Script>
> > > <![CDATA[
> > > 
> > > var compData3:Object;
> > > var compData4:Object;
> > > 
> > > function repeaterfunc(){
> > > if(repradio.currentItem.nodeName == "response_lid"){
> > > compData3 = cont.createChild
> > > (Components.RadioButtons.labelbuttoncomp);
> > > compData3.compData4 = repradio.currentItem;
> > > }
> > > }
> > > ]]>
> > > </mx:Script>
> > > 
> > > <mx:Repeater id="repradio" dataProvider="{compData2.childNodes
> > > [1].firstChild.childNodes}" repeat="repeaterfunc()"/>
> > > 
> > > <mx:VBox id="cont"></mx:VBox>
> > > 
> > > *----------------------------------------* Component:
> > > 
> > > <mx:Script>
> > > <![CDATA[
> > > 
> > > var compData4;
> > > 
> > > ]]>
> > > </mx:Script>
> > > 
> > > <mx:RadioButton
> > > 
> 
label="{compData4.firstChild.firstChild.firstChild.firstChild.firstCh
> > > ild.firstChild}" groupName="group1" labelPlacement="right"/>
> > > 
> > > Yahoo! Groups Links
> > > 
> > > Yahoo! Groups Links
> > > 
> > > 
> > > 
> > > 
> > >
> 
> 
> 
> 
> 
>  
> Yahoo! Groups Links





 
Yahoo! Groups Links



 





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to