Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!uunet!rosie!aozer From: aozer@next.com (Ali Ozer) Newsgroups: comp.sys.next Subject: Re: "File's Owner" object in interfact builder Message-ID: <566@rosie.NeXT.COM> Date: 25 Apr 91 15:42:29 GMT References: <2571@fornax.UUCP> Sender: news@NeXT.COM Organization: Next Computer, Inc. Lines: 34 Nntp-Posting-Host: twinpeaks.next.com In article <2571@fornax.UUCP> mcdonald@fornax.UUCP (Ken Mcdonald) writes: >Does anyone understand the use of the "File's Owner" object given in the >window along with the suitcases and such, in Interface Builder? I've read >the docs and this, and still don't have a clue exactly what the use of >this object is. Am I supposed to use it as if it were my Application Object? The file's owner object is the object specified as the owner in the loadNib call which is loading this nib file. Your app's default nib file is loaded in main(): [NXApp loadNibSection:"MyApp.nib" owner:NXApp]; Thus, for the default nib file, the owner is the Application object. However, you will usually load other nib files during the execution of the app (to get various auxillary panels, document windows, etc). Then you might have another object specified as the owner: [NXApp loadNibSection:"Document.nib" owner:someObject withNames:NO]; The owner is the object which contains the outlet variables for the various outlets in the nib. For instance, if you are loading a nib file containing a document window, by the time the nib is loaded you'd want to have a handle to the window; you'd accomplish this by an instance variable in the document object that's an outlet to the window. I believe some of the examples demonstrate this; most load info panels this way, and some also use this method for document windows and such. Performance hints: Use the withNames: argument to loadNibSection:owner:withNames: and set it to NO to avoid reading all the object names in. Prevents lots of small mallocs. Also use the zone: argument to take advantage of the zone facility to get better localization. Ali, Ali_Ozer@NeXT.com