Skip navigation.
 
mlRe: Creating new instances of a window?
FROM : Ondra Cada
DATE : Sun Nov 10 20:33:23 2002

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_removed>              http://www.ocs.cz
private        <email_removed>            http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

Related mailsAuthorDate
mlCreating new instances of a window? Victor Ng Nov 10, 09:16
mlRe: Creating new instances of a window? Andreas Mayer Nov 10, 18:43
mlRe: Creating new instances of a window? Ondra Cada Nov 10, 20:33
mlRe: Creating new instances of a window? Victor Ng Nov 10, 21:23
mlRe: Creating new instances of a window? Ondra Cada Nov 10, 22:34