Re: Switching GtkTextBuffer and Child Anchors



Okay, thanks...

On Apr 6, 2005 10:02 AM, Matthias Clasen <mclasen redhat com> wrote:
On Wed, 2005-04-06 at 09:48 -0400, Kent wrote:
> I sent this on the list last week but never got a reply so I thought
> I would try again.
>
> --
>
> Hello,
>
> I have a GtkTextView that I was trying to share between multiple
> GtkTextBuffers (one at a time of course). Each GtkTextButter had a
> child anchor that consisted of a GtkTable widget. The GtkTextView
> displayed the buffer and it's child anchor fine until I switched to
> another
> GtkTextBuffer (using gtk_text_view_set_buffer()) and then switched
> back to the original GtkTextBuffer. When I switched back the table
> was gone and in its place was the outline of a box where the table had
> been (the box was smaller than the original table). A co-worker
> looked
> at the gtk code and according to him when you switch the buffers using
> gtk_text_view_set_buffer() any child anchors in the existing GtkText-
> Buffer get deleted. Is this a bug, feature, or what. It certainly
> seems bogus
> to me but maybe there's a good reason for it. Or, maybe my idea for
> toggling buffers within a GtkTextView is inappropriate.
>

The child anchors are associated with the buffer, but the widgets placed
there are associated with the view. So, if the buffer of the view is
changed, the view really has no other option but to destroy the widgets.

To make this work, you will have to keep references to the widgets
yourself, and re-connect them to the anchors when the buffer is switched
back.

Matthias




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