[Project_owners] How do I select a non-visible listbox item?

Soyapi Mumba soyapim at gmail.com
Tue Jun 20 15:17:18 EDT 2006


I have a simple 1 column list box and I want to programmatically select an item 
just after appending it to the listbox.

It works well when all items (including the newly appended item) are visible. 
But if the list grows beyond the number of visible rows, the added items cannot 
be selected. With a mouse-click, they can be selected but not highlighted.

I'm using:

> var li = myListBox.appendItem(newName, newId);
> // myListBox.ensureElementIsVisbible(li);
 > // myListBox.scrollToIndex(myListBox.getIndexOfItem(li));
> myListBox.selectedItem = li;

I've tried but haven't had any luck with ensureElementIsVisible() and 
scrollToIndex() (commented above) either.

Any suggestions?

- Soyapi
Soyapi Mumba

More information about the Project_owners mailing list