Re: Calling IB Actions In PB
Re: Calling IB Actions In PB
- Subject: Re: Calling IB Actions In PB
- From: Albert Atkinson <email@hidden>
- Date: Sun, 14 Apr 2002 09:23:42 -0500
Hello!
FINALLY! It works now! Thank you so much for your help!
Have a great day!
Albert
On Sunday, April 14, 2002, at 09:01 AM, j o a r wrote:
On Sunday, April 14, 2002, at 03:44 , Albert Atkinson wrote:
[toolbarItem setTarget: self];
[toolbarItem setAction: @selector(openDocument:)];
<snip>
[toolbarItem setTarget: self];
[toolbarItem setAction: @selector(newDocument:)];
You should ask yourself, "what object is responding to these
action methods". In this case it looks to be a document
controller, perhaps even the shared / default dito? If so, try
something like this:
[toolbarItem setTarget:[NSDocumentController
sharedDocumentController]];
The reason that you didn't know this is because normally these
actions are sent from a menu item, and the glue to the object is
handeled by a piece of Cocoa magic know as "first responder". This
is not something that is easy to grok at first - but it's not a
very difficult concept, and definitively one of the things that
make Cocoa great, so you should learn it sooner rather then
later... :)
Read the documentation for NSResponder and the "first responder
chain", and the overview / topic documentation for event
handling - that is linked from the documentation of NSResponder.
Good luck,
j o a r
_______________________________________________
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.