[comp.sys.next] How to instantiate DrawPageLayout class of 'Draw'

tashiro@etl.go.jp (Shuichi Tashiro) (08/29/90)

I'm reading the code of Draw ( /NextDeveloper/Examples/Draw ).
There is an object named "DrawPageLayout" in the file window of 
Draw.nib.
I wonder how to create the object.
Because IB doesn't allow to instantiate the subclasses under Window
class.

Does anyone know how to instantiate DrawPageLayout class through IB?

Thanks for any help.

--
TASHIRO Shuichi
tashiro@etl.go.jp

tashiro@etl.go.jp (Shuichi Tashiro) (09/01/90)

On 08/29/90 12:51:40, I wrote
in <46350@etlcom.etl.go.jp> (comp.sys.next:3133/etlcom):

 > I'm reading the code of Draw ( /NextDeveloper/Examples/Draw ).
 > There is an object named "DrawPageLayout" in the file window of 
 > Draw.nib.
 > I wonder how to create the object.
 > Because IB doesn't allow to instantiate the subclasses under Window
 > class.


I've got 2 method to instantiate the subclasses of Window.

<> 1st method <>
   This is an official method :-), suggested by the NeXT Inc. (Thank you).

1) Add a new class (subclass of Window) to the class window.
2) Drag a Window ( or Panel) from Palettes Window to workspace.
3) Set the class of the object using the Inspector's Attributes Panel.
   (Your new class will appear in the Inspector's window)

Beautiful! 


<> 2nd method <>
   I found it through trial and error.
   
1) Create a dummy nib file (ex. dummy.nib).
2) Add a class (ex. class1) as a subclass of Object ( or other class which
   IB allows instantiation).
   This is a dummy class. You need not define outlets or actions.
3) Instantiate class1.
4) Create another nib file (ex. new.nib).
5) Define class1 as a subclass of Window.
7) Select the instance icon of class1 in dummy.nib's File Window.
8) Copy it into Pasteboard using Command-c.
9) Select the File Window of new.nib.
10) Extract the instance from Pasteboard using Command-v.

Dirty! X-<

But I guess the author of Draw did 2nd method.

Because the displays of the Inspector for the instances created by
these methods are different, and the display for Draw's DrawPageLayout
is same as the one created by 2nd method.

Any comment will be welcome.

--
TASHIRO Shuichi
tashiro@etl.go.jp

rca@cs.brown.edu (Ronald C.F. Antony) (09/02/90)

If you want to use a hack method to instantiate a window subclass then
the following is easier:

1) create subclass of object
2) instantiate it
3) cut it's icon (cmd-x)
4) select the subclass and delete it (delete key)
5) make the subclass under window again
6) go back to the icons and paste the instance back (cmd-v)

This is much easier and faster than the 10-step method described in a
earlier posting.

Ronald
------------------------------------------------------------------------------
"The reasonable man adapts himself to the world; the unreasonable one persists
in trying to adapt the world to himself. Therefore all progress depends on the
unreasonable man."  Bernhard Shaw | rca@cs.brown.edu or antony@browncog.bitnet