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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Trusted Contributor
Posts: 138
Registered: ‎04-19-2012
My Device: No
My Carrier: Nokia
Accepted Solution

Two RadioButton in single line with any idea...

Hello 

Can i add two RadioButton in singel line...

i m using HorizontalFieldManager with it 

but only First Button is visible.................................give me any good and simple solution for this plz help me.

 

Thanks

Himanshu 

Beginner

Developer
Posts: 139
Registered: ‎02-23-2012
My Device: Blackberry bold
My Carrier: Vodafone India

Re: Two RadioButton in single line with any idea...

Yes, you can add two radio buttons on one line.

For that you need to set layout for Horizental Field manager.

warm regards
Mohammed Aziz
Highlighted
Developer
Posts: 139
Registered: ‎02-23-2012
My Device: Blackberry bold
My Carrier: Vodafone India

Re: Two RadioButton in single line with any idea...

After doing that please post your code as well.....
warm regards
Mohammed Aziz
Trusted Contributor
Posts: 138
Registered: ‎04-19-2012
My Device: No
My Carrier: Nokia

Re: Two RadioButton in single line with any idea...

actully other also give that solution .its working but 

it also hides all fields which are placed just below RadioButtons..

 

plz send code Sir.

Trusted Contributor
Posts: 138
Registered: ‎04-19-2012
My Device: No
My Carrier: Nokia

Re: Two RadioButton in single line with any idea...

i use this but it hides all fields below the radiobuttons.

 

 

RadioButtonGroup group = new RadioButtonGroup();

final RadioButtonField radio1 = new RadioButtonField("one", group, true);
final RadioButtonField radio2 = new RadioButtonField("two", group, false);
HorizontalFieldManager hfm = new HorizontalFieldManager(){
protected void sublayout(int maxWidth, int maxHeight) {
setPositionChild(radio1, 0, 0);
layoutChild(radio1, 100, 50);
setPositionChild(radio2, 150, 0);
layoutChild(radio2, 100, 50);
setExtent(maxWidth, maxHeight);
}
};
hfm.add(radio1);
hfm.add(radio2);
add(hfm);

Developer
Posts: 139
Registered: ‎02-23-2012
My Device: Blackberry bold
My Carrier: Vodafone India

Re: Two RadioButton in single line with any idea...

Please Find the below Code and try it and let me know......

 

radioButtonGroup = new RadioButtonGroup();

		radioButtonField = new RadioButtonField("Radio 1", radioButtonGroup,
				true, 0) {
			protected void layout(int arg0, int arg1) {
				setExtent(Display.getWidth() / 2, arg1);
				super.layout(Display.getWidth() / 2, arg1);
			};
		};
		radioButtonField1 = new RadioButtonField("Radio 2", radioButtonGroup,
				false, 0) {

			protected void layout(int arg0, int arg1) {
				setExtent(Display.getWidth() / 2, arg1);
				super.layout(Display.getWidth() / 2, arg1);
			};

		};

		HorizontalFieldManager hfmFieldManager = new HorizontalFieldManager() {
			protected void sublayout(int maxWidth, int maxHeight) {
				setExtent(Display.getWidth(), maxHeight);
				super.sublayout(Display.getWidth(), maxHeight);
			}
		};

		hfmFieldManager.add(radioButtonField);
		hfmFieldManager.add(radioButtonField1);

		add(hfmFieldManager);

		add(new LabelField("This label is below the two radio buttons",FOCUSABLE));
		add(new ButtonField("Click ME!"));

 

warm regards
Mohammed Aziz
Trusted Contributor
Posts: 138
Registered: ‎04-19-2012
My Device: No
My Carrier: Nokia

Re: Two RadioButton in single line with any idea...

thanks again Mohammed sir....perfect solution.

Namaskar from my side.

 

 

 

Thanks 

Himanshu

Developer
Posts: 1,452
Registered: ‎11-06-2009
My Device: Torch 9810
My Carrier: WiFi

Re: Two RadioButton in single line with any idea...

Just for reference, I fount it easier to use GridFieldManager and to place the radiobuttons inside (it is 3-radiobuttons example):

 

		GridFieldManager grid = new GridFieldManager(1,3, GridFieldManager.FIXED_SIZE);
		int width = Display.getWidth()/3 - 10; // 10 - some padding
		grid.setColumnProperty(0, GridFieldManager.FIXED_SIZE, width);
		grid.setColumnProperty(1, GridFieldManager.FIXED_SIZE, width);
		grid.setColumnProperty(2, GridFieldManager.FIXED_SIZE, width);

		grid.add(new RadioButtonField("Test", typeRadioGroup, false));
		grid.add(new RadioButtonField("Test1", typeRadioGroup, false));
		grid.add(new RadioButtonField("Test2", typeRadioGroup, false));
		add(grid);

 



"When you become a level 3 developer, you learn to communicate over the ether. I'm told that level 5 developers are ascend into a higher level of existence beyond the physical realm." gord888 @ crackberry