Quote Originally Posted by Leif0311 View Post
Why do you suggest to select the last item in the list?
This may conflict with the users selection before the list contents changed.
I would suggest to leave the current selection where it is as long as the selected item stays in the list.

The list object seems to rebuild the whole list and reset the selection to 0 each time an item is added.
Not sure if this could be changed and how complex that would be.

Not touching this code and just resetting the selection to whatever after the list rebuild finished sounds easy but may cause the next problem.
What happens if the user clicks the rezz button and the list is being rebuild at the same moment?
You will have two threads competing, one rebuilding the list and changing the selected index to 0 and back (or to the new last item) and another one sooner or later calling something like "getSelectedIndex".
If the two threads are not synchronized regarding setting/getting the selected index, you may still get index 0 by chance.
Leif,
Not worried about going to the last one or conflicts because this code is serial in nature. I like the idea of using "current index" but that adds some difficulty to the programming. I don't know how the AoC code is laid out. If it is all in a single function/method for resurrection, then we could set the current index and use it but if the code is what i think it is, they are using multiple methods/functions to populate the listbox. This would require passing the "selected" index through multiple functions/methods and that would complicate the fix.

It used to be the "last in the listbox" was chosen. I would take that over what we have today and call it a win...