GtkScrolledWindow in a dialog



Hi!

I'm sure this is a perennial problem, but I just can't figure out how to
google for it:

Consider a GtkDialog containing, among other things, a GtkScrolledWindow
with horizontal and vertical policy set to automatic. Suppose the
GtkScrolledWindow contains a GtkTable with a grid of GtkLabel objects. The
number of rows and columns can range from just a few (say, 3x3) to very
many (say, 300x300).

Now, with a standard

GtkTable -> GtkViewport -> GtkScrolledWindow -> GtkDialog

setup, the initial size of the dialog will be independent of the initial
number of rows and columns of GtkLabel objects. In fact, the dialog will
be rather small, and not even a single label will be properly visible.

Are there any good solutions for calculating a size request for the
GtkScrolledWindow that will allow a maximum number of the contained
GtkLabel objects to be displayed, while not causing the dialog to grow to
the same enormous size it would have, were the GtkTable embedded in the
dialog's GtkVBox directly, without using a GtkScrolledWindow ? IOW, let
the dialog grow as there are more and more rows and columns of GtkLabel
objects without displaying the scrollbars, but let it start scrolling when
the GtkDialog starts approaching, say, the borders of the screen.

My attempt at answering this question has resulted in a rather clumsy hack
(attached). Please let me know if there's a better way.

TIA for your help!


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