ChangeCurrentElement()

Syntax

ChangeCurrentElement(LinkedList(), *NewElement)
Description
Changes the current element of the specified list to the given new element. The new element must be a pointer to another element which exists in this list. This function is very useful if you want to "remember" an element, and restore it after performing other processing. It should be used with care and only by advanced users.

Parameters:
LinkedList() - The name of your linked list variable, 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 linked list. You should get this address by using the @ operator on the list name and not through any other method.

Return value:
This function does not return anything.

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)

Supported OS

All

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