GetListNext
CurrentPos = GetListNext(List())
 
Parameters:

    List() = The Type list handle you want to query
Returns:

    CurrentPos = The next position index of this list
 

      The GetListNext() function retrieves the Next position index (the position after the current index) from the queried linked list. If the next index is the end of the list, then GetListNext will return a -1




FACTS:



      * Don't know what a linked list is ?, make sure you read the LinkedLists tutorial then.





Mini Tutorial:


      This example creates a list of three people, then runs through the list manually and displays each persons names and their list position.

  
; Declare the "Person" user defined type.
  Type Person
   ; These Fields will hold this persons name
     FirstName$
     SurName$
  EndType
  
;  Dimension the Friends variable of type Person,
; with linked list support
  Dim  Friends As Person List
  
  
; Add a person (Billy) to Friends list
  Friends= New Person
  Friends.FirstName$ ="Billy"
  Friends.Surname$ ="Citizen"
  
  
; Add another person (Sally) to Friends list
  Friends= New Person
  Friends.FirstName$      ="Sally"
  Friends.Surname$           ="Stevens"
  
; Add another person (Sally) to Friends list
  Friends= New Person
  Friends.FirstName$      ="Olivia"
  Friends.Surname$           ="Dude"
  
  
  
; Aak the list what cell is at the front/start of the list
  ThisLInk=GetListFirst(Friends())
  
;Enter a while loop providing the link is above 0
  While ThisLink>0
     
   ; Manually Set our Current position in the list
     SetListPos Friends(),ThisLInk
     
   ; Display this persons current position.
     Print "List Position="+Str$(GetListPos(Friends()))
     
   ; Display this persons name
     Print Friends.FirstName$+" "+Friends.Surname$
     Print ""
     
   ; Ask the list for the Next LINK to move forward through
   ; the list.
     ThisLink=GetListNext(Friends())
     
  EndWhile
  
; display the screen and wait for a key press
  Sync
  WaitKey
  
  




This example would output.

  
  List Position=3
  Olivia Dude
  
  List Position=2
  Sally Stevens
  
  List Position=1
  Billy Citizen
  
  

 
Related Info: Each | EndOfList | GetListFirst | GetListPos | GetListPrevious | GetListSize | LinkedLists | List | SetListPos | StepList :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com