#include Once "window9.bi"

Function GetNextItemTreeView(iGadget As Long , iItem As Integer) As Integer
	
	Dim As Any Ptr treeview = Gadgetid(iGadget)
	
	Dim As Any Ptr treestore = Cast(Any Ptr , gtk_tree_view_get_model(treeview))
	
	Dim As GtkTreeIter iterChild , iterfirst 
	
	If gtk_tree_model_get_iter_first(treestore , @iterfirst) Then
		
		iterChild.stamp = iterfirst.stamp
		
		iterChild.user_data = Cast(Any Ptr,iItem)
		
		If gtk_tree_model_iter_next(treestore, @iterChild) Then
			
			If iterChild.stamp Then
				
				Return Cast(Integer , iterChild.user_data)
				
			Endif
			
		Endif
		
	Endif
	
End Function