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
Contributor
xtravanta
Posts: 46
Registered: ‎03-25-2011
My Device: Blackberry Z10
Accepted Solution

ListView current visible item index

Hi,

 

maby somebody here knows how to do this,

i've got a ListView that only shows 1 item at the time in (scrolling in a horizontal direction)

what signal do i use or how do i get the currently selected item index

this is required because of this example:

 

|--------------------|
|        listview        |
|         item 1        |
|--------------------|
           1/10
 

|--------------------|
|        listview        |
|         item 4        |
|--------------------|
           4/10

 

 

Thx

 

Developer
Zmey
Posts: 1,523
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: ListView current visible item index

ListScrollStateHandler can be used to find the first visible item:

http://developer.blackberry.com/cascades/reference/bb__cascades__listscrollstatehandler.html#propert...

Two items can be shown at the same time during scrolling, so I guess additional code will be needed to determine which one is occupying the largest part of the screen.

 


Andrey Fidrya, @zmeyc on twitter