I’ve observed what seems to be a bug.
Say you have a ListBox connected to a ListBoxModel that has two rows. If you click on the second row, the ListBoxModel will get a callback to selectedRowsChanged() with lastRowSelected == 1. This is fine.
Now say that something causes the ListBoxModel to delete that row. Let’s say we have a Button, hooked up to a controller class that is a ButtonListener. When the Button is clicked, the controller object is notified via an event, and the controller then asks the ListBoxModel to delete the second row. After doing so, the ListBoxModel might then generate an event (saying the model’s state has changed). The ListBox might be a listener for this kind of event, so it calls updateContent() to refresh the view of the model.
At this point, ListBox will callback to the ListBoxModel’s selectedRowsChanged() function, with lastRowSelected == 0. However, the row is not actually selected – the call to ListBoxModel’s paintListBoxItem() function, when rowNumber == 0, will have rowIsSelected == false.
In other words, if a ListBox says row N in a ListBoxModel selected, and row N is deleted by the ListBoxModel, ListBox will say that row N-1 is selected in the selectedRowsChanged() callback to the model, but the call to paint shows row N-1 as not selected.