epicsapis
Member
I have a list of elements and I need to do some elements reordering without moving the element in to top (because that would have an undesirable visual effect), so, I can't use `ele.bringToFront` at any time.
Basically I need the ability to switch the position of two element without moving the others.
Example:
Also, I need the ability to reverse the order of all the elements except the three of them. Example:
Basically I need the ability to switch the position of two element without moving the others.
Example:
Switch the order of two elements:
'My List
Dim elems As List = ["Apple", "Boy", "Car", "Daniel", "Enter"]
'The function I need
elems = switchOrder(elems, 1, 4)
'Output
'["Apple", "Enter", "Car", "Daniel", "Boy"]
Also, I need the ability to reverse the order of all the elements except the three of them. Example:
Switch the order of two elements:
'My List
Dim elems As List = ["Apple", "Boy", "Car", "Daniel", "Enter", "Fast", "Gas", "Hot"]
'The function I need
elems = reverseExcept(elems, 0, 1, 7)
'Output
'["Apple", "Boy", "Gas", "Fast", "Enter", "Daniel", "Car", "Hot"]
'Note that "Enter" didn't change the position because there's an odd number of reorder elements
'in the case of an even number of elements, all the elements (except the the index 0, 1 and 7) should change