Re: Creating new instances of a window?
Re: Creating new instances of a window?
- Subject: Re: Creating new instances of a window?
- From: Victor Ng <email@hidden>
- Date: Sun, 10 Nov 2002 15:23:21 -0500
Thanks!
I'm not sure what I was doing last night, but my windows are popping up
normally now.
The only problem I have left is that on closing, the window is not
releasing the controller for that window.
I'll try reworking my program to use NSDocument and
NSDocumentController instead to see how it works out.
thanks again,
vic
On Sunday, November 10, 2002, at 02:33 PM, Ondra Cada wrote:
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
---
blog:
http://radio.weblogs.com/0108956
email: email@hidden
MSN: email@hidden AIM: email@hidden
_______________________________________________
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.