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: 723
Registered: ‎03-12-2009
My Device: Playbook

Re: CheckboxField on the same line with OS6

Fyi. It looks like the field by default uses USE_ALL_WIDTH.   Overriding layout and passing getPreferredWidth() instead of actual width, will only give it as much room as it needs thus fixing this issue.

 

Using this fix I can't tell the difference between 6.0 render and 5.0.

Developer
Posts: 53
Registered: ‎01-08-2009
My Device: Not Specified

Re: CheckboxField on the same line with OS6

 


dnepr wrote:

Fyi. It looks like the field by default uses USE_ALL_WIDTH.   Overriding layout and passing getPreferredWidth() instead of actual width, will only give it as much room as it needs thus fixing this issue.

 

Using this fix I can't tell the difference between 6.0 render and 5.0.


I can confirm that this fix works - very nice and simple... thank you so much!

 

Developer
Posts: 285
Registered: ‎08-06-2010
My Device: Z10

Re: CheckboxField on the same line with OS6

[ Edited ]

Works for me too... here's some sample code:

 

 

CheckboxField myBox = new CheckboxField("My Box", false, CheckboxField.FIELD_LEFT){
protected void layout(int width, int height) {
	super.layout(this.getPreferredWidth(), height);
}
 }; 

 

 



Follow me on twitter @RileyGB - https://twitter.com/RileyGB
View my BB10 OpenSource projects - https://github.com/RileyGB/BlackBerry10-Samples
Highlighted
Regular Contributor
Posts: 70
Registered: ‎06-15-2011
My Device: Bold 9900
My Carrier: Bell Canada

Re: CheckboxField on the same line with OS6

Thanks - very helpful!