Re: [gtk-list] Packing help
- From: Vidar Madsen <vidar vidar prosalg no>
- To: GTK Mailing List <gtk-list redhat com>
- Subject: Re: [gtk-list] Packing help
- Date: Wed, 1 Apr 1998 08:30:13 +0200 (CEST)
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);
Try something like this instead (i.e. put two vboxes into one hbox);
box1 = gtk_hbox_new(FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), box1);
box2 = gtk_vbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(box1), box2, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(box1), button[0], TRUE, TRUE, 0);
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_vbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(box1), box2, TRUE, TRUE, 0);
gtk_box_pack_end(GTK_BOX(box2), button[3], FALSE, FALSE, 0);
(You might want to try changing some more TRUEs to FALSEs here, to avoid
button[3] taking up the entire column.. Haven't checked.)
Or, if you want more control over which buttons go where, you might want
to take a look at the table-widget as well.
Good luck
Vidar
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]