I've read what you said but I don't know what to do still. Do I need to implement the method? the -observeValueForKeyPath > > :ofObject:change:context: method?
I am not having trouble with bindings. They seem to be working ok. What I need to know is what I need to add to get the text field to update whenever firstName is changed. I want it to set the value of its string value to the string. If not, why not just do it in the action method? Would I do it the KVO method so whenever I updated it, even outside of the message, it would get updated? Also where do I put the -observeValueForKeyPath > > :ofObject:change:context: method? > "but how does the text field know what this means?" how do I tell it? that's what I've been trying to ask all along.- Show quoted text - On Fri, Jun 27, 2008 at 11:21 PM, Owen Yamauchi < [EMAIL PROTECTED] <[EMAIL PROTECTED]>> wrote: > On Fri, Jun 27, 2008 at 10:20 PM, Alex Wait <[EMAIL PROTECTED]> wrote: > > But I was sure since I have a firstName method and a setFirstName method > it > > would update the textField. I have used IB to bind the value of the > > textField to the value of the person object and that works when I edit > the > > textfield (yay). So I know I have the proper methods. I think. > > If you've set the binding in IB, there's no need to write any code. > > The problem you're running into with this code is that you're > registering the text field as an observer of changes in the firstName > property, but the text field has no idea what it should do when it > receives notification of changes. Changing firstName generates a KVO > notification (two, actually) which causes a > -observeValueForKeyPath:ofObject:change:context: message to be sent to > the text field, but how does the text field know what this means? The > obvious thing (to you) is to change its text, but there's any number > of other things you can bind in a text field. > > If you want to set up the binding in code, use > -bind:toObject:withKeyPath:options:. > > Owen > [forgot to reply-all before] > _______________________________________________ > > 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/bobber205%40gmail.com > > This email sent to [EMAIL PROTECTED] > -- If you can't be kind, at least have the decency to be vague. _______________________________________________ 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]