TEXTGRIDCollection remove methods and getLastSelectedIndex

As you know, getLastSelectedIndex() method of TEXTGRIDCollection returns the index of the last selected item. According to the API it should return -1 when no line is selected.

When I remove the selected line, I also expect it to return -1. However it depends on which remove method you use :!:

If you use remove(Object) method it works as it should and returns -1. But if you use remove(int) method it returns the index of the DELETED LINE :!:

…just had a look into our code: both remove()-methods do no have any effect on the getLastSelectedIndex(). It just behaves differently because when removing the selected line you must have one line selected…

Please only use “getLastSelectedindex()” when reacting on object selection.

Bjoern

Don’t you think remove methods should change the getLastSelectedIndex() (If you remove the selected line, it should be -1, otherwise it should remain the same) :?:

Because getLastSelectedIndex() method reflects the internal state of the collection. And when you remove an item from the collection, the state changes :!:

You said:

I think use should post this information to the API too.