Re: expanding horizontally but not vertically



In message <20010325153753 HQOB22998 mailhost chi ameritech net bbs dbsoft-cons
ulting.com>you write:
>	Is it possible to pack widgets into a box that expands horizontally but
> not 
>vertically (or vice versa).  I can stop a widget from expanding by calling 
>gtk_widget_set_usize(widget, 0, 20);  to make it expand horizontally but not 
>vertically, however the box it's in expands vertically anyway.  Calling 
>gtk_widget_set_usize() like that on the box does not stop it from expanding.  
>Is it 
>possible to do this? 

GtkWidget *your_widget = ....;

GtkWidget *hbox = gtk_hbox_new ();
GtkWidget *vbox = gtk_vbox_new ();

/* pack your_widget into a hbox with no padding, no filling, no
   expansion. it doesn't expand horizontally anymore.
 */

gtk_box_pack_start (GTK_BOX(hbox), your_widget, false, false, 0);

/* pack your_widget into a vbox with no padding, no filling, no
   expansion. it doesn't expand vertically anymore.
 */

gtk_box_pack_start (GTK_BOX(vbox), your_widget, false, false, 0);

/* do both */

gtk_box_pack_start (GTK_BOX(hbox), your_widget, false, false, 0);
gtk_box_pack_start (GTK_BOX(vbox), hbox, false, false, 0);


I've read that for single widgets, GtkAlignment is a better way to do
this.

--p






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