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: 133
Registered: ‎07-20-2009
My Device: Not Specified

Vertical scroll to certain point

Dear all,

 

I have a field would like to auto scroll it down to certain position

 

by  field.getManager().setVerticalScroll(7360);

 

But , after i set it up, it still only on the beginning 

 

Anyone know how to do that?

 

Developer
Posts: 984
Registered: ‎02-10-2009
My Device: Not Specified

Re: Vertical scroll to certain point

Try with creating a vertical manager int the below way and add the field in the manager.

VerticalFieldManager vfm = new VerticalFieldManager (Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR) { protected void sublayout(int maxWidth, int maxHeight ) { int w = Display.getWidth(); int h = 7360; super.sublayout(w, h); setExtent(w, h); } };

 

Regards

Bikas

Developer
Posts: 133
Registered: ‎07-20-2009
My Device: Not Specified

Re: Vertical scroll to certain point

after, I try to set my screen.setVerticalScroll(7360) in the MainScreen also make the MainScreen  with MainScreen.VERTICAL_SCROLL | MainScreen.VERTICAL_SCROLLBAR. However, it still throw "ava.lang.IllegalStateException: Attempting to scroll a non scrollable manager."

 

 

anyone can help? 

Developer
Posts: 133
Registered: ‎07-20-2009
My Device: Not Specified

Re: Vertical scroll to certain point

thanks you for your reply.

 

After i do that I can scroll to the certain position , but I got two problem.  

First will i scroll down by myself it immediately go back to beginning first and scroll, can not scroll down from the certain position

Second when i use vfm.getVerticalScroll, i only can get 0 for any position.

 

 

can you help me to solve this two problem?

Thanks you for your attention and help 

Developer
Posts: 984
Registered: ‎02-10-2009
My Device: Not Specified

Re: Vertical scroll to certain point

Can you describe a little bit more about, exactly what are you trying to achieve.

 

Regards

Bikas

Developer
Posts: 133
Registered: ‎07-20-2009
My Device: Not Specified

Re: Vertical scroll to certain point

I am show some content on a field, the content is very very long

I would like to save the position , then i can read the content start from that position

Don;t need to read the content from the beginning. 

Developer
Posts: 984
Registered: ‎02-10-2009
My Device: Not Specified

Re: Vertical scroll to certain point

I am still not sure exactly your requirement.

 

But you can try something like below. Just a rough idea, maybe there are better approaches.

1. Divide your content into parts based on the height you want to set scoll position.

2. Place NullField inbetween the  divided contents.

3. override keylistener

4. manually set focus to the NullField from keylistener after keypress (up/down).

 

 

Regards

Bikas

Developer
Posts: 133
Registered: ‎07-20-2009
My Device: Not Specified

Re: Vertical scroll to certain point

Thanks you for your suggestion

 

May be i should say like that:

I am read a book, i would like to make a book mark.

Next time, i can read the book start from the book mark.

 

The problem is, I can auto scroll to the certain point of book mark, but while i scroll it, it will go back to the beginning of the book.

 

So I think you idea is good, but is not suitable to doing a book mark, because i would not know where the user will book mark the page.

 

Do you have more more idea? 

Developer
Posts: 133
Registered: ‎07-20-2009
My Device: Not Specified

Re: Vertical scroll to certain point

did i explain it more clear this time?
New Contributor
Posts: 9
Registered: ‎08-08-2011
My Device: 9800
My Carrier: 9800

Vertical scroll to certain point

Hi,

 

I have a field in VerticalFieldManager, now i want to auto scroll my VerticalFieldManager to a certain position. if i try to use 

Field.getManager().setVerticalScroll(position);

it shows the Error that   "illeagal State Exception". Please let me know what u have done to solve that problem.

Please help me as soon as possible..

 

Thanks in advance.