Re: How to create a scrolled text window with GTK 2.x?



Hello!

Textview has native scrolling, so use:
gtk_container_add( GTK_CONTAINER( scrolledTextWindow ), textWindow );

This will scroll when you type - I'm not sure what happens, if you add
text via the gtk_text_buffer_* funtions.

 That felt promising because it indeed scrolled to the end when text was
added by hand.
 However, if text is added with the gtk_text_buffer functions, it does not
scroll to the end, and unfortunately this is exactly what I would need...

In gtkmm I use:

	info_display->insert(info_display->end(), msg);

	/* scroll to the end */
	info_display->move_mark(info_display->get_insert(), info_display->end());
	textView.scroll_to_mark(info_display->get_insert(), 0.0);

With info_display as Glib::RefPtr<Gtk::TextBuffer> and
textView as Gtk::TextView.

Just replace with the gtk+ Functions. Hope it helps.


Regards,
Frank



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