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

Re: get text from GtkText



dont use the old one.

read the api at:
http://developer.gnome.org/doc/API/gtk/gtkeditable.html#GTK-EDITABLE-GET-CHARS

you want to use "gtk_editable_get_chars"

Syntax is

gchar *tmp;

tmp = gtk_editable_get_chars (GTK_EDITABLE(WIDGET), 0,
-1)

printf ("This is my text %s\n", tmp);

g_free(tmp);

WIDGET is the widget you created.

Zev.

--- Maciej Hrebien <m_hrebien@wp.pl> wrote:
> Thomas Mailund wrote:
> > 
> > On Tue, 2001-08-28 at 21:48, guigtk wrote:
> > > Is there any way to get the text that i wrote in
> a GtkText?
> > >
> > 
> > With the (old) text widget you can use
> > 
> > gchar*     gtk_editable_get_chars     
> (GtkEditable      *editable,
> >                                         gint      
>        start_pos,
> >                                         gint      
>        end_pos);
> > 
> > so to get all the text in 'text' you use
> > 
> > gchar *my_text = gtk_editable_get_chars
> (GTK_EDITABLE (text), 0, -1);
> 
> What about memory? Does GTK allocates (new) memory
> for this chars
> pointed by my_text? From the other hand: do I have
> to free memory
> pointed by my_text after using it??
> 
> -- 
> Maciej Hrebien
> 
> 
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/




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