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



u07ih@abdn.ac.uk wrote:

> > Hi,
> > is there a simplistic way to remove a CanvasWidget from a canvas that is
> > being destroyed such that the actual GtkWidget can be used to create a
> > CanvasWidget on another canvas?
>
> If you do a gtk_widget_ref (widget); before destroying the canvas, then create
> the new canvas, put the new canvaswidget on it, and do a gtk_widget_unref
> (widget);
>
> iain

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. The only thing so far that I have found to work is setting the
gnomecanvasitem->widget to NULL before destroying the canvas. From looking at the
code for gnome_canvas_widget_destroy() this will work. What I haven't determined
yet is if there are any side effects from doing this.

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]