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
ABoul
Posts: 138
Registered: ‎07-11-2010
My Device: Bold 9700
My Carrier: O2

how to position a field

[ Edited ]

i have a labelfield that i want to position somewhere on the screen. how do i go about doing this? setPadding and setMargin work, but they shift everything else (i want to position a labelfield somewhere on top of a bitmapfield). thanks in advance.

Please use plain text.
Developer
rcmaniac25
Posts: 1,804
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.2174, Z10 (STL100-3)-10.3.0.700 Dev OS, Z30 (STA100-5)-10.3.0.700 Dev OS, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: how to position a field

Check out http://supportforums.blackberry.com/t5/Java-Development/Implement-advanced-buttons-fields-and-manage...

 

Mainly "NegativeMagins" this is what I was telling you in your other post, use negative margins to overlay fields.

---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.
Please use plain text.
Developer
Ted_Hopp
Posts: 1,305
Registered: ‎01-21-2009
My Device: Not Specified

Re: how to position a field

You can also write your own custom layout manager if none of the standard managers does exactly what you want. See How to Create a Custom Layout Manager for a Screen in the knowledge base.




Solved? click "Accept as solution". Helpful? give kudos by clicking on the star.
Please use plain text.
Trusted Contributor
ABoul
Posts: 138
Registered: ‎07-11-2010
My Device: Bold 9700
My Carrier: O2

Re: how to position a field

but i read somewhere that setMargin was deprecated on newer operating systems. it isn't even documented and i don't know what its arguments are. is this the same for setPadding btw?

Please use plain text.
Trusted Contributor
ABoul
Posts: 138
Registered: ‎07-11-2010
My Device: Bold 9700
My Carrier: O2

Re: how to position a field

[ Edited ]

a quick question about the custom layout manager: do i need to declare the field objects in the sublayout() part or do i add them to the custom layout manager and then modify their properties by getting their index numbers (e.g. getField(0).[some property] to access the first object)?

Please use plain text.
Developer
Ted_Hopp
Posts: 1,305
Registered: ‎01-21-2009
My Device: Not Specified

Re: how to position a field

The latter. You should not add the fields in sublayout; that gets called whenever the screen needs layout. You can add them in the constructor, using add() or through your own custom methods. You can access the fields by index or you can design your custom manager to store references to specific fields in instance variables.

 

RIM has a nice video here on creating a custom manager.




Solved? click "Accept as solution". Helpful? give kudos by clicking on the star.
Please use plain text.