TList Next and Prev Item ?

BlitzMax Forums/BlitzMax Beginners Area/TList Next and Prev Item ?

GregBUG(Posted 2005) [#1]
Hi!!!

and sorry for my questions about TList but now i'm study how blitzmax manage it...

now the question...

i have a tList with n elements on it...

i can browse the list with "for .. eachin" OK

i can go to the first element with first() method... OK
i can go to the last element with last() Method... OK

but if i have an element that is in the middle of the list how can i get the next/previous one ?


thanks.


Koriolis(Posted 2005) [#2]
Quite frankly I'd be tempted to throw a RTFM here...
But here we go:
Get the TLink to your object by doing something like Local link:TLink = myList.FindLink(myObject)
Then use the link to travel back and forth the list, using link.NextLink() and link.PrevLink().

Just in case you genuinely don't have any idea where the info comes from, open the BlitzMax IDE, go to the Home tab, then Help>Modules>Litst.


GregBUG(Posted 2005) [#3]
Ok. Thanks Koriolis.

but you must admit that the "FM" is not so clean!
and "here" in the "beginners" area we are not all BlitzMax expert!

anyway thanks for your attention and answer.


EOF(Posted 2005) [#4]
This example shows how to navigate a list of items.
Complete with wrap-around:




Koriolis(Posted 2005) [#5]
but you must admit that the "FM" is not so clean!
Oh yeah, surely not :)
And I won't blame anyone for failing to find the information, not when the post is in the beginner's forum, like you say. Was just being sarcastically rude, kinda :p
Well maybe a bit more seriously rude, because some people really don't even try.


GregBUG(Posted 2005) [#6]
@jb (nice example! thanks)
@Koriolis thanks

thanks guys!


Beaker(Posted 2005) [#7]
http://www.blitzbasic.com/Community/posts.php?topic=50285