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: 889
Registered: ‎08-31-2009
My Device: 9530, 9630, 9800, 8530, 9900, 9810, 9930, PlayBook, Dev Alpha
My Carrier: Verizon

UIComponent depth

Is it just be or is there really no way to set the depth or z-value for a UIComponent?

 

I have come across a few blogs mentioning using these, but do not see anything at all in the docs. (and these seems like an important thing to be able to do.)


Read my thoughts on BlackBerry Development at news.ebscer.com
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: UIComponent depth

You can change the z order by calling setChildIndex.
Developer
Posts: 889
Registered: ‎08-31-2009
My Device: 9530, 9630, 9800, 8530, 9900, 9810, 9930, PlayBook, Dev Alpha
My Carrier: Verizon

Re: UIComponent depth

While that works at first it does not hold up if you then add other elements to the screen later.


Read my thoughts on BlackBerry Development at news.ebscer.com
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: UIComponent depth

I guess if you are doing this a lot, you could extend UIComponent, add an attribute to indicate overally z level, override the addChild function which would add then re-sort all the child components (or insert based on previous child components) relative to their "z level".
Developer
Posts: 889
Registered: ‎08-31-2009
My Device: 9530, 9630, 9800, 8530, 9900, 9810, 9930, PlayBook, Dev Alpha
My Carrier: Verizon

Re: UIComponent depth

All I was really trying to do was to make sure that the menu was always the highest level UIComponent on the screen. In the end I ended up just calling

 

removeChild(menuObj)
addChild(menuObj)

 following adding anything else to the screen. I am doing this infrequently enought that it is not too big of a deal, but I would have assumed that there was a better way to this.

 


Read my thoughts on BlackBerry Development at news.ebscer.com
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: UIComponent depth

You can also:

this.setChildIndex( menuObj, this.numChildren-1 );
Developer
Posts: 426
Registered: ‎04-10-2011
My Device: Z30

Re: UIComponent depth

You could also use addChildAt(object, index) and always insert the new objects at an index below the menu's.
-----------------------------------------------------------------------------
Check out my apps in the BlackBerry World
Visit my developer blog alopix.net
BBM Channel: C0047B612