Re: And now for my next question(s)...
Re: And now for my next question(s)...
- Subject: Re: And now for my next question(s)...
- From: "Simon Stapleton" <email@hidden>
- Date: Fri, 06 Jul 2001 13:49:26 +0100
>
From: Simon Stapleton <email@hidden>
>
To: email@hidden
>
Subject: And now for my next question(s)...
>
>
Hi.
>
>
Thanks for those who've answered my previous questions. I think
>
my
>
understanding of the event system has now 'clicked' - I managed to
>
add
>
another 6 perfectly working controls to the main window of my app
>
in 10
>
minutes last night - and that bit's done. Yay Cocoa!
>
>
However...
>
My app will have another 6 views on specific parts of the document
>
-
>
these views will share much processing. For example, each view
>
will
>
live in a similar window with identical buttons and handling of
>
those
>
buttons - as a result, I have a nib file which contains the window
>
>
layout, buttons, and an NSView to hold the content. I also have a
>
>
windowcontroller which handles the button behaviour. I figure
>
what I
>
should do now is either subclass the windowcontroller to handle
>
the
>
separate windows or use categories for this. I should then
>
generate nib
>
files for the embedded component views, contain all the controls
>
nested
>
in a view within that nib, and then somehow 'extract' that view
>
and
>
replace the view in the higher level window with it.
Replying to myself here, which is bad form, but...
I think I'm on the right track now. After rereading bits of
the 'Discovering Rhapsody' PDF[1] I discover I should be using NSBox to
hold my separate views, and using removeFromSuperView. So far, so good,
and I'll be able to get that all hacked in in no time.
I'll use categories to handle the specifics at the window level (frankly,
there's very little difference between the views at the higher level, and
nothing to stop me using categories - in fact, all I need to do is change
the window title). I may even be able to get away without this.
Of course, my app is rather more complex than I intimated at the beginning
[3]. For each Window, there will be a bunch of generic stuff, and an
NSBox for the component view. That component view will be specific to
the particular type of window. The component view may well, and in most
cases will, contain yet another subview, which will contain some
specialised view subclasses. Of course the subviews and subclasses will
be applicable to almost all of the window types (but not all at once).
So. I need to separate out the subview handling to separate classes so I
don't have to code everything in one monster class with a ginormous nib
file containing all possible views and subviews. The subviews, of
course, will be hideously complex - complex enough that I want to
separate them all out to keep things manageable.
I propose each subview type have its own nib file and a windowcontroller
to deal with it, and use all that NSBox goodness to rip the views
themselves out and into the main window / component view / whatever.
Or have I got this completely wrong?
Simon
[1] Yes, I really am too cheap to buy 'Learning Cocoa'[2]
[2] Which may be the root cause of some of my problems ;-)
[3] As is always the case
--
Your mouse has moved. You must reboot Windows NT for these changes to be
recognised.
This message was sent by Easymail -
http://www.easynet.co.uk/