Scrolling with Gtk::TextView



Hi,
  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

  http://gtkmm.org/docs/gtkmm-2.4/docs/reference/html/classGtk_1_1TextView.html#9b23b8dbb4362c639abaa05ba9284d3b

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?

Thanks,
Søren


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