Re: Child Packing
| From: | Jeremy Johnstone | Date: | Thu, 06 Jan 2005 21:34:23 +0000 |
| Subject: | Re: Child Packing | ||
| References: | 1 2 3 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-5409@lists.php.net to get a copy of this message | ||
That's exactly how I control positioning (only I do it in Glade). I
divide the area up with a vbox (one row for each row on the screen),
then I divide each row up with an hbox (even if I only use one widget
on that row). This give me the best ability I have found to position
widgets exactly where I want them.
-Jeremy
On Thu, 6 Jan 2005 10:38:02 +0100, Malk0 <malk0.phpgtk@gmail.com> wrote:
> 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,
>
> --
> PHP-GTK General Mailing List (http://gtk.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
---------------------------
Jeremy Johnstone
http://www.jeremyjohnstone.com
jsjohnst@php.net