Re: Help: why Gtk::Bin.remove() deletes my object
- From: Sven Neumann <sven gimp org>
- To: Howard Zhou <howardzzh yahoo com>
- Cc: gtk-list gnome org
- Subject: Re: Help: why Gtk::Bin.remove() deletes my object
- Date: 09 Jun 2001 01:02:21 +0200
Hi,
Howard Zhou <howardzzh yahoo com> writes:
> I tried to switch between text object
> in a scrolled window by calling remove() then add(*_)
> because the trial with just calling add(*_) does not
> work. But I found that remove() will actually delete
> the text object I put in first.
the container (scrolled window) takes ownership of the
object you add to it and sinks it. All GTK+ containers
behave like this. You need to change your code to:
gtk_object_ref (object1);
container_add (container, object1);
...
container_remove (container, object1);
container_add (container, object2);
Then don't forget to unref your object as soon as you
don't need it anymore.
Salut, Sven
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]