Re: [gtk-list] Scrolled windows and viewports



Matt Goodall wrote:
> 
> Hi,
> 
> Should a GtkCList be added to a GtkScrolledWindow using
> gtk_container_add() or gtk_scrolled_window_add_with_viewport()?

gtk_container_add()


> I think the answer is gtk_container_add() because gtk_clist_moveto()
> doesn't seem to work otherwise. The tutorial says to use
> gtk_scrolled_window_add_with_viewport() although the example is not
> using a compound list.
> 
> If I'm correct, what dictates how a child is added to a scrolled window?

Some widgets handle scrolling themselves, e.g. GtkCList, GtkCTree, GtkText,
GtkLayout.

Most other widgets know nothing about scrolling, and so you must put them
inside a viewport which can handle scrolling for them.


You can spot which widgets can handle scrolling by seeing if they set up
a 'set_scroll_adjustments' signal. e.g. cd into the gtk directory and do

  grep set_scroll_adjustments_signal *.c


Widgets Which Handle Scrolling Themselves (i.e. Don't Need a Viewport)
======================================================================

In GTK+:
  GtkCList
  GtkCTree       (subclass of GtkCList)
  GtkLayout
  GtkText

In Gnome:
  GnomeCanvas    (subclass of GtkLayout)
  GnomeIconList  (subclass of GnomeCanvas)


Damon



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