Re: Multi windows in Document-based app, but 1 Nib
Re: Multi windows in Document-based app, but 1 Nib
- Subject: Re: Multi windows in Document-based app, but 1 Nib
- From: "Sean McBride" <email@hidden>
- Date: Tue, 10 Apr 2007 12:08:39 -0400
- Organization: Rogue Research
On 4/5/07 6:30 PM, Sherm Pendley said:
>On Apr 5, 2007, at 5:53 PM, Todd Heberlein wrote:
>
>> All the documentation for Document-based applications indicate that
>> if you want multiple windows displaying different aspects of a
>> single document (e.g., multiple views of a CAD model), then you
>> should subclass NSWindowController, and then have each
>> NSWindowController subclass load up a separate NIB in the
>> makeWindowControllers method.
>>
>> QUESTION: Why can't I just put multiple windows in the main/
>> original Nib (i.e., MyDocument.nib)?
>>
>> Will something break if I do (now or down the road with future OS
>> or X-Code releases)? What I want to do is have a primary window
>> representing the model/document, and then multiple (but optional)
>> non-editable windows showing different (graphical) views on the
>> same data.
>
>It's not impossible, it's just a bad idea in many (if not most)
>situations.
>
>For instance, it precludes the notion of having one of the windows be
>document-specific, with others being "shared" (like inspector panels)
>among multiple documents. With all your windows in one nib, each
>document will get a complete set of them.
>
>Also, keeping them in multiple nibs allows them to be loaded lazily,
>or on demand. In your case, your secondary windows are optional; why
>take the time and memory to load those nibs if they may not be used?
>
>On the other hand, if your app's workflow dictates that all of the
>windows will be used at some point in each session, there's no
>technical reason why you couldn't keep them all in one nib. The docs
>are simply focusing on the most common use case.
Something else to consider: I find if you are using Cocoa bindings
heavily, things are greatly simplified if you have several windows and
your assorted controllers in one NIB. Cross-NIB binding is something of
a pain. Like everything, the tradeoffs must be considered, and the best
thing to do can be different in different cases.
--
____________________________________________________________
Sean McBride, B. Eng email@hidden
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden