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

Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.

New Developer
Posts: 40
Registered: ‎05-12-2009
My Device: Not Specified

field.updateLayout cause scroll to top

When i call field.updateLayout the page will scroll to top but i just want it remain same position. How to do that?
Posts: 1,477
Registered: ‎12-30-2008
My Device: Torch 9810

Re: field.updateLayout cause scroll to top

This happens as expected, when you update a layout it is common for the screen to go to the start.. To work around this to get your expected results, find which field has the focus currently(before calling update layout), and then setFocus to that field after the update layout..



Manimaran Selvan
Co-Founder, Tech Lead,
Equity Markets Research Group
New Contributor
Posts: 6
Registered: ‎05-08-2012
My Device: BB 9800
My Carrier: At&t

Re: field.updateLayout cause scroll to top



i am trying to scroll verticalfield to a specific point(height) and make the field show on top of the page by calling setVerticalScroll() witin the layout method of the field:


protected void layout(int width, int height) {
_setExtent(getPreferredWidth(), getPreferredHeight());
// To try to scroll the list so that the focus field is shown on top of the page
if (this.getIndex() == this.getManager().getField(this.getManager().getFieldCount()-1).getIndex()) {



but the field doesnt scroll to the position. it however scrolls to the visible rect of the screen since the field's focus is true.


Can you please tell why the is not working... 



Posts: 2,268
Registered: ‎07-08-2009
My Device: various
My Carrier: various

Re: field.updateLayout cause scroll to top

One of the absolute first things to do in such cases is to wrap your setVerticalScroll in invokeLater. Calculate the position into a final int and invokeLater the setVerticalScroll call.


The reason is simple - since you don't know in what order the BB framework invokes fields' methods, you want to make sure your setVerticalScroll runs after the UI engine has completely finished the layout update.


See if that helps.

please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
New Contributor
Posts: 6
Registered: ‎05-08-2012
My Device: BB 9800
My Carrier: At&t

Re: field.updateLayout cause scroll to top

@arkadyz  : 

thanks a lot for you reply. will try this out.