[Gtk-sharp-list] ScrolledWindow and Label doesn't work

Agro Rachmatullah agro1986 at gmail.com
Mon Nov 15 23:46:42 EST 2010


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);

        this.DeleteEvent += delegate(object sender, DeleteEventArgs e)
        {
            Application.Quit();
        };
    }
}

class Start
{
    static void Main()
    {
        Application.Init();

        var window = new SampleScrollBar();

        window.ShowAll();
        Application.Run();
    }
}

//////////////////////////////////////// code end


More information about the Gtk-sharp-list mailing list