[Gtk-sharp-list] size request getting lost...

Stanisław Pitucha viraptor at gmail.com
Sun Feb 22 20:18:22 EST 2009


Hi,
I'm trying to write a gtk.bin that handles size requests, but so far
they seem to be completely ignored :/
My code is fairly similar to the Gtk.Bin example. The parent container has:

--->8---
SizeRequested += HandleSizeRequested;
...
void HandleSizeRequested(object o, SizeRequestedArgs args) {
	int toth = ...;
	int totw = ...;
	...
	foreach (Packet tp in _packets.Values) {
		int w = -1, h = -1;
		tp.GetSizeRequest(out w, out h);
		Console.WriteLine("p: {0}, h:{1} w:{2}", tp, h, w);
		toth += h;
	}
	SetSizeRequest(toth, totw);
}
--->8---

The child widget (Packet) has:
--->8---
SizeRequested += HandleSizeRequested;
...
void HandleSizeRequested(object o, Gtk.SizeRequestedArgs args) {
	Console.WriteLine("running request");
	if (_isFold) {
		SetSizeRequest(HOST_WIDTH, PACKET_HEIGHT);
	} else {
		SetSizeRequest(HOST_WIDTH, PACKET_HEIGHT*2);
	}
}
--->8---

But on the console I get only "p: ..., h:-1 w:-1" and no "running
request". Why is that? Do I have to do something special with Gtk.Bin
before it can receive/run size requests?


More information about the Gtk-sharp-list mailing list