[comp.sys.next] IB Help

judge@gpu.utcs.utoronto.ca (Peter Judge) (06/13/90)

Could someone point out what I'm doing wrong here?
 
I'm working on a (minor) variation of Project Four (p. 8-51). This is the
one where you use two interface files in your application.

The program compiles ok, but when I select the menu item that invokes 
the - createTextEditor method, it only gets as far as sending the message
"+ new" to my TextEditor object.

The "+ new" method in the TextEditor class 
is copied straight from the book.

It hangs in the "+ new method (which is found in TextEditor.m). 
 
 I put a printf() right after "self = [super new];" and before 
"[NXApp loadNibSection:"textEditor.nib" owner:self];" 

This printf() is printed out in an endless loop!
The menu item remains highlited and no window is seen on the screen.

I'm sure this is the result of something stupid I'm doing, since I am 
modifying the example in the book somewhat.

I'd be grateful if someone could point me in the right direction.

Thanks in advance.

Peter Judge	(judge@credit.erin.utoronto.ca)

 
-- 
===============================================
judge@credit.erin.utoronto.ca	(Peter Judge) |)
judge@gpu.utcs.utoronto.ca 
===============================================

stuart@previous.ADS.COM (Stuart Crawford) (06/14/90)

My guess is that you have instantiated TextEditor in the nib file.
You should not do this, since the owner of the file should be a
TextEditor.  If you do have an instance of TextEditor in the file, the
following will happen:

You instantiate TextEditor from your program, which then loads the nib
file.  Since the nib file has an instance of TextEditor in it, it runs
[TextEditor new] when loaded.  This loads the nib file again, which
runs new, which loads the nib file, which runs new, which....

Just get rid of the instance in the nib file, make sure the owner of
the nib file is TextEditor, and connect your outlets to the file owner
icon.  Everything should be fine.

Stuart Crawford
Advanced Decision Systems
stuart@ads.com
--

judge@gpu.utcs.utoronto.ca (Peter Judge) (06/15/90)

Many thanks to Stuart Crawford (stuart@ads.com) and Mark Adler
(madler@tybalt.caltech.edu) for pointing me in the right direction.
I did indeed have an instance of TextEditor in the nib file. Removing it
and making my connections to 'File's Owner' did the trick.

Thanks,
Peter
---

-- 
===============================================
judge@credit.erin.utoronto.ca	(Peter Judge) |)
judge@gpu.utcs.utoronto.ca 
===============================================