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

Manuel Alejandro Cerón Estrada ceronman at gmail.com
Mon Nov 26 19:48:06 EST 2007


I answer to my self. The problem was that I was using SetSizeRequest
Method and I should use SetSize.



2007/11/26, Manuel Alejandro Cerón Estrada <ceronman at gmail.com>:
> Hello.
>
> 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);
>                 scroll.Add(layout);
>
>                 win.ShowAll();
>                 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.
>


-- 
· Manuel Alejandro Cerón Estrada
· ceronman at gmail.com
· http://wiki.freaks-unidos.net/weblogs/ceronman


More information about the Gtk-sharp-list mailing list