Re: Linking a Menu To A Document
Re: Linking a Menu To A Document
- Subject: Re: Linking a Menu To A Document
- From: publiclook <email@hidden>
- Date: Thu, 31 Jul 2003 19:17:06 -0400
You mentioned that you already have "Cocoa programming" so I will cite
references from it.
Page 142 briefly explains the responder chain.
Chapter 8 explains the NSResponder class and the responder chain in
detail starting on page 192.
The Target-Action paradigm used by menu items, and controls is
explained in detail starting on page 207. The use of multiple
documents, their interaction with the responder chain, automatic menu
validation, and many other topics are also described in Chapter 8.
Chapter 9 explains how to create a multi-document application WITHOUT
using NSDocument and friends. This explanation includes using the
First Responder and connecting menu items to the First responder so
that their actions will be sent to current responder chain at run-time.
The current responder chain depends on the key and main windows. As
the user changes which document window is key, the current responder
chain changes and the actions from menu items are sent to different
objects. The explanation of how to write your own multi-document
support de-mistifies what Apple's classes are doing.
Page 255 has a figure showing the connection of a menu item to the
First Responder icon in Interface Builder and the text explains what is
being done and why. In fact, pages 254 and 255 exactly answer your
original question complete with pictures.
I might add that Apple's documentation describes all of this and there
are several examples that Apple provides including the TextEdit and
Sketch applications that come with complete source code and are
constructed "the way a true/complex multi-document application should
be".
On Thursday, July 31, 2003, at 01:35 PM, Seth Willits wrote:
On Wednesday, July 30, 2003, at 02:27 PM, Sherm Pendley wrote:
Of all the examples I've looked at, not one has been constructed the
way a true/complex multi-document application would be
Sorry, I don't agree with that. The examples from the books you named
may not be constructed the way a multi-document app works in whatever
environment you're used to, but they are an accurate representation
of how it works in Cocoa.
Not necessarily in the books, but anywhere. And an example of what
would be the fact that I can't find any example that does this yet
every application that uses anything beyond what's "free" would have
to do it. That just confused me. I've heard many many people recommend
Aaron's book, so I think I have a trip to Borders in my future.
Thanks for the help,
Seth Willits
-----------------------------------------------------------------------
----
President and Head Developer of Freak Software - http://www.freaksw.com
Q&A Columnist for REALbasic Developer Magazine -
http://www.rbdeveloper.com
Webmaster for REALbasic Game Central - http://www.freaksw.com/rbgames
"In the eyes of others, spending a lifetime chasing a dream is often
seen
as a lavish waste of a one-time gift, but maybe the joy isn't solely
in
its catching, but also in its pursuit."
-- Seth Willits
-----------------------------------------------------------------------
----
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.