[Gtk-sharp-list] How the bindings work

Erik Pukinskis erik@snowedin.net
06 Aug 2003 15:25:38 -0400


On Wed, 2003-08-06 at 14:56, Miguel de Icaza wrote:
> My understanding was that -1 was a value returned when the widget was
> not "ready" to provide this information.  I forget the details, but I
> ran into that at some point doing something else (I just forget what it
> was).
> 
> Maybe you needed to pack the widget/show-the-widget/realize-the-widget? 
> Something like that.

Maybe, but this is not the behavior when working straight from the GTK
libs.  

In C:

  GtkWidget *label;
  label = gtk_label_new("foo");
  GtkRequisition requisition;
  gtk_widget_size_request (label, &requisition);
  g_print ("Requisition is: %dx%d", 
            requisition.width, 
            requisition.height);

This returns a valid width and height.  It doesn't make sense that you'd
have to pack/display/realize a widget before you get its size because if
you are implementing a new container, you need to know the size of the
widget before you can lay it out.

Erik