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
Posts: 29
Registered: ‎07-15-2008
My Device: Not Specified

PopupScreen with two button aligned centrally.

Hi,

 

Trying to align two buttons (side by side) at the center of a PopupScreen, however they do not appear as I would like them to.  Code snippet below:

 

public PasswordPopupScreen(GPSListener gpsListener) {

super(new VerticalFieldManager(), Field.FOCUSABLE | DEFAULT_MENU);

 

 

b1 = new ButtonField("Search", ButtonField.CONSUME_CLICK

| ButtonField.ELLIPSIS | ButtonField.FIELD_HCENTER);

 

b2 = new ButtonField("Cancel", ButtonField.CONSUME_CLICK

| ButtonField.ELLIPSIS | ButtonField.FIELD_HCENTER);

 

 

HorizontalFieldManager h1 =
new HorizontalFieldManager(

HorizontalFieldManager.FIELD_HCENTER);

 

 

h1.add(b1);

h1.add(b2);

 

add(h1);

}

Developer
Posts: 143
Registered: ‎07-14-2008
My Device: Not Specified

Re: PopupScreen with two button aligned centrally.

A vertical field manager is going to vertically stack fields (ie your buttons) added to it.  You need to put the buttons in a horizontal field manager that Manager.USE_ALL_WIDTH.

 

Hope this helps.

 

Highlighted
Developer
Posts: 146
Registered: ‎11-05-2008
My Device: Not Specified

Re: PopupScreen with two button aligned centrally.

add hh to a vertical manager and later add  this vertical field manager .