Scrolling with Gtk::TextView

  I have a widget that inherits from Gtk::TextView. Whenever I change
the contents of the buffer I would like to scroll to the end of the
buffer. My first attempt looked something like this

  Gtk::TextIter end = buffer->end ();
  scroll_to (end);

This doesn't work. According to the documentation at

the problem is that the height calculation hasn't happened yet, so the
scrolling won't work as expected. Instead I'm told to use
'gtk_text_view_scroll_to_mark()'. I assume this means I should call
'scroll_to' with a Gtk::TextMark. The problem is that I can't figure
out how to create a Gtk::TextMark and place it at the end of the
buffer. How do I do that?


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