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
Regular Contributor
SS123
Posts: 90
Registered: ‎09-16-2010
My Device: Not Specified

position popup screen

i have a screen with a label field, on the click of the label field i push a popup screen

now this popup screen appears at the center of the screen,  however i want to change the position of the popup screen

Please help..

 

my popup screen is as below

 

class PopUpScreen extends PopupScreen {
	public PopUpScreen)
 {
	super(new HorizontalFieldManager() {
	public int getPreferredWidth() {
		return Display.getWidth() / 3;
		}

	public int getPreferredHeight() {
		return Display.getHeight();
		}
	});
	
	add(new LabelField("Select SMS Provider"));
	add(addSpinBox());
	UiApplication.getUiApplication().pushScreen(this);
}

 

Please use plain text.
Developer
vivart
Posts: 147
Registered: ‎08-27-2010
My Device: 9800
My Carrier: airtel

Re: position popup screen

[ Edited ]

add this method..

 

 

 protected void sublayout(int width, int height) {
     super.sublayout(width, height);
     setPosition(x, y);
    }

 

 

and set x & y co ordinates.

 

Edit:  is right there is no need of setExtent.

Please use plain text.
Developer
arkadyz
Posts: 2,268
Registered: ‎07-08-2009
My Device: various
My Carrier: various

Re: position popup screen

You don't need to setExtent in sublayout override - super.sublayout does that for you.

If you ever need to change the screen's position on some event - change your x and y and invoke updateLayout().

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Please use plain text.