Re: Getting text out of a GtkTextView



* Carl B. Constantine (duckwing duckwing ca) wrote:
> > 	The following link tells you how to get the contents of the
> > entire text widget as a string:
> > http://developer.gnome.org/doc/API/2.0/gtk/gtk-question-index.html#id2850623
> 
> No it's not. that url doesn't resolve (at least as far as the #id tag
> goes).  Additionally, your suggestion doesn't work either...

Actually, I *did* find it on that page, way down but clicking the link
didn't put me in the correct spot.

> >     buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
> >     gtk_text_buffer_get_bounds (buffer, &start, &end);
> >     text = gtk_text_iter_get_text (&start, &end);
> >     ...use text...
> >     g_free (text);
> 
> In both of these instances I get the following error:

Never mind, I found my problem. I had declared start and end as
*GtkTextIter instead of just GtkTextIter. That pointer makes all the
difference in the world ;-)

-- 
 .''`.      Carl B. Constantine
: :' :     duckwing duckwing ca
`. `'    GnuPG: 135F FC30 7A02 B0EB 61DB  34E3 3AF1 DC6C 9F7A 3FF8
  `-  Debian GNU/Linux -- The power of freedom

Attachment: pgpQZsXJ1OwG5.pgp
Description: PGP signature



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