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
New Developer
cybrown
Posts: 17
Registered: ‎07-29-2010
My Device: 9800

Re: Basic Container use...what's the difference between UIComponent.size and UIComponent.setSize()?

I should also add that I don't understand how the layout manager decides what to do if there is more than 100% total size requested. In my example above, if I just use "new Spacer()" instead of "new Spacer(37.5)", each Spacer would request 100% of the total vertical space. myButton then winds up being very small vertically. I'm not sure how its size is decided. Does anyone know? The documentation says nothing about the layout algorithms, and in the documentation they purposefully request more than 100% of the total available flow.

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

Re: Basic Container use...what's the difference between UIComponent.size and UIComponent.setSize()?

hey,

 

simple answer: you can't. complex answer: you can but you have to be crafty. kind of like the way you stated about trying to add multiple containers. the container is kind of "dumb". it only positions things in a certain direction. when it comes to the opposite direction it burns out in my opinion. since in your code its only worrying about the vertical positioning of things, its not worrying too much about whats happening horizontally because its not placing anything next to your button. only things beneath it. its assuming there is nothing and will be nothing next to ur UIComponent (button).

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
Developer
JRab
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: Basic Container use...what's the difference between UIComponent.size and UIComponent.setSize()?

hey,

 

just saw your question about spacing and the algorithm. im not going to pretend i know the algorithm of the container cause i dont. wish they made the code behind it more obvious but much like how its hitting u, we have to guess and check. my guess here is the developer has to be a little intuitive and know how many objects they are putting into the flow and how much room they really want to take up. in the documentation they used a space of 100% to show that you can "push" your objects in the opposite direction without explicitly saying "right align" the object.

 

now with all that being said im not at all a fan of the container class. im gonna go ahead and say i dont use it because its way too much work for me. id rather do my own calculations then have it do it for me. whether or not i am losing time, for me its more about convenience. i dislike it when i expect one thing to happen but a whole different thing happens. but thats just my view. the downside of my "conveneince" is the lack of support for possible resizing of the screen. but i'll take that on once it becomes a problem.

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
New Developer
cybrown
Posts: 17
Registered: ‎07-29-2010
My Device: 9800

Re: Basic Container use...what's the difference between UIComponent.size and UIComponent.setSize()?

That is good to know! I was struggling to figure out what the intended "best practices" are for the use of containers. I can see that they sort of allow us to use percentages instead of fixed sizes, but it takes a lot of work and nested containers in order to do that. I don't like the notion of purposefully asking for more than 100% space to allow components to be pushed around, because that seems like an implementation that might break in the future. I'll think about using containers, but it just seems much easier and more controllable to use setSize and setPosition on each component. Thanks!