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

Native Development

Reply
Developer
nareshkodumuri
Posts: 125
Registered: ‎04-28-2012
My Device: BlackBerry 9800
My Carrier: BlackBerry

How to check whether list is scrolling up or not?

Hi,

    

    I want to check whether list is scrolling up or down.I am using ListScrollStateHandler + atEnd property to check whether the list is at the end or not.At end if i scroll up i want to download images and if it is down i won't do anything. please provide me the solution.

 

Regards,

Naresh Kodumuri.

Please use plain text.
Developer
Developer
lew
Posts: 174
Registered: ‎03-05-2009
My Device: Dev Alpha
My Carrier: -

Re: How to check whether list is scrolling up or not?

you can simply handle the touch() event on the list view to detect the scroll direction?

 

onTouch:{

 if(event.isMove()){

 //event.windowY(); //store y position as it moves and detect whether y-difference is negative or positive for scrolling direction

 }

}

 

i'm not sure of the reason why you need this, but if you are downloading thumbnails for your list items, you might want to look at this sample:

https://github.com/blackberry/Cascades-Samples/tree/master/tldr

the ListView handles the async loading pretty well (even with the images as shown in the sample), so no need to re-invent the wheel :smileyhappy:

Please use plain text.
Developer
strobejb
Posts: 267
Registered: ‎10-15-2012
My Device: bb10 developer
My Carrier: Orange

Re: How to check whether list is scrolling up or not?

The ListScrollStateHandler tells you if the list is scrolling or not, but doesn't seem to provide the direction:

 

https://developer.blackberry.com/cascades/reference/bb__cascades__listscrollstatehandler.html

 

I would put a LayoutUpdateHandler inside the ListItemComponent for the listview, and detect changes in the layoutFrame.y property

Please use plain text.