[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

RE: How to remove all the selectd row in Treeview?



Document said that you can't make changes in this foreach.

-----Original Message-----
From: gtk-app-devel-list-admin@gnome.org
[mailto:gtk-app-devel-list-admin@gnome.org] On Behalf Of
martyn.2.russell@bt.com
Sent: Thursday, October 30, 2003 11:10 AM
To: tom.liu@flextrade.com; gtk-app-devel-list@gnome.org
Subject: RE: How to remove all the selectd row in Treeview?

> HI, 
> I made a list with TreeView, I want to remove all the select 
> rows, which
> function I should use?
> (the selection may have more than one row).


Set up a foreach scenario for all selected items:

	GtkTreeSelection *selection = NULL;

	selection = gtk_tree_view_get_selection(view);
	gtk_tree_selection_foreach(selection, remove_cb, NULL);

then in the callback:

	void remove_cb(GtkTreeModel *model, GtkTreePath *path,
GtkTreeIter *iter, gpointer userdata)
	{
		GtkTreeStore *store = NULL;

		store = GTK_TREE_STORE(model);
		gtk_tree_store_remove(store, iter);
	}


Regards,
Martyn

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]