mail-archives/mono-osx/2010-November/003418.html

98 строки
3.1 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Mono-osx] Working with delegates
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:mono-osx%40lists.ximian.com?Subject=%5BMono-osx%5D%20Working%20with%20delegates&In-Reply-To=4CF505C8.1040406%40yessoftware.com">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="003415.html">
<LINK REL="Next" HREF="003421.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Mono-osx] Working with delegates</H1>
<B>Miguel de Icaza</B>
<A HREF="mailto:mono-osx%40lists.ximian.com?Subject=%5BMono-osx%5D%20Working%20with%20delegates&In-Reply-To=4CF505C8.1040406%40yessoftware.com"
TITLE="[Mono-osx] Working with delegates">miguel at novell.com
</A><BR>
<I>Tue Nov 30 10:40:14 EST 2010</I>
<P><UL>
<LI>Previous message: <A HREF="003415.html">[Mono-osx] Working with delegates
</A></li>
<LI>Next message: <A HREF="003421.html">[Mono-osx] Working with delegates
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#3418">[ date ]</a>
<a href="thread.html#3418">[ thread ]</a>
<a href="subject.html#3418">[ subject ]</a>
<a href="author.html#3418">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>&gt;<i>
</I>&gt;<i>
</I>&gt;<i> I know two possibilities: use object of separate class which will
</I>&gt;<i> inherit from NSWindowDelegate, overriding specific methods; or mark
</I>&gt;<i> [Export(&quot;windowShouldClose:...&quot;)] methods in your controller class.
</I>&gt;<i>
</I>&gt;<i> There may be other ways, though.
</I>&gt;<i>
</I>
That pretty much covers it.
To recap, if you want to go strongly typed, you have two options: (a)
inherit from NSWindowDelegate and override methods or (b) Use C# events
exposed on the NSWindow class.
If you do not mind going loosely typed, then all you have to do is create
any class that derives from NSObject and decorate the methods with [Export]
very much like we do in the source code for MonoMac itself.
Miguel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <A HREF="http://lists.ximian.com/pipermail/mono-osx/attachments/20101130/08941dc4/attachment.html">http://lists.ximian.com/pipermail/mono-osx/attachments/20101130/08941dc4/attachment.html</A>
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="003415.html">[Mono-osx] Working with delegates
</A></li>
<LI>Next message: <A HREF="003421.html">[Mono-osx] Working with delegates
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#3418">[ date ]</a>
<a href="thread.html#3418">[ thread ]</a>
<a href="subject.html#3418">[ subject ]</a>
<a href="author.html#3418">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://lists.ximian.com/mailman/listinfo/mono-osx">More information about the Mono-osx
mailing list</a><br>
</body></html>