Hi All,

I'm trying to get my feet wet with bindings and want to try something simpler than the mail example provided online.

All I'm trying to do is to replace the target-action-outlet approach with bindings in the simplest case I can think of: a text field whose value would correspond to an ivar in the controller. One text field would receive the number, a button would click, pass the number to the ivar, and redisplay that value in another text field.

First off, is it possible possible to bind directly to an instance variable in the controller? In my hyper-basic example, I'm collapsing M and C. I thought doing so should be OK, so I tried:

Bind to: Controller
Model Key Path: self.number (number is the ivar) (self presumably being the controller)

This didn't work.

Unfortunately, I am also confused about the intended receiver for addObserver: forKeyPath:. I thought it would be the ivar (number), but I get a warning that NSNumber may not respond to that method (and sure enough the docs show that it doesn't). Logically, the second text field should "observe" that the model/controller ivar (number) has changed. But I thought you were not supposed to use outlets either.

Does this mean you can only use bindings for arrays? Clearly that can't be right....

If anyone knows of a "hyper-simple" example dispensing with tables and arrays, I'd really appreciate the link....

Thanks.

Daniel
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to