• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSObjectController HELP
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSObjectController HELP


  • Subject: Re: NSObjectController HELP
  • From: Vince Ackerman <email@hidden>
  • Date: Sat, 5 Jun 2004 21:29:52 -0700

I'm a total newbie and a candidate for the book, "An Idiots Guide to Bindings and NSObjectController" if anyone wants to write the first edition (please!). I'm Still looking for a little help if one of you guys can spare it! I think I'm about ready to give up on ever getting the NSObjectController to work. I've read everything I could find in the help files and tutorials on Contoller layer to no avail.

This is a modified repost of my problem:

I've created an instance of NSObjectController:

I control dragged a connection between my model object (TeleoObj) and the controller and connected the "content."

In the info window for my NSObjectController, under attributes, changed my model object name from NSMutableDictionary to "TeleoObj", (Is this what goes there?) .. the two check boxes are checked, and I have added keys matching my instance variables below.

Do I have to do anything else here?

The Nib file has an instance of my TeleoObj, an instance of the NSObjectController, the window instance, and the First Responder. I'm not sure what I'm supposed to connect between the various objects..... maybe this is my problem. Do I set the Files Owner Custom Class to what? My TeleoObj or something else? What needs to see what. I know the controller and my model object need to be connected. What about the Files Owner and first responder?

In My Model object :

@interface TeleoObj : NSObject
{
NSMutableString * netStatusUSBBox;
NSMutableString * addressEWBox;
BOOL limitNSSwitch;
float netAnInBox;
float netPosNSBox;
float netPosEWBox;
.... }

Next I went to the main window and each of my NSTextField's and chose Bindings. Selected "values": then set the Bind to: to my object controller, Controller Key: selection, and Model Key Path: to the associated key.

I want these to update continuously, and only a few of the text fields in my window are editable by the user. Those I want to update the instance variables when the user finishes editing. What else do I need to connect?

At first, I initialized each of the instance variables in my models' awakeFromNib method, but they wouldn't show up in the textfields. Change the initialization to the " -init " method fixed that. When I run the app, I now get the initial instance variables in each of the of the textfields, so I know I have that part wired right. The problem is that the textfields that are bound to the instance variables don't seem to see the changes in my instance variables (when they are changed as the app runs) and update themselves accordingly. Maybe I misread the docs, but I thought that KVO meant the bound object would be updated as the instance variable changed? Why would they see the initial values but not the changes as it executes?

What am I doing wrong?

Thanks in advance for your help

Vince
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: NSObjectController HELP
      • From: mmalcolm crawford <email@hidden>
References: 
 >Re: NSObjectController HELP (From: Vince Ackerman <email@hidden>)
 >Re: NSObjectController HELP (From: mmalcolm crawford <email@hidden>)

  • Prev by Date: Re: NSAttributedString and bindings
  • Next by Date: Re: NSObjectController HELP
  • Previous by thread: Re: NSObjectController HELP
  • Next by thread: Re: NSObjectController HELP
  • Index(es):
    • Date
    • Thread