[Gtk-sharp-list] Events in Gtk#

Eric Sowell eric.sowell@lexelsoftware.com
Mon, 28 Mar 2005 22:08:05 -0600

Well, wish I could offer a suggestion. I compiled it as follows and it 
ran, and closed, without any trouble:

mcs csfile.cs -pkg:gtk-sharp

Also, you could lose half of your namespace references. In this case all 
you need is the references to Gtk and System.

Eric Sowell

Douglas A Wolfe wrote:

>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
>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;
>               }
>       }
>Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com