views:

59

answers:

2

I am working on a second preferences style panel (but preferences related to a specific document.) My myDocument file is getting a little large so I decided to try using a separate subclass WindowController for the implementation.

I have subclassed NSWindowController. The nib file has myController as the owner. It implements both windowDidLoad and awakeFromNib. It has a TabView and each TabView has several TextFields, a ComboBox, 2 TextViews and a couple of buttons (Cancel and OK). The pointers to the Window, the TabViews, the Cancel and OK buttons are being established but the pointers to the comboBox, TextFields and TextViews are all nil.

The window is becoming visible with all of the TextFields, TextViews and Buttons. The TabView is working to switch views. I can edit all of the TextFields but I cant initialize them or get the info out of them when I dismiss the window.

I am using XCode 3.2 and Objective-C.

What am I missing?

Alan

+1  A: 

First, the obvious: Have you checked to make sure these outlets have not become disconnected in your xib? This is a ridiculously common problem, no matter how experienced you are with the tools. :-)

Second, what of the code in -windowDidLoad and -awakeFromNib? You might want to list everything in those two methods that 'touches' the problem outlets. Is it possible you might be assigning them to something else?

Joshua Nozzi
They appear to be connected properly in the nib file. I am not doing anything with them at the moment because they are nil.Alan
acondit
+1  A: 

I found the answer. It was a namespace issue. I had a setXXXTextField function where the TextField was named XXXTextField. So on attempting to initialize the pointer it called my set function which wasn't designed to set the pointer.

Thanks anyway for the help, it made me look deeper. Alan

acondit