Re: [gtk-list] Packing help



Lior Chen wrote:

> Hi,
>
> I'm new to GTK (and I'm moving from MSVC, so don't be hard on me), and I
> have this question about packing.
>
> I want to create something like this:
>
> *****
> *****
> ***** *****
>
> Where every '*****' is a button. I understand how to pack boxes into
> boxes, but all I managed to reach so far is this:
>
> ******
> ******
> **  **
>
> (The last two buttons shrinks into the size of one button).
> Where am I going wrong? This is my code in short:
>
> box1 = gtk_vbox_new(FALSE, 0);
> gtk_container_add (GTK_CONTAINER (window), box1);
> gtk_box_pack_start(GTK_BOX(box1), button[1], TRUE, TRUE, 0);
> gtk_box_pack_start(GTK_BOX(box1), button[2], TRUE, TRUE, 0);
>
> box2 = gtk_hbox_new(FALSE, 0);
> gtk_box_pack_start(GTK_BOX(box1), box2, TRUE, TRUE, 0);
> gtk_box_pack_start(GTK_BOX(box2), button[0], 0, 0, 0);
> gtk_box_pack_start(GTK_BOX(box2), button[1], 0, 0, 0);
>
> Any help would be appriciated.
>
>         - Lior Chen <liorc@usa.net>

I am new to GTK as well (from the "raw" Win32 API... not new to Unix
programming, just X Win and GTK).  It seems you will want the box X factor to
be as big as the two side by side should be.  Then just scale the
single-on-row buttons to be smaller than the full width of the box.

I am sorry I cannot tell you exactly how to do this.

Good luck,
Trever Adams
arabian@onramp.net



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