Collections are not arrays. So is I have a collection based listbox and
want to have a control to allow the user to move a selected element within
the collection how do I do that?
One way would be to allow her to drag and drop the element to the new
position. The other way is a spinner of some sort to allow moving a
selected element up or down. In both cases I need to actually move the
element within the collection.
Here is a method I came up with. It takes a collection, the selected
element index and a 'direction'. This is simply the number of places to
move the selected element. Positive moves it 'up' the list and negative
'down'. I did not follow 4D's approach to these sorts of things and wrap
the movement. In my method if the collection won't support the requested
move nothing happens.