Hi,

I try to catch a window close event in my controller class, but the eventhandler never gets executed. This is my code :

using System;
using System.Collections.Generic;
using System.Text;

using Monobjc;
using Monobjc.Cocoa;

namespace windows_events
{
   [ObjectiveCClass]
   public class MyWindow : NSWindow
   {
       public MyWindow() : base() { }
       public MyWindow(IntPtr native_object) : base(native_object) { }

       [ObjectiveCMessage("awakeFromNib")]
       public void awakeFromNib()
       {
Console.WriteLine(this.GetType().ToString() + " : awakeFromNib"); this.WindowWillClose += new WindowWillCloseEventHandler(MyWindow_WindowWillClose);
       }

       void MyWindow_WindowWillClose(NSNotification notification)
       {
           Console.WriteLine("window closes");
       }
   }
}

The documentation says, just add an event handler. So I subclassed from NSWindow and just added an event handler, but it never gets executed.

Why ?
Many thanks,
Miguel


Reply via email to