ChangeCurrentElement()

Syntax

ChangeCurrentElement(List(), *NewElement)
Description
Changes the current element of the specified list to the given new element. This function is very useful if you want to "remember" an element, and restore it after performing other processing.

Parameters

List() The name of the list, created with the NewList function. You must include the brackets after the list name.
*NewElement The new element to set as the current element for the list. The element must be a pointer to another element which exists in this list. You should get this address by using the @ operator on the list name and not through any other method.

Return value

None.

Example

  *Old_Element = @mylist()   ; Get the address of the current element
  
  ResetList(mylist())        ; Perform a search for all elements named
  While NextElement(mylist())   ; "John" and change them to "J" 
    If mylist()\name = "John"
      mylist()\name = "J"     
    EndIf 
  Wend     
  
  ChangeCurrentElement(mylist(), *Old_Element) ; Restore previous current element (from before the search)

See Also

SelectElement()

Supported OS

All

<- AddElement() - List Index - ClearList() ->