Re: Binding an NSTextField to an NSString *
Re: Binding an NSTextField to an NSString *
- Subject: Re: Binding an NSTextField to an NSString *
- From: Hua Ying Ling <email@hidden>
- Date: Tue, 23 Mar 2004 13:36:56 -0500
You are probable making a simple mistake in the bindings pane. How
did u set up your bindingds for the text field and the object
controller?
I followed and completed the Currency Converter with Bindings tutorial
for the "Cocoa Binding" documentation:
<
http://developer.apple.com/documentation/Cocoa/Conceptual/
CocoaBindings/index.html>. After testing the application, I tried
going a step further by changing the one of variable types in the
Converter model class (connected to the "content" outlet for
NSObjectController)
from:
double exchangeRate;
to:
NSString *exchangeRate;
I tried added a string init to the Converter +(void)initialize method
exchangeRate = [[NSString alloc] init];
The object controller needs to be bound to the model object, and the
text field is bound to the object controller.
I think that's what I did. I connected the "content" outlet of the
NSObjectController to the Converter class(model Object). Then I made
the following binding to the NSTextField value:
Bind to: NSObjectController
Controller Key: selection
Model Key Path: exchangeRate
From my NSLogs I can say that the NSTextField neither accepts the model
value nor updates it.
Thanks
~Hua Ying
_______________________________________________
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.