FROM : Daniel Jalkut
DATE : Thu Apr 05 15:56:02 2007
On Apr 4, 2007, at 10:06 AM, Jay wrote:
> Thanks for your reply, Daniel,
> My current problem is that, I have added the menuitem in IB, I have
> added the "toggleRuler" method in the cutomerView class and
> implemented it in .m file, but I have no idea for what to do next.
> I noticed that the menuitem I chose "ShowRuler" is already by
> default connected to the "1st Responder" instance icon in the
> MainMenu.nib window, but I have no idea whether it should be
> reconnected to somewhere else in order to connect to the
> "toggleRuler" method implemented in the cutomerView class. Thanks.
>
> Should I make an instance of the customView as well in the nib file?
Hi Jay - it sounds like a lot of questions will disappear for you if
you become a bit more comfortable with "the responder chain" and how
it works with your application. In particular, you want to get a good
understanding of how "first responder" represents more than just the
focused view - it also represents every parent of that view
(typically), and ultimately some key delegates such as a the window's
delegate and the application delegate.
http://developer.apple.com/documentation/Cocoa/Conceptual/
CocoaFundamentals/CoreAppArchitecture/chapter_7_section_6.html
Short story short: you leave your menu item wired up to first
responder, but you add the "toggleRuler:" (note the colon not
included in your text) method not to the specific view that will have
its ruler toggled, but to some class that is guaranteed to be in the
responder chain when the menu item should be selectable.
The custom view may still have a "toggleRuler:" method, but if it's
not in the responder chain, and you still want to allow the user to
toggle it, then some other object in the responder chain (possibly
the window's delegate or the NSDocument) needs to take responsibility
for passing that message along.
This is probably hard to take in, so read the documentation linked
above. You will probably also benefit from listening to Aaron
Hillegass speak on the subject in his interview on Late Night Cocoa:
http://latenightcocoa.com/?q=node/56
Good luck!
Daniel Jalkut
http://www.red-sweater.com/blog/
DATE : Thu Apr 05 15:56:02 2007
On Apr 4, 2007, at 10:06 AM, Jay wrote:
> Thanks for your reply, Daniel,
> My current problem is that, I have added the menuitem in IB, I have
> added the "toggleRuler" method in the cutomerView class and
> implemented it in .m file, but I have no idea for what to do next.
> I noticed that the menuitem I chose "ShowRuler" is already by
> default connected to the "1st Responder" instance icon in the
> MainMenu.nib window, but I have no idea whether it should be
> reconnected to somewhere else in order to connect to the
> "toggleRuler" method implemented in the cutomerView class. Thanks.
>
> Should I make an instance of the customView as well in the nib file?
Hi Jay - it sounds like a lot of questions will disappear for you if
you become a bit more comfortable with "the responder chain" and how
it works with your application. In particular, you want to get a good
understanding of how "first responder" represents more than just the
focused view - it also represents every parent of that view
(typically), and ultimately some key delegates such as a the window's
delegate and the application delegate.
http://developer.apple.com/documentation/Cocoa/Conceptual/
CocoaFundamentals/CoreAppArchitecture/chapter_7_section_6.html
Short story short: you leave your menu item wired up to first
responder, but you add the "toggleRuler:" (note the colon not
included in your text) method not to the specific view that will have
its ruler toggled, but to some class that is guaranteed to be in the
responder chain when the menu item should be selectable.
The custom view may still have a "toggleRuler:" method, but if it's
not in the responder chain, and you still want to allow the user to
toggle it, then some other object in the responder chain (possibly
the window's delegate or the NSDocument) needs to take responsibility
for passing that message along.
This is probably hard to take in, so read the documentation linked
above. You will probably also benefit from listening to Aaron
Hillegass speak on the subject in his interview on Late Night Cocoa:
http://latenightcocoa.com/?q=node/56
Good luck!
Daniel Jalkut
http://www.red-sweater.com/blog/
| Related mails | Author | Date |
|---|---|---|
| Jay | Apr 4, 14:40 | |
| Jay | Apr 4, 16:06 | |
| Daniel Jalkut | Apr 5, 03:35 | |
| Clint Shryock | Apr 5, 15:32 | |
| Daniel Jalkut | Apr 5, 15:56 |






Cocoa mail archive

