title: Proper way to hook up a NSTextField
body: <p>I am trying to create a simple Mac OS X application which displays text output, which is logging for my program. Here is what I did:</p>
  
  <p>1) Created a Mac OS X UI project</p>
  
  <p>2) Added a "Text Field" component into the middle of the Application window in MainMenu.xib</p>
  
  <p>3) Added a new class "MainWindow.m" with the following property:</p>
  
  <pre><code>@property (assign) IBOutlet NSTextField *mainWindowText;
  </code></pre>
  
  <p>4) Connected up a "Referencing Outlet" from the text field component to the property. I now see a gray dot to the left of the above line of code</p>
  
  <p>5) In my application, I create a new thread which creates an instance of MainWindow. Then I wait 5 seconds and try to access the mainWindowText variable above but it is always null. I was expecting a non-null variable so I could call setStringValue: and modify the text at any time.</p>
  
  <p>I tried doing something similar with doText: and I am able to see the callback when I hit enter, and write text there. However I need a way to modify the text at an arbitrary time and I thought the above property was the proper way. </p>
  
  <p>I have also tried adding a @synthesize statement, but that had no effect.</p>
  
  <p>Any suggestions?</p>
  
  <p>Update: After reading some posts I think the problem is that I am working with the wrong mainWindow object. I tried creating a NSObject in the NIB and making its custom class type mainWindow, and created a IBOutlet (type MainWindow *) in one of my other classes, but it would not let me wire these two things up, so I am not sure how to access this NSObject object I added to the NIB.</p>