PDA

View Full Version : gtk+ scrollbar help


napsy
January 29th, 2007, 04:20 PM
Hello!

How do I get the scrollbar to always stickto the top of the child widget no mather if the child expands in the scrolled window? For example gnome-terminal where all the new lines are always visible and the previous lines are hidden but still visible via scrolling up.

Tnx.

psychicdragon
January 29th, 2007, 04:38 PM
You need to use a GtkViewport to add scrolling to most widgets. Use the function gtk_scrolled_window_add_with_viewport() (http://developer.gnome.org/doc/API/2.0/gtk/GtkScrolledWindow.html#gtk-scrolled-window-add-with-viewport) to create a GtkScrolledWindow (with GtkViewport) containing the widget you want to scroll.

napsy
January 29th, 2007, 04:43 PM
I add a TreeView to the ScrolledWindow and I think GtkViewport is not neccesery here.