Shifting Items up and down

There are two functions, *TB.ShiftUp()* and *TB.ShiftDown()* that allow to shift table items, here is a bried example provided with the library:

Function TB.TEST_Shift()
  EscapeQuit(True)
  
  ; I've added spaces to simplify the output formatting
  Local items1 = { "Jhonny ", "Michael", "Henry  ", "Mark   ", "Ryan   ", "Cody   ", "Fred   ", "Jim    ", "Paul   ", "Sam    " }  
  Local items2 = CopyTable(items1)
  
  Repeat
    Cls
    Locate(0, 0)
    NPrint("ESC to Quit")
    NPrint("")
    NPrint("ShiftUp   ShiftDown")
    NPrint("-------------------")
    For i = 0 To 9 Do NPrint(i, items1[i], items2[i])
    NPrint("")
    TB.ShiftUp(items1)
    TB.ShiftDown(items2)
    Wait(150, #MILLISECONDS)
  Forever
  
EndFunction
hollywoodlibs/tables/testshift.txt · Ultima modifica: 2016/10/21 09:42 da admin
CC Attribution-Noncommercial 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0