#include Once "window9.bi"

Function Gettexttreeview(iGadget As Long , iItem As Integer) As String Export
	
	Dim As Any Ptr treeview = Gadgetid(iGadget)
	
	If treeview = 0 Then Return ""
	
	Dim As Any Ptr model
	
	Dim As Zstring Ptr pszTempString
	
	Dim As GtkTreeIter iter , iterfirst		
	
	model =  gtk_tree_view_get_model(treeview)	
	
	If iItem <> 0 Andalso iItem <> -1 Andalso gtk_tree_model_get_iter_first(model , @iterfirst) Then
		
		iter.stamp =  iterfirst.stamp
		
		iter.user_data = Cast(Any Ptr,iItem)
		
		gtk_tree_model_get(model, @iter, 1, @pszTempString,  -1)
		
		Return *pszTempString
		
	Endif
	
End Function