On Mon, Nov 15, 2010 at 11:46 PM, Agro Rachmatullah <[email protected]> wrote: > I tried to put a Label inside a ScrolledWindow, but the scrollbar > wouldn't appear no matter what. What am I doing wrong? My code is > below: > > //////////////////////////////////////// code start > > using System; > using Gtk; > > class SampleScrollBar : Gtk.Window > { > public SampleScrollBar() > { > ScrolledWindow sw = new ScrolledWindow(); > sw.SetPolicy(PolicyType.Automatic, PolicyType.Automatic); > this.Add(sw); > > Label lbl = new Label("This is a very long text. This is a > very long text. This is a very long text. This is a very long text."); > sw.Add(lbl);
ScrolledWindow can only scroll scrollable widgets, such as TextView and TreeView. For widgets that are not scrollable, you can put them into a Viewport container. You can either create and add the Viewport explicitly, then add the label to the Viewport, or use the AddWithViewport convenience method. sw.AddWithViewport (lbl); For more info, see http://library.gnome.org/devel/gtk/stable/GtkViewport.html -- Michael Hutchinson http://mjhutchinson.com _______________________________________________ Gtk-sharp-list maillist - [email protected] http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
