ListBoxModel Question


int getNumRows() { return 2; }

Why does

rowNumber go upto 1;

and this rowNumber

gos up to 7

Looks like the refreshComponentForRow rowNumber gives you the max number of components that “can be there based on height”, because when changing the height of the list box to less it reports less rows.

I guess what I’m getting at is this:

I have a list box with some custom components “Labels” and I have an object for each label that keeps info like the name or text for each label, stored in an array in my ListBoxModel object. I jump out of range when the list is scrolled or when the list has less items then it could have based on its height. So I have to do this to make it work when refreshComponentForRow is called!

to refresh the Label text.

Im basically doing the same thing that the “Table Components” demo is doing, I have a method in my customRowComponent to update or set the row number which is called from refreshComponentForRow and have a pointer “owner” in my customRowComponent for my listBoxModel to get the text from my array of data, just like the demo has a dataList xml object. I also respond to labelTextChanged in my customRowComponent and call the owner to update the dataList info.

Does that make sense or am I doing something weird?


It might use more row components than you have items, because some of them are for blank rows. You should always check that the row number is in your active range. I’m sure there was a good reason for doing it this way, but it escapes me at the moment…


Everything works nice and dandy, It just took me an hour or so to make sure I wasn’t doing anything ridiculous.