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
Posts: 174
Registered: ‎01-25-2011
My Device: Not Specified
Accepted Solution

Setting the width of an objectChoiceField!!

[ Edited ]

HI all,

 

I am trying to make the object choice field to occupy the whole containrt(screen) interms of width. I have had tried overriding layoyt and setMinimalWidth and setExtent methods , but what i found was they dislay the objectChoiceField occupying the complete width once we click on them, not when they are displayed on the screen.

 

So, Is there a way to show the OCF occupy the complete width of the screen when they are displayed  on the screen before clicking on OCF?? Especiallly when the string content is very small

Developer
Posts: 179
Registered: ‎06-15-2011
My Device: Storm 9550
My Carrier: Vodaphone

Re: Setting the width of an objectChoiceField!!

override layout() and setExtent inside it. Pass the height and width you want for the OCF to setExtent.
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Setting the width of an objectChoiceField!!

Just to clarify, as I understand it, what you are trying to do is have each choice, fill the complete width, regardless of how many characters are in that choice.  So the smaller choices would be filled with some background padding to the width of the OCF.  Is that correct?

Developer
Posts: 174
Registered: ‎01-25-2011
My Device: Not Specified

Re: Setting the width of an objectChoiceField!!

sorry for the late reply,, Yes, Peter that is wat it want to achieve... I want to show the OCFoccupying the whole width of the screen..

Highlighted
Developer
Posts: 174
Registered: ‎01-25-2011
My Device: Not Specified

Re: Setting the width of an objectChoiceField!!

I found the solution:

 

protected void layout(int width, int height) {
				setMinimalWidth(width - 61);// 61 is the min value, lower than 61 will not work
				super.layout(width, height);
				
			}