#include ONCE "window9.bi"

function GetListBoxText (iGadget as Long , iItem as Long) as string export

	dim as GtkListStore ptr liststore
	
	dim as GtkTreeIter iter
	
	dim as Long iIndex
	
	dim as Long iRet
	
	dim as zstring ptr item_s	
	
	dim as Hwnd listbox = GadgetId(iGadget)	
	
	liststore = cast(any ptr , gtk_tree_view_get_model(cast(any ptr,listbox)))	
	
	dim as GtkTreePath ptr path = gtk_tree_path_new_from_indices(iItem, -1)

	if path then
	
		gtk_tree_model_get_iter(cast(any ptr,liststore) , @iter , path)		
		
		if iter.stamp then
	
			gtk_tree_model_get(GTK_TREE_MODEL(liststore), @iter, 1, @item_s,  -1)
			
			function = *item_s

		EndIf
		
		gtk_tree_path_free(path)				

	EndIf					
	
End Function