Determine previous and next node

BlitzMax Forums/BlitzMax GUI Programming/Determine previous and next node

Hi !
Need some idea to code that :
Have a node. Inside this node somes childs nodes. If i select a child node, how to determine the previous or the next node (without use my own list) ?

- Men
   -- Jeremy
   -- Mark (selected)
   -- David

if i click on a 'next' button i want select David
if i click on a 'prev' button i want select Jeremy

Thanks for your help !

If you mean the TreeView Gadget, this should do it:
Function SelectPreviousNode:Int( node:TGadget)
	If Not node Or Not node.Parent Then Return False
	Local l:TLink = node.Parent.kids.FirstLink()
	While l
		If l.Value() = node Then
			Local t:TLink = l.PrevLink()
			If t Then
				SelectTreeViewNode( TGadget( t.Value()))
				Return True
			Else
				Return False
			EndIf
		EndIf
		l = l.NextLink()
	Wend
	Return False
EndFunction

Function SelectNextNode:Int( node:TGadget)
	If Not node Or Not node.Parent Then Return False
	Local l:TLink = node.Parent.kids.FirstLink()
	While l
		If l.Value() = node Then
			Local t:TLink = l.NextLink()
			If t Then						
				SelectTreeViewNode( TGadget( t.Value()))
				Return True
			Else
				Return False
			EndIf
		EndIf
		l = l.NextLink()
	Wend
EndFunction


Just a reminder that this may not work on OS X as discussed here

- David

Thanks !