Re: Connecting actions to menu
Re: Connecting actions to menu
- Subject: Re: Connecting actions to menu
- From: jgo <email@hidden>
- Date: Fri, 15 Jun 2001 14:38:48 -0700
>
Henri Lamiraux <email@hidden> Tue, 2001-06-05 10:18:38 -0700 wrote:
>
> On Tuesday, 2001 June 5 at 05:15, Ivan Myrvold wrote:
>
> I need to connect the actions I have created in my document-based Cocoa
>
> program. The actions are in the MyWindowController class that I
>
> subclassed in MyDocument.nib. But I can not connect them to the
>
> MainMenu, because the menu is in another nib, MainMenu.nib. And this
>
> nib file don't have a subclass of NSWindowController called
>
> MyWindowController. So how can I do that?
>
In your main nib add your window controller actions to the
>
firstResponder and connect your menu itemS to the firstResponder.
>
At runtime when one of your document window is key its window
>
controller will be in the responder chain (because the window
>
controller is the delegate of the window). Everything will
>
work just fine. This is one of the reason for the existence
>
of the firstResonder.
But "firstResponder" is not a static thing. Isn't the current
first responder dependent on the context and event? Let's
see, pp 132 et seq. from the anonymous "author": "Each NSWindow
in an application keeps track of the object in its view hierarchy
that has first responder status [gets first dibs on handling
an event]. [The first responder] is the NSView that currently
receives... events... any NSView within the window can become
first responder... You can also set the first responder
programmatically... the first responder object can be a target
of an action message sent by an NSControl, such as a button or
a matrix..." and then it goes on to say something similar to
what you do above, and equally contradictory. But, then
discusses the concept of an initial first responder.
If something is done in IB, it would be "static", defined
before compile, but what is the first responder is a
dynamic, execution time issue... or so I am led to believe.
Please, expostulate & clarify.
John G. Otto Nisus Software, Engineering
www.infoclick.com www.mathhelp.com www.nisus.com software4usa.com
EasyAlarms PowerSleuth NisusEMail NisusWriter MailKeeper QUED/M
My opinions are probably not those of Nisus Software, Inc.