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: 49
Registered: ‎05-20-2009
My Device: Not Specified
Accepted Solution

Alignment Issue

Hi,
I have 3 fields - RadioButton1, BasicEditField1 and Label1. I need to align them horizontally in a single line. RadioButton and BasicEditField show tendency to consume all available screen width. I understand that by subclassing a fixed value to width can be assigned to these fields. But the app I am developing will be used in different models having different screen size. OS version that I target is 4.3. The method I would like to try is this. Subclass RadioButton and override subLayout method and assign a fixed width to the field. So the calculation will involve width of the default image and displayed text of the Radio button. This image seems to change from one model to another. Is there any way to get the width of the image of RadioButton? I have explained what I am really trying to do because I also what to know if there is any other simple method.   

Thanks
Abees
Developer
Posts: 432
Registered: ‎02-23-2009
My Device: Not Specified

Re: Alignment Issue

You can use HorizentalLayoutManager to align all our 3 fields in a row.

 


Press the kudos button to thank the user who helped you.

If your problem was get solved then please mark the thread as "Accepted solution".

 

Deepesh Gupta
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Alignment Issue

@Deepesh - HorizentalLayoutManager?  Where can I find that?

 

@AbeesMuhammed.  You ask a good question.  I wonder also if the size of the button is dependent on the fnt used?  Also, I'm guessing on a Storm, it will be a different size again (fat fingers) and on a Storm, what should happen when the device changes orientation?

 

Can I ask if you are worried about the Storm at the moment?

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Alignment Issue

The following will allocate a RadioButtonField, with only as much width as it needs, at least it does in my testing.  Hope this helps.

 

RadioButtonField _rbf1 = new RadioButtonField("Test 1", rbg, true, RadioButtonField.FIELD_LEFT) { protected void layout(int width, int height) { int temp = this.getPreferredWidth(); setExtent(temp, height); super.layout(temp, height); } };

 

Highlighted
Developer
Posts: 49
Registered: ‎05-20-2009
My Device: Not Specified

Re: Alignment Issue

[ Edited ]
Thanks. Your code snippet worked fine. I am least bothered about storm right now.
Message Edited by AbeesMuhammed on 09-11-2009 01:26 AM