[Mono-osx] Working with delegates
flohei
flo at rootof.net
Thu Dec 2 10:14:32 EST 2010
Hi guys,
thanks for all the detailed explanation on how to use the protocols.
I decided to go with the loosely typed approach to test it out first. I'm
not sure yet if I'll have to go strongly typed later on. So I tried to get
started with - (BOOL)windowShouldClose:(id)sender from the NSWindowDelegate
like this:
[Export("windowShouldClose:")]
public virtual bool WindowShouldClose (NSObject sender) {
Console.WriteLine("WindowShouldClose");
return true;
}
In Objective-C I would have to set the window's delegate to self first, to
make this method get called whenever the window wants to close. So I added
the following to WindowDidLoad()
Window.Delegate = this;
But after that the compiler tells me, that it cannot implicitly convert
MyWindowController to NSWindowDelegate. Yeah, sure. So why not just use
Window.WeakDelegate = this;?
This one throws no error at compile time but when I try to open the Window I
want to use this in my program crashes telling me "Method not found:
'MonoMac.AppKit.NSWindow.set_WeakDelegate'". So is there something I'm still
missing?
Thanks again
–f
--
View this message in context: http://mono.1490590.n4.nabble.com/Working-with-delegates-tp3065391p3069462.html
Sent from the Mono - OSX mailing list archive at Nabble.com.
More information about the Mono-osx
mailing list