|
|
| Author |
Message |
|
|
aliov Familiar Face
Joined: 06 May 2007 Posts: 7
|
Posted: Sun May 06, 2007 12:20 pm Post subject: GTK Text view (please help) |
|
|
Hi all,
I want to use GTK text view ,to show some messages during the run of a program.
GtkWidget *text_buffer;
GtkTextBuffer *buff;
Gtk.TextIter start;
text_buffer=gtk_text_view_new();
gtk_text_view_set_editable(GTK_TEXT_VIEW(text_buffer),FALSE);
buff=gtk_text_view_get_buffer (GTK_TEXT_VIEW(text_buffer));
gtk_text_buffer_get_start_iter(buff,&start);
gtk_text_buffer_insert(buff,&start,"Hello",-1);
But each time i do a gtk_text_buffer_insert the inserted comment displayed only in the same line, My question is how i can display another comment in another line of my gtk text view ?
or if there is another solution to use another widget for example to display some comment in the text!.
Cheers. |
|
| Back to top |
|
 |
hydra Familiar Face
Joined: 23 Jan 2007 Posts: 35
|
|
| Back to top |
|
 |
aliov Familiar Face
Joined: 06 May 2007 Posts: 7
|
Posted: Sun May 06, 2007 1:56 pm Post subject: |
|
|
Thank you for the quick reply your reply help me to do it.
Cheers. |
|
| Back to top |
|
 |
aliov Familiar Face
Joined: 06 May 2007 Posts: 7
|
Posted: Sun May 06, 2007 2:28 pm Post subject: |
|
|
No i was wrong,
I didn't solve my problem if i call gtk_text_buffer_inset_at_cursor twice the second insersion will be in the same line,so how to move the cursor to the next line and do the insertion.
The text is not editable just used to show some messages.
Cheers. |
|
| Back to top |
|
 |
openldev Never Seen the Sunlight
Joined: 21 Sep 2005 Posts: 372 Location: State College, Pennsylvania
|
Posted: Sun May 06, 2007 2:49 pm Post subject: |
|
|
| It sounds like your message is just continually appended to the text buffer. You'll need to insert a new line character, and then use gtk_text_iter_forward_line() to move to the next line. |
|
| Back to top |
|
 |
aliov Familiar Face
Joined: 06 May 2007 Posts: 7
|
Posted: Sun May 06, 2007 3:28 pm Post subject: |
|
|
please ,can you provide me more details,
as a sample code can help me.
Thx in advance. |
|
| Back to top |
|
 |
openldev Never Seen the Sunlight
Joined: 21 Sep 2005 Posts: 372 Location: State College, Pennsylvania
|
Posted: Sun May 06, 2007 3:46 pm Post subject: |
|
|
| Code: (Plaintext) | 1 2 3 4 5 6 7 8 9
| GtkTextBuffer *buffer;
GtkTextIter iter;
gchar *text;
buffer = gtk_text_view_get_buffer (view);
text = g_strconcat (your_message, "\n", NULL);
gtk_text_buffer_get_end_iter (buffer, &iter);
gtk_text_buffer_insert (buffer, &iter, text, -1);
g_free (text); | |
|
| Back to top |
|
 |
aliov Familiar Face
Joined: 06 May 2007 Posts: 7
|
Posted: Sun May 06, 2007 4:10 pm Post subject: |
|
|
it 's still writing all the messages in the same line.
Any suggestion.
Thx. |
|
| Back to top |
|
 |
aliov Familiar Face
Joined: 06 May 2007 Posts: 7
|
Posted: Sun May 06, 2007 4:29 pm Post subject: |
|
|
I'm sorry, since i'm not compiling in my computer,i'm compiling on another one using secure shell,it takes time to install new binaries.that's why it ran the old one now the one which i made with your help.
Problem solved,
Thx very much for your support
Cheers, |
|
| Back to top |
|
 |
|