Re: Loading JPGs



>gtk_container_foreach(GTK_CONTAINER(gnome_canvas), mycbk, gnome_canvas)

although the toplevel canvas widget IS-A container, the semantics of
the canvas, or more particularly, the relationship between the canvas
and its canvas items are not those you know from containers and their
widgets. specifically, items are not widgets stored in containers. 

>Obviously this doesn't work. mycbk() never gets called (maybe because I
>only added a GdkPixbuf ?).
>So what should I do to clear the canvas ? Hope I don't have to destroy
>it and make a new one...
>If so, what happens if you have 100 items and want to remove the 50th?

just keep a list of them yourself (the canvas may not store them in
the order you expect anyway), and use gtk_object_destroy() when you
want to get rid of one of them. the object system ensures that the
"parent" (i.e. the canvas) knows about the destruction even though you
operate only on the "child" (i.e. the item).

>Is there a way to iterate on the items contained in a canvas?

i would imagine that the item_list that you used in your solution is
considered "private" and should not be accessed.

--p



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