MoveElement()
Syntax
MoveElement(List(), Location [, *RelativeElement])Description
Moves the current element of the specified list to a different position in the list. The moved element remains the current element of the list. This is a fast operation because the element data itself is not moved to change the location in the list.
Parameters
List() The name of your list variable, created with the NewList function. You must include the brackets after the list name. Location Location where to move the current element. This can be one of the following values: #PB_List_First : Move the element to the beginning of the list #PB_List_Last : Move the element to the end of the list #PB_List_Before: Move the element before the *RelativeElement #PB_List_After : Move the element after the *RelativeElement*RelativeElement (optional) The address of another element in relation to which the current element should be moved. This parameter is required when the 'Location' parameter is #PB_List_Before or #PB_List_After. You can get this address from an element by using the @ operator on the list name.
Return value
None.
Example
NewList Numbers() For k=0 To 10 AddElement(Numbers()) Numbers() = k Next SelectElement(Numbers(), 5) *Relative = @Numbers() ; get address of element 5 SelectElement(Numbers(), 0) MoveElement(Numbers(), #PB_List_After, *Relative) ; move after element 5 SelectElement(Numbers(), 10) MoveElement(Numbers(), #PB_List_First) ; move to the beginning ; Result ; ForEach Numbers() Debug Numbers() Next
See Also
SwapElements()
Supported OS
All