NSDocumentController, NSDocument and toolbars
NSDocumentController, NSDocument and toolbars
- Subject: NSDocumentController, NSDocument and toolbars
- From: "John Love" <email@hidden>
- Date: Sun, 27 Jul 2008 08:02:51 -0400
I sub-class NSDocument and call it MedDocument. My code is similar to
Apple's SimpleToolbar .. the biggest difference is that I create a Category
= MedDocument+ToolbarDelegateCategory in order to compartmentalize the code,
i.e., keep the toolbar stuff in a separate file. And it works .. except for
one item; that is, within the delegate methods: - (NSToolbarItem*)
toolbar:(NSToolbar*)toolbar itemForItemIdentifier:(NSString*)itemIdent
willBeInsertedIntoToolbar:(BOOL)willBeInserted; and - (void)
toolbarWillAddItem:(NSNotification*)notif; I call:
[toolbarItem setTarget:self];
[toolbarItem setAction:@selector(openDocument:)]; as Apple specifies. But
openDocument: is a method of NSDocumentController, not NSDocument ...
*unless* I place this action method within my MedDocument ... and such a
place is clearly wrong .. besides in Apple's sample it is not there. What I
*do* want to override within MedDocument is: - (BOOL)
readFromURL:(NSURL*)absoluteURL ofType:(NSString*)typeName
error:(NSError**)outError; as one of the few methods which Apple specifies
should be overridden. What is going on here? John Love
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden