mail-archives/mono-osx/2010-December/003521.html

99 строки
3.6 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Mono-osx] How to work with Main Menu?
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:mono-osx%40lists.ximian.com?Subject=%5BMono-osx%5D%20How%20to%20work%20with%20Main%20Menu%3F&In-Reply-To=C934F94D.17B%25draekz%40gmail.com">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="003516.html">
<LINK REL="Next" HREF="003517.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Mono-osx] How to work with Main Menu?</H1>
<B>Miguel de Icaza</B>
<A HREF="mailto:mono-osx%40lists.ximian.com?Subject=%5BMono-osx%5D%20How%20to%20work%20with%20Main%20Menu%3F&In-Reply-To=C934F94D.17B%25draekz%40gmail.com"
TITLE="[Mono-osx] How to work with Main Menu?">miguel at novell.com
</A><BR>
<I>Wed Dec 22 23:18:17 EST 2010</I>
<P><UL>
<LI>Previous message: <A HREF="003516.html">[Mono-osx] How to work with Main Menu?
</A></li>
<LI>Next message: <A HREF="003517.html">[Mono-osx] Adding Monomac capabilities to an existent project
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#3521">[ date ]</a>
<a href="thread.html#3521">[ thread ]</a>
<a href="subject.html#3521">[ subject ]</a>
<a href="author.html#3521">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>Hello,
I'm struggling to figure out how to work with the Main Menu. I've worked
&gt;<i> through the tutorial and learned how to attach events and how to setup items
</I>&gt;<i> to show up in the Main Window. I can click on buttons and update labels etc.
</I>&gt;<i> I'm trying to do the same for MainMenu but it doesn't have a Main Menu
</I>&gt;<i> Controller like the Main Window Controller that the main window has.
</I>&gt;<i>
</I>&gt;<i> How do I write code for clicks on menu items?
</I>&gt;<i>
</I>
I have not tested these steps, but the last time I did something like this
it was very easy.
You connect the &quot;Sent Action&quot; in the UI to a target. This can be any of
your File Owner (the MainMenu.cs), the First Responder (it would route this
to whoever has the focus at this point) or the AppDelegate (a convenient
place to put it).
For each of the actions that you receive, merely decorate your method with
an [Export] attribute, like this:
[Export (&quot;newDocument:&quot;)]
public void NewDocument () {}
This is convenient because the default menu already has a &quot;newDocument:&quot; in
there, for your own items, just hook up the Sent action manually.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <A HREF="http://lists.ximian.com/pipermail/mono-osx/attachments/20101222/6ebebdd2/attachment.html">http://lists.ximian.com/pipermail/mono-osx/attachments/20101222/6ebebdd2/attachment.html</A>
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="003516.html">[Mono-osx] How to work with Main Menu?
</A></li>
<LI>Next message: <A HREF="003517.html">[Mono-osx] Adding Monomac capabilities to an existent project
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#3521">[ date ]</a>
<a href="thread.html#3521">[ thread ]</a>
<a href="subject.html#3521">[ subject ]</a>
<a href="author.html#3521">[ 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>