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: 660
Registered: ‎10-08-2009
My Device: Bold 9900
My Carrier: Telus

VerticalFieldManager initial scroll position

hi, I have question about how to set the initial scrolled position of the verticalfieldmanager.

 

So I have a verticalfieldmanager that have height of double screen height. Is it possible to set the initial scrolled position of the verticalfieldmanager to the middle?

 

If I had fields are are focusable, I can create similar effect but can this be done without focusable fields?

----------------------------------------------------------
Twitter: @gyubok
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: VerticalFieldManager initial scroll position

I have had some weird effects with some screens when there are no focusable Fields.  In theory you should be able to do it with setVerticalScroll, but I am not guaranteeing that will work on all levels, especially on non touch screen phones. 

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

Re: VerticalFieldManager initial scroll position

I worked a lot with such screens (without focusable fields) and setVerticalScroll always did it for me. However, I'd advise against setting the scrolling position in the same program flow as adding the manager. Delay it until the adding is properly done by wrapping your setVerticalScroll with invokeLater. You can also investigate NO_SCROLL_RESET flag on the manager.

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Developer
Posts: 30
Registered: ‎02-02-2012
My Device: 9780
My Carrier: DU. UAE

Re: VerticalFieldManager initial scroll position

[ Edited ]

You can set the vertical scroll at the middle of the Screen by using the code

 

if (Display.getHeight() < mainMgr.getVirtualHeight()) {
				mainMgr.setVerticalScroll(mainMgr.getVirtualHeight()
						- mainMgr.getHeight();
			}

 

If you dont have focusable field in your main manager, add(new NullField(NullField.FOCUSABLE)) ; inbetween the fields.

 

Thanks and Regards,

  Meera Manesh