Re: ScrolledWindow autoscrolling



Reto Bürki <reto buerki fhso ch> writes:

> Hi List,
>
> I already posted this message to the glademm-list, but did not receive
> any answers, that's why I'm re-posting it here...hope that's ok.
>
> I know this topic has been discussed a few times all over the different
> gtk related lists  :)  but still I can't find a suitable solution.
>

This is what I do and it works:

void ChatWindow::on_new_text_function_thing()
{
  Glib::RefPtr<Gtk::TextBuffer> buff(m_output->get_buffer());
  /* snipped coded */
  Glib::ustring disp = FunctionToCreateTheDisplayString();
  buff->insert(buff->end(),disp);
  Gtk::TextBuffer::iterator end = buff->end();
  m_output->scroll_to_iter(end,0.0);

}


m_output is a pointer to the TextView widget. As long as that code is
called in the main ui thread, it will work


Justin




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