Insert Before/After

BlitzMax Forums/BlitzMax Beginners Area/Insert Before/After

MattVonFat(Posted 2005) [#1]
I remember not knowing why anyone would want to do that in B+ but now I'm using BitzMAX I need it. I couldn't find any commands like it in the module list so is it even possible?


tonyg(Posted 2005) [#2]
Search for InsertAfterLink and InsertBeforeLink.
There's been a lot of discussion, lots of examples/code
and functions to work as per BB


EOF(Posted 2005) [#3]
quick example:
Function InsertAfter(list:TList,a:Object,b:Object)
    list.InsertAfterLink(b,list.FindLink(a))
End Function

Function InsertBefore(list:TList,a:Object,b:Object)
    list.InsertBeforeLink(b,list.FindLink(a))
End Function


' example

Local t:TList=New TList
t.AddLast "Hello"
t.AddLast "world"

InsertAfter t,"Hello","my"
InsertBefore t,"world","magic"

For Local a$=EachIn t
Print a$
Next