2

I am using a listview to show some messages to the user, and I want to mark those messages as read when they appear on the screen. To do that, I would need to know if them were displayed or not. It is possible to do that? I know about firstvisibleItem(), however the height of the messages isn't static, so that solution wont solve my problem.

Any Idea?

Thanks

2 Answers2

0

I'v not worked with blackberry before, but I work with QML. From what I understood from your question you need to differentiate the read messages from the unread lets say by color. first thing cam to my mind is to make a flag in your List model that you can set from the delegate if the delegate of a specific index opened. I hope you got What I mean.

Baso
  • 1,354
  • 4
  • 19
  • 41
  • 1
    Hey! Thanks for the answer. I think the listview of cascades framework (used by BB10) doesn't have a delegate (http://developer.blackberry.com/native/reference/cascades/bb__cascades__listview.html). As I said above, when the element is visible on the listview, the message is read. I just need to intercept that moment! I was thinking about something in JS, some function that could be triggered when the item is visible on the screen. Thanks for the help – Filipe Figueiredo Apr 12 '14 at 00:26
0

I don't know if you will be able to accomplish this using a ListView. It is designed to handle very long lists efficiently, not necessarily keep track of what has or has not been displayed. There are three methods that I would look at if I was trying to solve this problem:

  1. Use a ListItemProvider to keep track of when the ListView calls for a renderable object associated with the list. This will probably not likely work very well because the ListView maintains visuals for items prior to and after those actually on the screen.

  2. Use a ListItemTypeMapper. Same comments for the ListItemProvider.

  3. Use a LayoutUpdateHandler. I've used these to find out how where and how big my custom controls are. I've never used them in a ListView so I don't know if the signal is fired at appropriate times to find out when a control is scrolled in and out of view.

Richard
  • 8,920
  • 2
  • 18
  • 24