Re: auto shrinking widgets



Dimitar Haralanov <mitko tahoenetworks com> writes:

      Hi, I am working with GTK+ 1.2 and I would like to know whether there
is a way to make widgets auto shrink. Here is what I have in mind:

      I have a GtkLabel widget that gets set dynamically, meaning that it
could contain different text. Sometimes the widget might take up
multiple lines. GTK automatically adjusts the widgets below the label to
accommodate for the larger label. However, once the label becomes short
again, the extra space allocated for the large label does not get
reclaimed by the lower widgets.

      Is there a way to change this behaviour?

If you call gtk_widget_queue_resize() on the toplevel, it should
cause GTK+ to recompute the layout from scratch; you'll have
to do that manually after changing the widgets.

GTK+-2.0 is better behaved in this area; you should consider
upgrading.

(Note that in GTK+-1.2 and GTK+-2.0, resizable toplevel windows 
won't shrink back when their contents get smaller; to get this
behavior, turn off resizing; gtk_window_set_resizable in GTK+-2.0,
gtk_window_set_policy (window, FALSE, FALSE, FALSE) in GTK+-1.2)

Regards,
                                        Owen



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