[Mono-osx] Working with delegates

Alexander Shulgin alexander.shulgin at yessoftware.com
Tue Nov 30 09:10:16 EST 2010

On 30.11.2010 15:44, flohei wrote:
> Hi there,
> I'm experiencing some trouble working with delegates. How do I properly use
> e.g. the NSWindowDelegate? I'm not sure how to adopt this protocol in C#. In
> my WindowController class I want to set its Window.Delegate property to
> 'this' to receive windowShouldClose and windowWillClose events. So how can I
> tell my WindowController to inherit from NSWindowController and also adopt
> the NSWindowDelegateProtocol?

I know two possibilities: use object of separate class which will 
inherit from NSWindowDelegate, overriding specific methods; or mark 
[Export("windowShouldClose:...")] methods in your controller class.

There may be other ways, though.


More information about the Mono-osx mailing list