[Gtk-sharp-list] Events in Gtk#
Douglas A Wolfe
Douglas A Wolfe <dougwolfejr@gmail.com>
Mon, 28 Mar 2005 16:24:11 -0500
Sorry, For the repeated message, but I wasn't a member before.
I am not sure if this is the place to ask, but I will anyway.
I am trying to create a project using gtk in c#. I have tried
developing in Visual Studio and in SharpDevelop. I have what seems
to be a simple problem, but I have not been able to solve it and I
have looked over the internet everywhere and not found a solution.
My problem is whenever I add an event and then try to call the event I
get an error. For Instance, when I hit the close button using the
simple code found at the bottom of the message. I get this error: "An
unhandled exception of type System.ArgumentNullException' occurred in
mscorlib.dll
Additional information: Value cannot be null."
The program stops right after Application.Run(). and never follows
the event to "delete_cb." I have tried using other events including
a treeview.buttonpressevent and I have gotten the same error. The
only event that I have found works for me is the button_clicked event.
Does anybody know how to fix this? Thanks in advance.
namespace GTKProgram
{
using Gtk;
using Gdk;
using GLib;
using System;
using GtkSharp;
public class GtkStart
{
public static void Main(string[] args)
{
Application.Init();
Gtk.Window win = new Gtk.Window ("Menu Sample App");
win.DeleteEvent += new DeleteEventHandler (delete_cb);
win.ShowAll();
Application.Run();
}
static void delete_cb (object o, DeleteEventArgs args)
{
//SignalArgs sa = (SignalArgs) args;
Application.Quit ();
//sa.RetVal = true;
}
}
}