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
Developer
Berrysoft
Posts: 143
Registered: ‎07-14-2008
My Device: Not Specified
Accepted Solution

Manager Question

Suppose you want a VFM that has a "margin" (white space left, right, top, & bottom), say 6 pixels.

 

What is the best way to accomplish this?

 

I have discovered the trick of creating a SeparatorField with a blank paint() method, to create some small amount of vertical spacing.

 

Please use plain text.
BlackBerry Development Advisor (Retired)
bzubert
Posts: 86
Registered: ‎07-11-2008
My Device: Not Specified

Re: Manager Question

One way to accomplish this task might be to have a Manager within a Manager.  In the outer Manager, override sublayout, and call layoutChild on the inner Manager, giving it a width and height that are screen width -12 and screen height -12.  In the outer Manager, position the inner Manager at location 6, 6, and you should be in business.

Brian Zubert
Technical Partnership Manager
Research In Motion
Please use plain text.
Developer
Berrysoft
Posts: 143
Registered: ‎07-14-2008
My Device: Not Specified

Re: Manager Question

Yes, I thought of this solution, but seems a bit wasteful in both time and code.  There must be a better way.  =)
Please use plain text.
BlackBerry Development Advisor (Retired)
bzubert
Posts: 86
Registered: ‎07-11-2008
My Device: Not Specified

Re: Manager Question

In 4.6, there is a better way.  Check out the new BorderFactory class in the decor package.

 

http://na.blackberry.com/eng/developers/devbeta.jsp#tab_tab_jde 

Brian Zubert
Technical Partnership Manager
Research In Motion
Please use plain text.
Developer
Developer
rab
Posts: 283
Registered: ‎07-22-2008
My Device: Not Specified

Re: Manager Question

An easier way to do this is to use the setPadding() function:

 

VerticalFieldManager vfm = new VerticalFieldManager();

vfm.setPadding(10,10,10,10); //TRBL

 

This will give you a margin of 10( top, right, bottom, left)

 

 

Rab

Please use plain text.
Developer
mreed
Posts: 1,041
Registered: ‎07-16-2008
My Device: ಠ_ಠ

Re: Manager Question

[ Edited ]
setPadding() and setMargin() are hidden starting in either 4.5.0 or 4.6.0 If you want to build for those platforms, you will need to find a different method.
Message Edited by mreed on 07-22-2008 01:46 PM
Please use plain text.
Developer
richard_puckett
Posts: 191
Registered: ‎04-03-2008
My Device: Bold 9700

Re: Manager Question

AFAIK, it's *never* been visible, at least back to 4.2.0.  It's still a public (and undocumented) method in 4.6.0.  Still not a great idea to use undocumented features though, even if they work for the time being.

 

Most of my UI components derive from my own baseclass ("ActiveField" which derives from Field) so I can support things like tooltips, etc.  In that class I have my own setPadding method which is used during layout.  That way, if RIM ever takes it out (like Field.AXIS_SEQUENTIAL!) it won't break my code.

Please use plain text.
Developer
Berrysoft
Posts: 143
Registered: ‎07-14-2008
My Device: Not Specified

Re: Manager Question

The only downside to this is that you then cannot use the existing classes, which means the code is larger.  We try to avoid this to minimize the size of our final .cod.  We also feel that this mechanism should be part of the underlying framework, and cannot understand why they would hide/deprecate such useful methods.  Perhaps the new stuff pointed out above will fulfill the need, although require 4.5.

 

Please use plain text.
New Developer
_Jon
Posts: 18
Registered: ‎07-17-2009
My Device: Not Specified

Re: Manager Question

I've just been bitten by this in 4.5.  I have some input fields that I wanted to align vertically using label fields for the variations in font.  I used .setPadding because it was available in eclipse, not knowing it was 'hidden' and not available.

 

Now, when I've tried to move to a production build that is ant-only (no eclipse or RIM JDE), the compile fails because this method (setPadding) is not supported.

 

Yes, I know I could use other methods and other styles to get a similar (or same) effect.  But this UI has gone all through dev / testing / UA and now the primary UI has to be redone.

 

This sucks.

 

I find it very frustrating that eclipse would suggest a method that isn't supported.  boo.

Please use plain text.
New Developer
rwrife
Posts: 23
Registered: ‎04-29-2009
My Device: Not Specified

Re: Manager Question

Did you ever find a solution to this problem.  I've run into the same problem were eclipse has no problems w/ setmargin & setpadding but ANT doesn't like it.

Please use plain text.