Re: Cleaning a canvas

>   How can I remove all the items in a GnomeCanvas?

The messy/easy way:

	GnomeCanvasGroup *root;
	GList *l;

	root = gnome_canvas_root (my_canvas);

	l = root->item_list;
	while (l) {
		GnomeCanvasItem *item = GNOME_CANVAS_ITEM (l->data);

		l = l->next;
		gtk_object_destroy (GTK_OBJECT (item));

However, if you will be doing this very often, it may be easier to
create your own "root" group directly under the canvas' real root
group and put all your items inside it.  Then you can simply destroy
that group and re-create it.


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