Re: Child Packing
| From: | Malk0 | Date: | Thu, 06 Jan 2005 09:38:02 +0000 |
| Subject: | Re: Child Packing | ||
| References: | 1 2 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-5406@lists.php.net to get a copy of this message | ||
hi,
there is a logical explanation to this problem in the manual :
"Note that all children in a GtkVBox are allocated the same width,
regardless of settings and child requisition size. Widgets taking up
less than the allocated width are by default centered within the
available area in that dimension."
To get rid of this you can either use gtktable as said by Nghia, or if
you still want to use boxes you must use some gtkhbox inside the vbox
to contain your widgets, this way only the hbox will be as width than
the vbox but your widgets inside will keep their setted width.
$hb = &new gtkhbox(0,0);
$button = &new GtkButton('button');
$hb->pack_start($button);
$cd_type_main_box->pack_start($button, false, false, 10);
the previous sample will be helpfull when you have lines with multiple
widgets, but in your case you only have 1 widgets by lines. So a quick
way to do what's you need is to simply add your vbox in a hbox and put
the hbox in the window, this would solve your problem.
$cd_type_main_box = &new GtkVBox(false, 0);
$cd_type_main_box->set_usize(100,-1);
$hb = &new gtkhbox(0,0);
$hb->pack_start($cd_type_main_box,0,0,10);
$cd_type_window->add($hb);
regards,