#include Once "window9.bi"

Function GetFirstItemTreeView(iGadget As Long) 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 iterfirst 
	
	If gtk_tree_model_get_iter_first(treestore , @iterfirst) Then
		
		If iterfirst.stamp Then
			
			Return Cast(Integer , iterfirst.user_data)
			
		Endif
		
	Endif
	
End Function