• 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: Binding an NSTextField to an NSString *
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Follow-Ups:
    • Re: Binding an NSTextField to an NSString *
      • From: Kevin Ballard <email@hidden>
  • Prev by Date: Re: NSData
  • Next by Date: Re: NSData
  • Previous by thread: Re: Binding an NSTextField to an NSString *
  • Next by thread: Re: Binding an NSTextField to an NSString *
  • Index(es):
    • Date
    • Thread