Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Mac Programming / August 2005



Tip: Looking for answers? Try searching our database.

File's owner clarification and others Cocoa issues

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Brieuc Desoutter - 22 Aug 2005 21:18 GMT
Hello there,

I'm (still) new to Cocoa programming and I would really appreciate some
help about the following topics :

- Who is the goddam file's owner  ?

Read from ADC article "WindowControllers and Nib files" :
"When a window controller loads a nib file, it sets itself as the owner
of that nib file."

Read from ADC article "Implementing a document-based application" :
"This project template [the document-based] provides the following things :
- a nib file for the application's document : A subclass of NSDocument
named MyDocument is made File's owner of the nib file. [...]"

I had the beginning of an answer in ADC article "Document Architecture" :
"[...] the NSWindowController usually acts as the File's owner for the
nib" and a little further "In very simple case where there only one
window for a document, you may want your NSDocument class to have
outlets and actions for the nib. In this case, the NSDocument subclass
acts as the file's owner for the nib"

But this raised another questions :
- How do you create document with several Window (like main window and
inspector window) ?

Do you create several windows and associated NSWindowController classes
in the document nib file ? In this case who is the File's owner ? Or...

I'm getting lost...

Thanks for your help

Brieuc
matt neuburg - 22 Aug 2005 22:51 GMT
<Brieuc> wrote:

> Hello there,
>
> I'm (still) new to Cocoa programming and I would really appreciate some
> help about the following topics :
>
> - Who is the goddam file's owner  ?

The file's owner is a proxy in the nib file. Open the nib (e.g.
mainmenu.nib) and look, there's the file's owner in the upper left
corner of the instances window.

The reason I say it's a proxy is that any instance can fulfill this
function. It is the job of the Cocoa program to hook some instance to
the nib as owner when the nib opens.

Usually the instance that fulfills this function is either the NSApp
instance or an NSWindowController instance. But (as you saw) other
architectures are possible. For example, an app that uses the document
architecture might make an NSDocument subclass be the owner for
document.nib, on the grounds that a full-fledged window controller is
unnecessary.

I suggest you read Hillegass. m.

Signature

matt neuburg, phd = matt@tidbits.com, http://www.tidbits.com/matt/
Tiger - http://www.takecontrolbooks.com/tiger-customizing.html
AppleScript - http://www.amazon.com/exec/obidos/ASIN/0596005571
Read TidBITS! It's free and smart. http://www.tidbits.com

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.