Re: newbie q: application window architecture
Re: newbie q: application window architecture
- Subject: Re: newbie q: application window architecture
- From: Ondra Cada <email@hidden>
- Date: Sat, 16 Nov 2002 12:05:52 +0100
On Saturday, November 16, 2002, at 01:55 , Carrie Brezine wrote:
...Therefore, I plan to split up the data into categories or levels and
create separate windows for different areas. I think these should
probably go in separate nib files as well, because otherwise I'm afraid
the nib will get too large.
There are many advantages in distributing windows (and other objects)
between NIBs; OTOH, as a newbie you might want to save some work by
putting all the stuff into the main NIB now, and take care of the
distribution later. So far as I can say, there's no such thing as a "too
large NIB". Depends mainly on how you are comfortable with a multi-NIB
architecture just now.
...what is the difference between using a custom NSView and using a group
of controls subclassed into an NSBox?
None from the application's POV. The latter means you have less work to do
though, and thus it is highly preferrable whenever adequate.
...However I *do* need lots of validations on the controls before I send
the info to the db. Instead of subclassing NSView for this, is it
correct to use NSBox and just add a subclass of NSObject to the nib which
would have the job of validating data? Or should data validation always
go in the NSWindowController?
The latter: validate at the controller level. Also, if the data are
entered through text fields (or alike), check NSFormatters -- they are the
best way of validation text input.
One thing I haven't yet gotten to work correctly is loading the same
NSView content into different windows or boxes at the same time.
You can't.
...so I guess what I really need is to create two instances of MyView?
Exactly. Depending on how you are using the thing you might use
archivation to duplicate it or even you might make the view
programmatically, but generally the best way here is to make an extra NIB
file containing just the view, loading the NIB (=creating the view) as
many times as needed.
Also a general application question-- my understanding is that the
MainMenu.nib is the one loaded when the app starts up. So if there is a
login screen, I presume it goes in there? and then the app launches what
will be the primary screen for the application?
Probably so. It is not a must (later, you might find reasons to put the
login into a separate NIB loaded on-demand from something like
-appDidFinishLaunching or so), but at least it's a reasonable beginning.
---
Ondra Cada
OCSoftware: email@hidden
http://www.ocs.cz
private email@hidden
http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.