[gtk-server] Re: GtkTextIter

  • From: Peter van Eerten <administrator@xxxxxxxxxxxxxx>
  • To: gtk-server@xxxxxxxxxxxxx
  • Date: Sun, 19 Nov 2006 16:46:35 +0100

Hi Ian,

For the GtkIter widget you need to workaround your problem with a trick. Indeed,
there is no such function as a 'gtk_iter_new'. Therefore, you must allocate
memory with some other widget. I always use 'gtk_frame_new' for this.

For example (pseudo code):

var iter
iter = gtk_frame_new NULL

Now your variable 'iter' points to allocated memory for a frame, where GTK can
store information for an iter-structure as well.

From there on you can use the variable 'iter' to point to your iter. For
example, to put text at the end of your textbuffer (pseudo code):

gtk_text_buffer_get_end_iter txtbuffer iter
gtk_text_buffer_insert txtbuffer iter "my text" -1

Hope this helps.


Citeren Ian Haywood <ihaywood@xxxxxxxxxxxx>:

> I'm unclear how to use this object in gtk-server, as there
> is no gtk_text_iter_new (), there's no way to create a GtkTextIter within
> gtk-server's memory and so get a widget reference to pass to other functions.
> The GTK designers seem to assume we can create them on the stack.
> Frustratingly, there is a gtk_text_iter_clone () and gtk_text_iter_free (),
> but no way to create the first iterator to clone it.
> As anyone encountered this situation?
> Would their be support for a gtk-server builtin gtk_text_iter_new ()
> (which would be barely 4-5 lines of C)
> Thanks,
> Ian Haywood


Other related posts: