Re: showing a logfile in a Textview(like tail -f)



On Thu, 20 Jul 2006 11:55:47 +0200
rupert <rupertt gmail com> wrote:

Currently i update a buffer with gtk_text_buffer_insert_at_cursor(data,
line, -1);    in a timeout, the problem here is that the new text gets
copied at the and of the old text, i also tried gtk_text_buffer_insert,
but that gives me no text or a segfault.

Rupert,

I see you do not use textiters - a very valuable tool. For example, if
you want to insert text at the beginning, start with
gtk_text_buffer_get_start_iter. This gives you a reliable point of
insertion, and permits you to gtk_text_buffer_insert, not relying on the
cursor, which the user could have changed by clicking.

Now, this doesn't garantee you that the added text will be visible
(generally, the cursor remains visible). But you can scroll by software
by manipulating the textview with  gtk_text_view_scroll_to_iter.

This help?
John



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