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
Trusted Contributor
Posts: 138
Registered: ‎07-11-2010
My Device: Bold 9700
Accepted Solution

blackberry sdk equivalent of z-order?

hi, complete newbie here.

 

i have a LabelField and a BitmapField. i want the label to show itself on top of the bitmap. how do i go about doing this?

Developer
Posts: 1,805
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.997 Dev OS, Z30 (STA100-5)-10.3.1.997 Dev OS, Passport (SQW100-1)-10.3.0.1418, PlayBook (16GB)-2.1.0.1917

Re: blackberry sdk equivalent of z-order?

Draw the label after the Bitmap. Drawing occurs on a bottom-to-top manner, so the first thing you draw is on the bottom, the last thing you draw is on the top.

 

As for Fields itself you can create a custom Manager and position the LabelField in the same area as the BitmapField and, as mentioned above, draw the LabelField after the BitmapField.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Trusted Contributor
Posts: 138
Registered: ‎07-11-2010
My Device: Bold 9700

Re: blackberry sdk equivalent of z-order?

[ Edited ]

thanks for the reply, rcmaniac. the LayoutManager approach looks really tedious; do you know of any good online resources on this topic?

Developer
Posts: 1,805
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.997 Dev OS, Z30 (STA100-5)-10.3.1.997 Dev OS, Passport (SQW100-1)-10.3.0.1418, PlayBook (16GB)-2.1.0.1917

Re: blackberry sdk equivalent of z-order?

I forgot you can just use Field.setMargin(int, int, int, int), you won't find it in documentation (or at least not in 5.0 docs) but you can actually set those values to negative and overlay Fields on top of one another.

 

You may find articles on this forum debating if undocumented functions should be used or not but setMargin has even been used in RIM's own examples so I doubt there is any problem with using it.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.