Re: Creating new instances of a window?
Re: Creating new instances of a window?
- Subject: Re: Creating new instances of a window?
- From: Ondra Cada <email@hidden>
- Date: Sun, 10 Nov 2002 20:33:23 +0100
On Sunday, November 10, 2002, at 09:16 , Victor Ng wrote:
It is not clear to me how I should be creating 'new' instances of a
window when I click a button in Cocoa.
Normally, by reading in a NIB containing the window.
Alternatively you can create a window programmatically by [[NSWindow alloc]
initWith... (a number of arguments I don't bother to remember, they are
to be found in NSWindow.html)]. That's a last resort though, and you
should very very seldom need that.
I want to be able to create a new FooController and the associated
FooWindow which is in a NIB file whenever I invoke method in
AppController called createNewFoo.
So just load the NIB. That's exactly what NSDocument would do, if involved.
My problem is that the examples I have read in the Hillegass book and in
the Vermont recipes usually involves an NSDocument. This isn't what I
really want since the contents of the view aren't going to be saved as a
file back to the filesystem.
Even that, you still can use NSDocument. Or don't need to. The framework's
pretty flexible.
I've tried pulling out the FooController from AppController and
instantiating a new FooController on every invocation of "createNewFoo",
but this seems to give me a sig11 fault.
Well then there is some bug -- quite probably, you forgot to retain
something.
btw - on a totally different note - it's amazing to me how friendly the
Cocoa community is compared to the Java community. I don't think anyone
has ever answered any of my Java questions on the mailing lists in the
last 2 years.
Well, Cocoa's good for programming. Java's good for... let's stop it ;)))
---
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.