[Mono-list] Gtk# problem on Mac OSX.

Wei Weng wweng@kencast.com
Tue, 05 Apr 2005 15:57:30 -0400


I have mono 1.1.4 and Gtk# 1.0.8 installed(from the source), on OSX 10.3.

I have a very simple testing program:

// project created on 03/15/2005 at 15:47
using System;
using Gtk;

class Test
{
	public static void Main(string[] args)
	{
		Application.Init ();

		Window w = new Window("Gtk# Basics");
		Button b = new Button("Hit me");

		b.Clicked += new EventHandler(Button_clicked);

		w.Add(b);
		w.SetDefaultSize (200,100);
		w.ShowAll();
		

		Application.Run ();
	}
	
	static void Button_clicked(object o, EventArgs args)
	{
		System.Console.WriteLine("HELLO!");
	}
}

Compiling it didn't produce any errors. But mono Test.exe gives me the 
following errors:


Unhandled Exception: System.NullReferenceException: Object reference not set 
to an instance of an object
in (unmanaged) (wrapper managed-to-native) 
GLib.SignalCallback:g_signal_connect_data 
(intptr,string,System.Delegate,int,intptr,int)
in <0x000a0> (wrapper managed-to-native) 
GLib.SignalCallback:g_signal_connect_data 
(intptr,string,System.Delegate,int,intptr,int)
in <0x00078> GLib.SignalCallback:Connect (string,System.Delegate,int)
in <0x000c8> GtkSharp.voidObjectSignal:.ctor 
(GLib.Object,string,System.Delegate,System.Type,int)
in <0x0024c> Gtk.Button:add_Clicked (System.EventHandler)
in <0x000d0> Test:Main (string[])

It seems that I can not plug in any event handlers. If I whack the part 
about event handler, the window renders just fine.

Well, there isn't much point of having a windows GUI without being able to 
handle event.

Does anyone know how to fix the problem? (Or where the problem might be from?)

TIA.


Wei