[Gtk-sharp-list] Label not responding to mouse clicks

Agro Rachmatullah agro1986 at gmail.com
Mon Sep 13 23:15:28 EDT 2010


Hello. I tried to make a program that outputs text to a console when a label
is clicked. It is as follows:

========================== code start

using System;
using Gtk;

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

        Window window = new Window("Test Window");
        window.Resize(200, 200);

        Label label = new Label("A label");
        label.ButtonPressEvent += ClickHandler;

        window.Add(label);
        window.ShowAll();

        Application.Run();
    }

    static void ClickHandler(object sender, EventArgs e)
    {
        Console.WriteLine("Hello!!!");
    }
}

========================== code end

It compiles successfully whether in .NET or Mono, however when run (whether
in .NET or Mono) nothing happens when I click the label. Can anyone help me?

System info: Windows 7 64 bit, Mono 2.6.7 + GTK# 2.12.10, .NET 4.0 + gtk#
2.12.10

Thanks.

Agro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20100914/c021324d/attachment.html 


More information about the Gtk-sharp-list mailing list