Re: Simple question





--- On Thu, 9/18/08, Vasiliy Tolstov <v tolstov selfip ru> wrote:

> From: Vasiliy Tolstov <v tolstov selfip ru>
> Subject: Simple question
> To: gtk-list gnome org
> Date: Thursday, September 18, 2008, 2:03 AM
> I'm try to program with gtk, create main window, vbox
> for buttons, but
> then program run - button have all the window width.
> 
> How can i set button width and height?
> 
> This is code:
> 
>      gtk_init (&argc,&argv);
>         window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
>         gtk_window_set_title (GTK_WINDOW (window),
> "Panel Client");
>         gtk_window_set_position (GTK_WINDOW (window),
> GTK_WIN_POS_CENTER);
>         gtk_container_set_border_width (GTK_CONTAINER
> (window), 1);
>         gtk_widget_set_size_request (window, 640, 480);
>         g_signal_connect(window, "delete-event",
> G_CALLBACK(gtk_main_quit), NULL);
> 
> 
>         vbox_main = gtk_vbox_new (FALSE, 0);
>         gtk_container_add (GTK_CONTAINER (window),
> vbox_main);
> 
>         vbox_left = gtk_vbox_new(false,0);
>         gtk_box_pack_start(GTK_BOX
> (vbox_main),vbox_left,false,false,0);
> 
> 
>         //GenerateCategories(vbox_right);
> 
>         vbox_right = gtk_vbox_new(false,0);
>         gtk_box_pack_start(GTK_BOX
> (vbox_main),vbox_right,false,false,0);
> 
>         GenerateCategories(vbox_right);
> 
>         gtk_widget_show_all (window);
>         gtk_main ();
> }
> 
> screenshot: http://packages.selfip.ru/screenshot.png
> 
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list

Quick WEB search yields this:

http://inti.sourceforge.net/tutorial/libinti/settingwidgetattributes.html

- it's apparently C++, but one should be able o easily trace things
back to the original gtk+ in "C".

The issue is actually "wider" - widgets by default occupy all available
space, so you should look into container widgets - which you partially did.

For example, if you put 2 buttons, each will occupy half the space.

...

I'm using gtk+ through Perl bindings, and I have already written a GUI I
needed and have happily forgotten the gory details :-).

Regards,
  Sergei.


      


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