Re: how to remove a CanvasWidget from a canvas and put it on another



Havoc Pennington wrote:

> u07ih@abdn.ac.uk writes:
> > > I've tried your suggestion however when the canvas is destroyed the  canvasitem
> > > that is associated with the gtkwidget is destroyed and subsequently performs a
> > > gtk_widget_destroy() on the gtkwidget. Calling gtk_widget_ref() before destroying
> > > the canvas doesn't seem to keep the widget from being destroyed along with the
> > > canvasitem.
> >
> > This sounds like a bug. A widget should not be destroyed if there is a ref held
> > on it.
> >
>
> False, destruction has nothing to do with the refcount. The refcount
> merely prevents finalization. http://developer.gnome.org/doc/GGAD has
> some text on this point.
>

thats a great point about refcount. It solves a few problems that I've experienced. I
hadn't dug deep enough into gtk to figure this out. I am still at a loss on how exactly
to remove a CanvasWidget from a canvas without destroying the underlying widget. I want
to cleanly move a widget from one canvas to another by removing the widget from the
first canvas, destroying the canvas, then creating a CanvasWidget on the second canvas
from the widget I removed from the first. I've got a way to make this work however it
means accessing some of the CanvasItems' struct members directly instead of throught
member functions. Basically what I would like is a gnome_canvas_remove_item(GnomeCanvas
*c, GnomeCanvasItem *i) function that removes the CanvasItem but doesn't destroy the
widget used to create CanvasItemWidgets.  I thought using gtk_container_remove would do
the trick but it doesn't.  Anyway, thanks for the help and enlightening me on refcounts.

Thomas.

begin:vcard 
n:Morris;Thomas
tel;cell:+49 177 2857370
tel;fax:+49 631 3504738
tel;home:+49 631 3504736
tel;work:+49 631 3504736
x-mozilla-html:FALSE
url:www.linuxpro.org/thomas
adr:;;;;;;
version:2.1
email;internet:Thomas@linuxpro.org
x-mozilla-cpt:;24960
fn:Thomas Morris
end:vcard


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