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
Contributor
fab100
Posts: 12
Registered: ‎03-10-2010
My Device: 8900
Accepted Solution

Putting two ObjectChoiceField beside each other

Hi,

 

I have tried putting two ObjectChoiceField components in a HorizontalFieldManager, but I cannot display both on the same line, it seems that the second one gets pushed out of screen on the right.

 

I tried with Manager.NO_HORIZONTAL_SCROLL to no avail.

 

Can someone please help me ;

 

Many thanks

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

Re: Putting two ObjectChoiceField beside each other

You can restrict the width of one of them. These two talk about this, though for different Field types:

 

http://supportforums.blackberry.com/t5/Java-Development/Can-t-put-BasicEditField-and-button-side-by-...

 

http://supportforums.blackberry.com/t5/Java-Development/Please-help-with-trying-to-put-a-BasicEditFi...

 

But if you are sure they will fit side by side, you can define the one on the left with the style

Field.FIELD_LEFT, and I think it will try to stay as close to the left as it can.  Give it a try.

Please use plain text.
Developer
YamilBracho
Posts: 713
Registered: ‎05-31-2010
My Device: 8520

Re: Putting two ObjectChoiceField beside each other

Use a style for your "combo boxes". For example:

 

HorizontalFieldManager hfm = new HorizontalFieldManager(Manager.NO_HORIZONTAL_SCROLL);
		
String [] items1 = new String [] { "One", "Two", "Three" };
String [] items2 = new String [] { "Four", "Five", "Six" };
		
		
ObjectChoiceField choice1 = new ObjectChoiceField("Combo 1:", items1, 0, ObjectChoiceField.FIELD_LEFT); //
ObjectChoiceField choice2 = new ObjectChoiceField("Combo 2:", items2, 0, ObjectChoiceField.FIELD_RIGHT); // 
		
hfm.add(choice1);
hfm.add(choice2);

 

 

Please use plain text.