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

Adobe AIR Development

Reply
Developer
Posts: 158
Registered: ‎01-11-2010
My Device: 9700 | 9900 | PlayBook | Dev Alpha
My Carrier: Many :)

do buttons have a padding property?

Hey all.  Trying my hand at PlayBook development.  Is there any way that i can add a 10 or so pixel

 

padding to buttons that i am laying out?

 

This is how ive been doing it(the manual way with hard coded X and Y cords)

 

 

myBtn.x = 50;

myOtherBtb.x = 200;

 

Let me know if there is a better way.  Thanks for your time!

- - - - - - - - - -
Developer
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: do buttons have a padding property?

hey dtater,

 

welcome to the forums! there are two way that i know of to add padding to an object or button. the first way is the QNX API way by using the Container class. it uses its own spacing and positioning so you dont have to hard code a lot of things. the downside is that it gives you little control over placement and you are soemtimes forced to do work arounds in some situations. here is more information about containers:

 

http://www.blackberry.com/developers/docs/airapi/1.0.0/qnx/ui/core/Container.html

 

the second way to do it is to create a variable to store the amount of padding so you dont have to retype the number everytime. that way it stays consistent and if you change it in one place it will be changed in all the other places.

 

so something like this:

 

 

private const PADDING:int = 10;

(...)

myBtn.x = 50;

myOtherBtn.x = myBtn.x + myBtn.width + PADDING;

myOtherOtherBtn.x = myOtherBtn.x + myOtherBtn.width + PADDING;

 

that being said i use the second method because im not too big of a fan of containers. i certainly recommend you try both ways before making any final decisions. some people do like containers and some people dont. in the end its up to you. there is no set way to add a padding except for you finding a way to do it by manipulation. hope that sheds some light. good luck!

 

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman
Highlighted
Developer
Posts: 158
Registered: ‎01-11-2010
My Device: 9700 | 9900 | PlayBook | Dev Alpha
My Carrier: Many :)

Re: do buttons have a padding property?

thanks for the quick reply! Its a shame that there is no padding like there in in android. (i come from an android dev background...) I'll have to look more into containers (my UI right now uses SPRITES, so i am not sure how compatible they will be) Thanks again!
- - - - - - - - - -