[Gtk-sharp-list] Requisitions
Erik Pukinskis
erik@zebra.net
29 Jul 2003 23:24:11 -0400
Hi there,
I'm not sure if this is a coding mistake on my part or a bug in
gtk-sharp, but I am trying to get the "preferred" size of a widget, and
it doesn't seem to work. The code in question is:
Label label = new Label("foo");
Gtk.Requisition requisition = new Gtk.Requisition();
label.SizeRequest(requisition);
Console.WriteLine("Requisition is: {0}x{1}",
requisition.width,
requisition.height);
It always returns 0x0, when it should get something like 18x14. I also
tried getting label.WidthRequest and label.HeightRequest, but they both
return -1. Similar code in C[1] seems to work OK. Am I doing something
wrong?
Thanks,
Erik
[1]
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);