Re: Window size

Jean-Yves Lamoureux wrote:
> Hi all,
> I'm walking through gtk 1.2 doc since 1 or 2 hours and I can find a
> way to set the size of a window.
> gtk_window_set_geometry_hints don't works, gtk_window_set_default_size
> Have I misunderstanding something ?
> (note the window is opened, but in something like 10x10)

Hi, the gtk+ idea is that windows automatically size for their content. 
So what you need to do is set a size for the widgets you want to display 
  in the window. Most widgets do this for you automatically (eg. labels 
size to display their text).

If you want to override this, use gtk_window_set_default_size()

#include <gtk/gtk.h>

main (int argc, char *argv[])
   GtkWidget *window;
   GtkWidget *label;

   gtk_init (&argc, &argv);

   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

   label = gtk_label_new ("Hello world!");
   gtk_container_add (GTK_CONTAINER (window), label);
   gtk_window_set_default_size (GTK_WINDOW (window), 640, 480);

   gtk_widget_show_all (window);

   gtk_main ();

   return 0;


Aelbert Cuyp 13 February - 12 May 2002 

For information and tickets:

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