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
Jeff_Lu
Posts: 384
Registered: ‎08-12-2008
My Device: 8700

how to set display position on Screen

Hi All,

 

As you know, if we normal pushScreen to forground, it will display the item from top to the bottom.

 

 

For example, I have VerticalFieldManager and add more than 10 Fields to it.

 

The screen only holds this VerticalFieldManager, what I want to do,

 

when screen is first pushed to forground, I like the fifth item is displayed on the top of the screen.

 

if user scrolls up, those before the fifth field will show up.

 

how to control this case.

 

I know that RIM Message does this case, when you open a message, always subject is on the top of the screen.

 

Thanks

 

 

 

 

 

 

 

 

 

 

Please use plain text.
Administrator
MSohm
Posts: 14,362
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: how to set display position on Screen

You could set the scroll location when the screen is displayed.  This thread has an example on how to scroll to specific locations.

 

http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&message.id=12088&query.id=12...

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
Developer
Jeff_Lu
Posts: 384
Registered: ‎08-12-2008
My Device: 8700

Re: how to set display position on Screen

Hi Mark,

 

I have tried with the sample that you referred. however, I have no luck,

 

I always get IllegalStateException to tell me i want to scroll on a manager that is not scrollable.

 

I do not know what is wrong with my application.

 

here is my source code.

public class UrlContentCheck extends UiApplication implements Runnable{ public static void main(String args[]){ UiApplication theApp = new UrlContentCheck(); theApp.enterEventDispatcher(); } UrlContentCheck() { DScreen d = new DScreen(); pushScreen(d); d.setScrollPosition(); } class DScreen extends MainScreen { LabelField lf; DScreen() { super(Manager.VERTICAL_SCROLL); lf = new LabelField("1"); this.add(lf); lf = new LabelField("2"); this.add(lf); lf = new LabelField("3"); this.add(lf); lf = new LabelField("4"); this.add(lf); } public void setScrollPosition() { setVerticalScroll(lf.getHeight()*2); } } }

and my simulator is version 4.3 on 8130.

 

Thanks

Please use plain text.
Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: how to set display position on Screen

You also need to set the style bit VERTICAL_SCROLLBAR

 

"or" this bit with the VERTICAL_SCROLL style that you already set.

 

Please use plain text.
Developer
Jeff_Lu
Posts: 384
Registered: ‎08-12-2008
My Device: 8700

Re: how to set display position on Screen

I have 'or'-ed that bit VERTICAL_SCROLLBAR,

still have no luck!.

 

Thanks

 

Please use plain text.
Developer
Guest
Posts: 146
Registered: ‎11-05-2008
My Device: Not Specified

Re: how to set display position on Screen

use a vertical manager which will be scrollable,add lebels to this manager.And on this manager set the function setVerticalScroll and it will be controlled using navigationMovement method.And set NO_VERTICAL_SCROLL property within super.
Please use plain text.
Administrator
MSohm
Posts: 14,362
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: how to set display position on Screen

Also note that manager's only scroll to focusable fields.  If none of your LabelFields are focusable then scrolling won't be enabled.  If you don't want focusable fields visible to the user you can add focusable NullFields to your screen.  These will allow the user to scroll but won't be visible.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.