#include Once "window9.bi"

Function Gettopindexlistbox (iGadget As Long) As Long Export 
	
	Dim As GtkWidget Ptr listbox = Gadgetid(iGadget)
	
	Dim As GtkTreePath Ptr path
	
	Dim As Any Ptr column 
	
	Dim As Gint cell_x , cell_y
	
	gtk_tree_view_get_path_at_pos (Cast(Any Ptr ,listbox), 1,1, @path, @column, @cell_x,@cell_y)
	
	gtk_tree_view_scroll_to_cell(Cast(Any Ptr ,listbox) , path , False , False,0,0) ' align rows on the upper edge 

	Function = *gtk_tree_path_get_indices( path )	
	
	gtk_tree_path_free(path)

End Function