Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
arunbiet
Posts: 376
Registered: ‎06-22-2010
My Device: na
My Carrier: blackberry developer

Radio Button error

I am trying to make a Customized RadioButton Control.But i am getting this error "Displayed Radio Button is not a member of a group"

Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: Radio Button error

And have you added the RadioButton - even your customized one - to a group?

 

As I understand it, RadioButtons do not exist on their own, they must be added to group.   This from the API doc:

"Before you can use the newly built readio button field, you must add it to a valid radio button group."

 

If you want a simple 'switchable' property, then look at customizing the CheckboxField.

 

Or look at the sample here:

http://supportforums.blackberry.com/t5/Java-Development/Implement-advanced-buttons-fields-and-manage...

 

Please use plain text.
Developer
arunbiet
Posts: 376
Registered: ‎06-22-2010
My Device: na
My Carrier: blackberry developer

Re: Radio Button error

That issue is being fixed,what i am doing is I am sending the instance of RadioButtonGroup to the CustomRadioField class and passing it to super

In the super i am doing

 

public RadioControl(int width, int height,String text,RadioButtonGroup rbg) {
	    super(text, rbg, false);
		mWidth = width;
		mHeight = height;
		rbg.setChangeListener(new FieldChangeListener() {
			public void fieldChanged(Field field, int context) {
				//valueOfRadioButton = rbGroup.getSelectedIndex();
			}
		});
	}

 And from my caller class i am setting the listener

radioControl.setChangeListener(this);

 and adding the radio control to my manager.I am able to display the radio buttons nw,bt the problem is that if i select all the three radio buttons each radio button field remains  in the selected state,where as the actual behaiviour of radio button is if i select one the other should be in unselected state.So whats the problem here?

Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: Radio Button error

Maybe just me, but I thought you had to reset the RadioButtons when one was selected - assuming that they are mutually exclusive.  You will do that in your change listener. 

Please use plain text.