Re: Howto correctly generate "expandable void"?



Till,

I have not tested this yet, but I can give you an ideal of what I would
try first.

Window
-vbox
-- vbutton_box(a,b,c) -- postioned using start
-- vbutton_box(x,y,z) -- postioned using end

Here is the code.

***BEGIN
/* Button Alignment */


#include <gtk/gtk.h>


int main(int argc, char *argv[] )
{
  GtkWidget   *window   = NULL;
  GtkWidget   *vbox     = NULL;
  GtkWidget   *button   = NULL;
  GtkWidget   *bbox    = NULL;
  
  gtk_init (&argc, &argv);

  /* create window, etc */
  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title (GTK_WINDOW (window), "expandable void");
  gtk_container_set_border_width (GTK_CONTAINER (window), 5);
  g_signal_connect (G_OBJECT (window), "destroy",
           G_CALLBACK (gtk_main_quit), NULL);            
  
 /*
  * Create the main vbox
  */
  vbox = gtk_vbox_new (FALSE, 5);
  gtk_container_add (GTK_CONTAINER (window), vbox);

  
  /*
   * Create the Top Group of buttons
   */
  bbox = gtk_vbutton_box_new ();
  gtk_container_set_border_width (GTK_CONTAINER (bbox), 5);    
  gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox),
GTK_BUTTONBOX_START);
  gtk_box_set_spacing (GTK_BOX (bbox), 6);
  gtk_box_pack_start (GTK_BOX (vbox), bbox, TRUE, TRUE, 5);  
  
  
  button = gtk_button_new_from_stock (GTK_STOCK_OK);
  gtk_container_add (GTK_CONTAINER (bbox), button);
  
  button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
  gtk_container_add (GTK_CONTAINER (bbox), button);
  
  button = gtk_button_new_from_stock (GTK_STOCK_HELP);
  gtk_container_add (GTK_CONTAINER (bbox), button);

  /*
   * Create the Bottom Group of buttons
   */
  bbox = gtk_vbutton_box_new ();
  gtk_container_set_border_width (GTK_CONTAINER (bbox), 5);    
  gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_END);
  gtk_box_set_spacing (GTK_BOX (bbox), 6);
  gtk_box_pack_end (GTK_BOX (vbox), bbox, TRUE, TRUE, 5);  
  
  
  button = gtk_button_new_from_stock (GTK_STOCK_OK);
  gtk_container_add (GTK_CONTAINER (bbox), button);
  
  button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
  gtk_container_add (GTK_CONTAINER (bbox), button);
  
  button = gtk_button_new_from_stock (GTK_STOCK_HELP);
  gtk_container_add (GTK_CONTAINER (bbox), button);
  
  
  
  gtk_widget_show_all (window);

  gtk_main();

  return 0;
}

***END


On Fri, 2008-10-24 at 21:01 +0200, Till Harbaum / Lists wrote:
Hi,

i have a vbox with a bunch of buttons. I want some of them to appear at the top
and some of them at the bottom. The buttons should not be expanded and the
space between them should also not expand except the space between the two
groups. Something like this:

(a)
(b)
(c)




(x)
(y)
(z)

How is this done correctly without having some invisible item i can place between
both groups and which is set to expand/fill?

Till
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


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