cocoa - NSDocument subclass instance apparently not in responder chain -


i'm creating first nsdocument based application. i'm able create new documents, both scratch , importing legacy files.

this app allow multiple windows per document, overriding makewindowcontrollers. method simple:

- (void) makewindowcontrollers {     if (documentdatabase == nil) return;     datasheetwindowcontroller * dswc = [[datasheetwindowcontroller alloc] initwithdatabase:documentdatabase];     [self addwindowcontroller: dswc]; } 

the window appears expected, however, save, revert save, , other document enabled menus disabled, if document not in responder chain.

as experiment, tried adding method nswindowcontroller class:

- (void)savedocument:(id)sender {     [[self document] savedocument:sender]; } 

with method in place, save menu item enabled, , selecting causes document's save methods invoked.

from reading documentation , other questions on stack overflow, it's clear wrong -- should not have put method in nswindowcontroller class. i'm sure i've overlooked silly, life of me cannot figure out is, or other mention of problem here or elsewhere on web.

some additional information may useful -- in ib, window's owner , delegate set nswindowcontroller. created method display responder chain (see how inspect responder chain?) , document not listed. here output of responder chain (however, since nsdocument not subclass of nsresponder, i'm not sure if supposed listed anyway).

responder chain: <nsclipview: 0x102344350> <nsscrollview: 0x102344480> <nsview: 0x102345040> <nswindow: 0x10234e090> 

since savedocument method put nswindowcontroller class work, indicates me window controller know associated document.

so -- thoughts why document behaving if not in responder chain?

updated info: after setting new document, initwithtype method includes temporary line make sure document status edited:

[self updatechangecount:nschangedone]; 

i have verified isdocumentedited returns true.

i'm going suggest solution 1 pointed here:

https://stackoverflow.com/a/9349636/341994

in nib containing window window controller loading, file's owner proxy needs of window controller's class (select file's owner proxy , examine identity inspector confirm / configure that), , window outlet must hooked window , window's delegate outlet must hooked file's owner proxy (select file's owner proxy , examine connections inspector confirm that).


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo