Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!mit-eddie!uw-beaver!Teknowledge.COM!polya!ali From: ali@polya.Stanford.EDU (Ali T. Ozer) Newsgroups: comp.sys.next Subject: Re: Multiple instantiation of windows laid out with IB Message-ID: <12611@polya.Stanford.EDU> Date: 24 Oct 89 02:49:15 GMT References: <130030@gore.com> Reply-To: Ali_Ozer@NeXT.com (Ali Ozer) Organization: . Lines: 21 In article <130030@gore.com> jacob@gore.com (Jacob Gore) writes: >Is there a way to use the Interface Builder to set up a window, and then >create an arbitrary number of copies of this window from the program, at >run-time? >For example, suppose I use IB to lay out a DocumentWindow, and my >application requires opening a separate DocumentWindow for each document it >edits. Yes; the easist way to do this is to create a separate .nib file for your window and load it in whenever you need to create a new document. Take a look at the Yap source; at the YapDocument.m file. In its "new" factory method it loads the YapDocument.nib file, right after creating a new instance of the class. This new object is specified as the "owner" to the loadNibSection:owner: method; thus the outlet initialization methods in this object will be called. YapDocument.nib has one outlet, "document," thus the "setDocument:" method of this new object is invoked, giving it a handle to the text object in this window. Ali Ozer, NeXT Developer Support Ali_Ozer@NeXT.com