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
Trusted Contributor
Posts: 109
Registered: ‎11-15-2011
My Device: blackberry 9800
My Carrier: beginner developer

scroll bar paging : adding page indicator

[ Edited ]

Hi,

 

I want to add scroll bar paging with page indicator. The indicator page is like in this picture  indicator: I have 5 pages and the blue circle indicate the current page. There is blackberry application uses this indicator. How can I add this indicator????

 

thanks

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

Re: scroll bar paging with page indicator

I am not aware of a control that does this natively in BlackBerry.  I think you will have to do this yourself.  Other people have asked similar questions.  Look for various other similar Threads on this forum that have discusses Horizontal Scrolling for ideas on how to do this. 

Trusted Contributor
Posts: 109
Registered: ‎11-15-2011
My Device: blackberry 9800
My Carrier: beginner developer

Re: scroll bar paging with page indicator

Thanks  for your  reply 

When I search about Horizontal Scrolling, I find the problem of scrolling or how to make new page but there is no indication how to make the indicator of pages

Developer
Posts: 17,017
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: scroll bar paging with page indicator

in some rare cases it is rumored that somebody had to code something himself, maybe this is the case here.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: scroll bar paging with page indicator

[ Edited ]

Simon is right, you have to code this.

 

There are actually a variety of ways of doing it.  The easiest I think is to override sublayout and make the HFM slightly larger giving you space to add the indicators at the bottom.  Then override paintBackground to paint the dots depending on the number of Fields you have in your HFM.

 

This is non trivial code, if you are struggling to understand what I am talking about then I think this is a step too far.  Start with something simpler.  

 

As an example, write your own Manager that extends HFM and remembers the Field that was in focus, when it looses focus (onUnfocus).  Then, when the HFM gets focus back (onFocus) through scrolling (trackpad), it makes this Field is in Focus, not the one at the start or end, which is what it will normally do (try it and see).  You have to write this anyway for your page indicator, so this will be good practice. 

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

Re: scroll bar paging with page indicator

If you are looking for ideas on how to implement it, take a look at the following knowledge base article:

Implementing a standard style scrollbar

It talks about a scrollbar for vertical scrolling but should be easy to customize to do horizontal instead. Then take the code actually painting the scrollbar and modify it to suit your needs.

There are some comments in the article, including one with a slightly different approach (VerticalOverlayScrollManager).  Compare the two approaches - this will be a very good exercise, directly relevant to what you are trying to achieve.

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