• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: determining front most document?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: determining front most document?


  • Subject: Re: determining front most document?
  • From: Johnny Deadman <email@hidden>
  • Date: Tue, 26 Apr 2005 07:59:26 -0400

I handle this as follows:

The windowController for the main window notifies the Application Delegate whenever it becomes key, and the App Delegate sets an iVar called 'document' to the current document. This is only changed when another main document window becomes key. This reference to the document is then available globally in the app. I use this both for inspector panels which dynamically update their content to reflect the current document, and for objects which sometimes need to access the current document but don't need to retain a reference.



On 26-Apr-05, at 5:36 AM, Jonathon Mah wrote:

When I bring my preferences window forward, it puts my document behind (as expected). However, I want my pref window to access the "current" document, which I guess is defined as the top most window that has a document associated with it. [[NSDocumentController sharedDocumentController] currentDocument] doesn't work because it returns the document associated with the main window, which is my preference window (so returns nil).

No idea if it will make a difference, but what if you make the Preferences window a panel instead?

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >determining front most document? (From: Mark Dawson <email@hidden>)
 >Re: determining front most document? (From: Jonathon Mah <email@hidden>)

  • Prev by Date: Re: Binding button.enabled to "NSTextField is not empty"
  • Next by Date: Re: How to get the CGDirectDisplayID?
  • Previous by thread: Re: determining front most document?
  • Next by thread: Re: determining front most document?
  • Index(es):
    • Date
    • Thread