/
Menus.rtf
43 lines (40 loc) · 3.22 KB
/
Menus.rtf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf540
{\fonttbl\f0\fnil\fcharset0 Monaco;\f1\fswiss\fcharset0 Helvetica;\f2\fnil\fcharset0 LucidaGrande;
\f3\fmodern\fcharset0 Courier;}
{\colortbl;\red255\green255\blue255;\red65\green204\blue69;\red61\green103\blue199;}
{\*\listtable{\list\listtemplateid1\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc2\leveljcn2\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{none\}}{\leveltext\leveltemplateid0\'02\'05.;}{\levelnumbers\'01;}}{\listname ;}\listid1}}
{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}}
\vieww10300\viewh14340\viewkind0
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural
\f0\fs22 \cf0 Pain in the ass. But this comment in the Sketch application's AppDelegate code...\
\
\pard\tx560\pardeftab560\ql\qnatural\pardirnatural
\f1\fs24 \cf2 \CocoaLigature0 // We could just instantiate all these controllers in the main nib and wire the menu actions up directly. \cf1 \
\cf2 // This way is lazier, but requires a little extra code.
\f0\fs22 \cf0 \CocoaLigature1 \
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural
\cf0 \
...makes me think I can just wire the menu items by code in the WindowController's windowDidLoad event.\
\
Update 082110: We can with this...\
\
\pard\pardeftab720\sa80\ql\qnatural
\f2\fs38 \cf0 Managing the Target and Action\
\pard\tx220\tx720\pardeftab720\li720\fi-720\ql\qnatural
\ls1\ilvl0
\f3\fs26 \cf3 {\field{\*\fldinst{HYPERLINK "http://developer.apple.com/mac/library/documentation/cocoa/reference/ApplicationKit/Classes/NSMenuItem_Class/Reference/Reference.html#//apple_ref/occ/instm/NSMenuItem/setTarget:"}}{\fldrslt \'96\'a0setTarget:}}
\f2 \cf0 \
\ls1\ilvl0
\f3 \cf3 {\field{\*\fldinst{HYPERLINK "http://developer.apple.com/mac/library/documentation/cocoa/reference/ApplicationKit/Classes/NSMenuItem_Class/Reference/Reference.html#//apple_ref/occ/instm/NSMenuItem/target"}}{\fldrslt \'96\'a0target}}
\f2 \cf0 \
\ls1\ilvl0
\f3 \cf3 {\field{\*\fldinst{HYPERLINK "http://developer.apple.com/mac/library/documentation/cocoa/reference/ApplicationKit/Classes/NSMenuItem_Class/Reference/Reference.html#//apple_ref/occ/instm/NSMenuItem/setAction:"}}{\fldrslt \'96\'a0setAction:}}
\f2 \cf0 \
\ls1\ilvl0
\f3 \cf3 {\field{\*\fldinst{HYPERLINK "http://developer.apple.com/mac/library/documentation/cocoa/reference/ApplicationKit/Classes/NSMenuItem_Class/Reference/Reference.html#//apple_ref/occ/instm/NSMenuItem/action"}}{\fldrslt \'96\'a0action}}
\f0\fs22 \cf0 \
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural
\cf0 \
...found here: http://developer.apple.com/mac/library/documentation/cocoa/reference/ApplicationKit/Classes/NSMenuItem_Class/Reference/Reference.html#//apple_ref/doc/uid/20000265-DontLinkElementID_7\
\
The problem is that the two examples we have seen so far rely on a shared AppDelegate to manage the menus and the various, but in our application, everything is entirely single-document-based. I think we'll have to link the menu items together with the WindowController in the windowDidLoad event, but that code is getting really onerous.}