[Gtk-sharp-list] Using a Layout inside a ScrolledWindow

Manuel Alejandro Cerón Estrada ceronman at gmail.com
Mon Nov 26 17:04:53 EST 2007


I have a big Gtk.Layout and I want to put it inside a ScrolledWindow
in order to use scroll bars. It's supposed that Gtk.Layout has native
scrolling capabilities, so I can use the Add method instead of
AddWithViewport. For some reason this is not working right. When I use
Add, my window get expanded to the size of the Layout, which is the
opposite of what I want. Here is a sample code:

public class MainClass {
	public static void Main () {
		Application.Init ();
		Window win = new Window ("Layout test");
		ScrolledWindow scroll = new ScrolledWindow (null, null);
		scroll.SetPolicy(PolicyType.Always, PolicyType.Always);
		win.Add (scroll);
		Layout layout = new Layout (null, null);
		layout.SetSizeRequest(1000, 1000);
		Application.Run ();

I want my window to remain small while the scrollbars can be used to
navigate thought the layout.

Thanks in advance.

Manuel Cerón.

More information about the Gtk-sharp-list mailing list