12-16-2009 10:59 AM
I want to implement a scrollable list with 20-50 items, and each row item will have a pretty complicated set of information to display, including images and text loaded from the web and text and images loaded from the device.
I searched the forums a little bit and noticed people had two primary approaches.
Custom VerticalFieldManager or a custom ObjectListField where they override the drawListRow function.
In terms of implementing something like this are those the only two options I have? And in terms of performance which one would be better to implement a list with 20+ items, where each row has a pretty complicated layout?
Solved! Go to Solution.
12-16-2009 11:06 AM
objectlistfield offers a good performance and would be much closer to the use case.
i would suggest to create a custom object with all the things displayed as attributes, analyze it in the drawListRow method to customize the painting.
12-16-2009 11:16 AM
I first attempted to implment this with a VerticalFieldManager, and i noticed when i scroll through the list i get sluggish perfomance because it must repaint each visible item as it scrolls. I'm sure i probably didn't implement this in the best way...
but does an ObjectListField not do this?
12-16-2009 11:23 AM
objectlistfield repaints items only if they are focused, unfocused or scrolled in/out.
12-16-2009 11:36 AM
Simon - Ah! perfect, hopefully that should increase the perfomance of scrolling. One other question, do you recommend that i use the ObjectListField as is, or extend the ListField class and create a custom ObjectListField? I guess some of the preconditions are obviously custom rows with dynamic web data, and also a custom onFocus background image.
Eugen - Whew! Luckily it is a requirement that all of my row items are the same height. But is there something else you would use if they weren't the same height?
12-16-2009 11:45 AM
I use objectlistfield in pretty much every application, thus i have written my own extension of the listfield class. It provides numerous advantages, for example allowing to add a vector, set a vector, customizing the focus color or retrieving the selected object. can't share the code of course, but it is not that hard to implement and easy to enhance if needed.
I would recommend that you take an hour or two and implement an objectlistfield as you want it, saves a lot of time later on.
As for the different heights: You could use the hidden setRowHeigt(index, height) method, but i would not recommend it.
Better to adjust the requirements