Re: Interface Builder and projects with variable number of windows
Re: Interface Builder and projects with variable number of windows
- Subject: Re: Interface Builder and projects with variable number of windows
- From: Niko Matsakis <email@hidden>
- Date: Wed, 28 May 2003 11:25:01 -0400 (EDT)
I'm still a learner myself, but the answer to your question is similar to a
document-based architectures etc, I should think.
I believe that what you should do is to create a new nib that has the
status window in it. In this nib, you make the "File Owner" instance have
the class that you are using to control the status window.
In your code, when you want to launch a window of this type, you load and
instantiate the nib. I don't have my mac in front of me now or any of
my books/references, so I can't remember the name of any of these methods ---
however, when you instantiate the nib you will have an opportunity to provide
the File's Owner (which would be an instance of your controller class, I
believe).
Also, any initialization that needs to tkae place in the controller class
which requires that the window be present should take place in a "awakeFromNib"
method, not the constructor.
niko
On Wed, 28 May 2003, Markus Hanauska wrote:
>
Sorry for this probably extremely dumb, newbie question. I really tried
>
to find an answer myself, but I don't even know how to search for it
>
(which keywords to use), as it's not easily said in a word or two.
>
>
So far I have only played around with Project Builder, nice tool, rapid
>
app development. The lanuguage of my choice is Java, because it's also
>
rapid app development (garbage collection, super easy string concat,
>
also extreme simple conversion between primitiv formats, classes for
>
all common tasks exist and I never had to debug Java code, while I'm
>
debugging C code all day long). Sometimes it's not about speed.
>
>
My problem is: I can easily build a main window with the Interface
>
Builder. Cool. I can add a handler and have Java managing all button
>
clicks, text field changes, etc.. Within a few minutes I have a working
>
main window for my app. So far, so well.
>
>
But now there is a list of servers in the main window (editable by
>
user, works all fine) and whenever the user clicks on a server, a
>
status window for this very server shall show up. And exactly here is
>
my problem.
>
>
When I design such a status window in the Interface Builder, than I
>
have one window. What if I now want to open exactly this window many
>
times, always with a class in the background that receives a different
>
server adress and then sets the text fields and graphics of the window
>
accordingly? How can I do that with Interface Builder? Is it even
>
possible?
>
>
Therefor I have to write a class that does NOT have a static outlet,
>
but a dynamic outlet, so every instance of this class gets a reference
>
to another status window. And how can I open the same window multiple
>
times?
>
>
Right now (with my current knowledge) it seems to me that if you want
>
to have 100 status windows, you have to store 100 identical windows
>
into the NIB file, create 100 times the backend class and connect each
>
window with the outlet of one backend class. But what if the user then
>
would like to open 200 status windows at once? (whether it makes sense
>
or not, if he has the resources, it must be possible)
>
>
That's what I don't understand about the concept. E.g. how would I go
>
about writing a Web Brower using only Java and Interface Builder? I
>
need *multiple* browser Windows at once, each driven by the same
>
backend code, but this code always takes only care of one window.
>
>
Or do I then have to create the full window all by myself, creating
>
every object within the window, altering size and position, setting
>
hundreds of attributes... then I would have to drop Cocoa in the long
>
run and use Swing, because there exists Interface Builders that only
>
make a "pattern" of a window and I can then create as many instances of
>
the resulting class as I need.
>
>
Did someone understand my question? It would be very nice if anyone
>
could shine a light on this issue. Thank you.
_______________________________________________
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.