Re: Writing a non-NSDocument based multiple document window apps
Re: Writing a non-NSDocument based multiple document window apps
- Subject: Re: Writing a non-NSDocument based multiple document window apps
- From: Steve Palmer <email@hidden>
- Date: Sun, 14 Mar 2004 13:08:13 -0800
Ah, ha. A nice bloke e-mailed me and clued me up on what I was missing.
In IB, select the Classes tab and then the First Responder subclass of
NSObject. From the Classes menu select the Add Action To First
Responder and type in the actions you want to have available. Remember
the trailing colon. Now when you go back to the Instances tab and
Control draw connections to the First Responder will include your
subclasses actions.
This approach of linking menu items to targets was new to me. Now I've
got it working and the app works fine as an NSDocument based app.
Thanks Spence, and also everybody else who helped on this thread.
On Mar 14, 2004, at 12:13 PM, Steve Palmer wrote:
>
Yes, that was what I was trying to do. The problem is that none of the
>
"Actions in First Responder" in the info panel are the actions for any
>
of the items in my document subclass because the NIB doesn't know
>
about the document subclass. So i've nothing to connect them to. I
>
guess I'm missing something pretty obvious here. :-)
>
>
>
>
On Mar 14, 2004, at 12:05 PM, Louis C. Sacha wrote:
>
>
> Hello...
>
>
>
> In InterfaceBuilder, connect the menu items in the MainMenu.nib to
>
> the "First Responder" object alias in that nib. At run time, this
>
> will end up directing them to the active window if one exists (which
>
> would be your document window).
>
>
>
> This is mentioned in the documentation somewhere, but I can't
>
> remember where at the moment. It might be in the InterfaceBuilder
>
> release notes or docs, and not the normal Cocoa documentation.
>
>
>
> Hope that helps,
>
>
>
> Louis
>
>
>
>
>
>> OK, this one is baffling me and, surprisingly, the online documents
>
>> make no mention of this.
>
>>
>
>>>> any menu/UI validation code will need to move to the NSDocument
>
>>>> subclass, and you'll need to have menu items that you've wired up
>
>>>> yourself that don't interact with firstResponder switch to that
>
>>>> design.
>
>>
>
>> If my main menu is in MainMenu.nib but the code to validate and
>
>> respond to each item is in the document subclass, how do I hook up
>
>> the two? I tried dragging MyDocument.h into MainMenu.nib but that
>
>> didn't work. Do I have to route all commands through an application
>
>> controller class?
>
>>
>
>> - Steve
>
_______________________________________________
>
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.