objective c - Working with the frontmost window's controls in a document-based app? -


i've scanned documentation , googled extensively , found nothing on subject.

what i'm needing interact specific instance of 1 of nswindows - is, 1 created through nsdocument system put in place creating document-based application in xcode.

so there way this? [[nsshareddocumentcontroller frontmostwindow] subview: doaction], perhaps?

to obtain frontmost window (aka main window), use -[nsapplication mainwindow]:

nswindow *mainwindow = [nsapp mainwindow]; 

to obtain window corresponding given document:

nsdocument *somedocument; // reference document you’re interested in nswindow *window = [[[somedocument windowcontrollers] objectatindex:0] window]; 

nsdocument creates single window controller manage corresponding document window, -[nsdocument windowcontrollers] returns array single element corresponding window controller. -[nswindowcontroller window] returns window managed window controller.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -