Re: Cant get GtkTextBuffer from GtkTextView widget
- From: "Tiberius DULUMAN" <tiberius duluman gmail com>
- To: gtk-app-devel-list gnome org
- Subject: Re: Cant get GtkTextBuffer from GtkTextView widget
- Date: Mon, 14 Apr 2008 09:59:56 +0300
The handler should be:
static void handler(GtkWidget *widget, GtkTextView *tview)
{
GtkTextBuffer *buffer = NULL;
GtkTextIter iterator;
buffer = gtk_text_view_get_buffer(tview);
g_assert(buffer != NULL); <<< assert that it is not null
gtk_text_buffer_get_end_iter(buffer, &iterator); <<< pass an allocated
iterator
gtk_text_buffer_insert(buffer, &iterator, "Info message", -1);
}
2008/4/14 Roman Makurin <drolyk gmail com>:
Hi All!
I`ve got a problem with GtkTextView object. I want to append text to it
everytime when some event occurs.
Here is code snippet:
static void handler(GtkWidget *widget, GtkTextView *tview) {
GtkTextBuffer *buffer;
GtkTextIter *iterator;
buffer = gtk_text_view_get_buffer(tview);
g_assert(buffer == NULL);
gtk_text_buffer_get_end_iter(buffer, iterator);
gtk_text_buffer_insert(buffer, iterator,
"Info message", -1);
}
int main(int argc, char ** argv) {
GtkWiget *tview;
tview = gtk_text_view_new();
g_signal_connect(G_OBJECT(button), "clicked",
G_CALLBACK(handler), tview);
return 0;
}
When I`m trying to get buffer object in habdler() it allways returned as
NULL and I`ve got segmentation fault. I can`t figure out where is my
fault :(
How can I append text to GtkTextView ?
Thanks
PS: Sorry for my english
--
If you think of MS-DOS as mono, and Windows as stereo,
then Linux is Dolby Digital and all the music is free...
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]