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: 436
Registered: ‎06-22-2010
My Device: na
My Carrier: blackberry developer

How to scroll only one image at a time in HorizontalScroll

I have a list of images which i am adding in a HorizontalFieldManager.Each Image occupy the entire screen.If i scroll the entire view is scrolling and focus is also going to 4-5 images.I want that when i scroll forward or backward only the image image should come to view and it should not scroll the entire view.Any idea how can i achieve it?

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

Re: How to scroll only one image at a time in HorizontalScroll

Have a separate HFM with just your images in it. 

 

If this is not an answer, please explain your problem with a little more detail, specifically explaining which Managers you use and how they are contained, which Managers are scrolling and which you want to scroll. 

Developer
Posts: 436
Registered: ‎06-22-2010
My Device: na
My Carrier: blackberry developer

Re: How to scroll only one image at a time in HorizontalScroll

Actually i am taking a HFM and adding it to the mainscreen.In that HFM i am adding 5 images with each image occupying the entire screen.I have made HorizontalFieldManager as (Horizontal_Scroll).Now say when i scroll forward  it scroll and keeps scrolling till the last image,same for backwrad scroll.What i want is that,when i scroll,only the next image should come to view,again wehn i sroll the next image should come to view instead of scrolling till the end

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

Re: How to scroll only one image at a time in HorizontalScroll

Are the images focusable?  If not, then try it with them being focusable. 

 

Does this happen when you use the trackpad?  Does this happen when you swipe with your finger?

Developer
Posts: 436
Registered: ‎06-22-2010
My Device: na
My Carrier: blackberry developer

Re: How to scroll only one image at a time in HorizontalScroll

When i swipe fingers it happens

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

Re: How to scroll only one image at a time in HorizontalScroll

And the answers to my other questions are ....

Developer
Posts: 436
Registered: ‎06-22-2010
My Device: na
My Carrier: blackberry developer

Re: How to scroll only one image at a time in HorizontalScroll

Image is focuable

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

Re: How to scroll only one image at a time in HorizontalScroll

OK, I think we are in a position to clarify your requirement.  I think the problem only happens on touch screen devices - you do not see it on trackpad devices.  On touch screen devices, i think you see one of these two as an issue:

 

1) when the user swipes the image, you only want the scroll to move a single image

 

or

 

2) when the user swipes the image, the scroll stops displaying part of two images, but you want to have it dcentred on one image. 

 

Which of these is your problem, or have I got it wrong?

Developer
Posts: 436
Registered: ‎06-22-2010
My Device: na
My Carrier: blackberry developer

Re: How to scroll only one image at a time in HorizontalScroll

actually i want 1) to happen

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

Re: How to scroll only one image at a time in HorizontalScroll

I am not sure how this could be done, I have never tried to do this.

 

If I was trying I would first try the following:

 

a) Turn the Inertial Scrolling off

<manager>.setScrollingInertial(false);

 

b) Set the quantization so that scrolling will only go to full images:

<manager>.setHorizontalQuantization(<width of image>)

 

Let us know how you get on with this!

 

If this does not work, we can try overriding touchEvent.