#include ONCE "window9.bi"

sub SetSelectListViewItem( iGadget as Long , iItem as Long) export

	dim as any ptr listview = GadgetId(iGadget)
	
	dim as GtkTreeSelection ptr selection = gtk_tree_view_get_selection (listview)
	
	dim as GtkTreePath ptr path_begin , path_end
	
	if iItem = -1 then
	
		path_begin = gtk_tree_path_new_from_indices(0, -1)
		
		path_end = gtk_tree_path_new_from_indices(GetItemCountListView(iGadget) -1, -1)
		
		gtk_tree_selection_select_range (selection , path_begin , path_end)
		
		gtk_tree_path_free(path_begin)
		
		gtk_tree_path_free(path_end)
		
	else
	
		path_begin = gtk_tree_path_new_from_indices(iItem, -1)
		
		gtk_tree_selection_select_path(selection, path_begin)
		
		gtk_tree_path_free(path_begin)
	
	endif	

End Sub