Re: Getting the width and height of a widget in gtk+-1.2



On Tue, Aug 12, 2003 at 12:12:23AM -0600, Nix wrote:
I have a dynamic list(VBox, really) of checkboxes which gets filled in
before the dialog box pops up.  I want to measure the width and height
of the checkboxes, then cause the width of the dialog box to become such
that the scrollwindow and the viewport can accomodate the widest
checkbox without a horizontal scrollbar.  I would like to do this
(preferably) before the dialog box becomes visible, so the user doesn't
experience a jerk when it pops up.

For this purpose, you want to call gtk_widget_size_request() on your
check boxes. That gets the size that they will ask for.

To get the actual size of a widget at any given time, look 
at widget->allocation; but the checkboxes may not have their
allocation before you show the window.

Havoc



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