Re: CList scrolling



Ian Zimmerman wrote:
itz> Hi, what little documentation I could find on the CList widget in
itz> gtk1.2 says that I have to place it into a ScrolledWindow to get
itz> scrolling.  I did that, using ScrolledWindow::add_with_viewport.
itz> But that makes the column headings scroll together with the rest!
itz> How can stop that and get normal listbox scrolling?

Evan> Just use Container::add.

That works, thanks.  But _why_ does this work and where is it documented??
ScrolledWindow docs 
(http://developer.gnome.org/doc/API/gtk/gtkscrolledwindow.html):
GtkScrolledWindow is a GtkBin subclass: it's a container the accepts a 
single child widget. GtkScrolledWindow adds scrollbars to the child widget.
The scrolled window can work in two ways. Some widgets have native 
scrolling support; these widgets have "slots" for GtkAdjustment objects. 
The scrolled window installs GtkAdjustment objects in the child window's 
slots using the set_scroll_adjustments_signal, found in GtkWidgetClass. 
(Conceptually, these widgets implement a "Scrollable" interface; because 
GTK+ 1.2 lacks multiple inheritance, this interface is hackily 
implemented as a signal in GtkWidgetClass.)
The second way to use the scrolled window is useful with widgets that 
lack the set_scroll_adjustments_signal. The GtkViewport widget acts as a 
proxy, implementing scrollability for child widgets that lack their own 
scrolling capabilities.
If a widget has native scrolling abilities, it can be added to the 
GtkScrolledWindow with gtk_container_add(). If a widget does not, you 
must first add the widget to a GtkViewport, then add the GtkViewport to 
the scrolled window. The convenience function 
gtk_scrolled_window_add_with_viewport() does exactly this, so you can 
ignore the presence of the viewport.



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