• 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 not setting model property
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Binding not setting model property


  • Subject: Re: Binding not setting model property
  • From: Quincey Morris <email@hidden>
  • Date: Sat, 18 Jan 2014 20:25:30 -0800

On Jan 18, 2014, at 19:45 , Roland King <email@hidden> wrote:

> So perhaps the question is .. what property do I need to set on the NSTextField to get it to go back the other way? I've tried [ textField setValue:.. ] but that just throws an exception that setValue: isn't implemented on NSTextField, which it isn't, so I went back to setStringValue: But setting stringValue: changes the on-screen string, but doesn't trigger the binding to send the string back the other way.

I think you need to setObjectValue, not setStringValue. “objectValue” is the underlying property that all controls have, from which “intValue”, “stringValue” etc are derived, so presumably the text field “value” binding is bound to “objectValue”.

Alternatively, don’t use ‘set<anything>’ on the text field at all, but let the Browse button action method update the *data model*, and then let the binding change the text field. This may seem weird, because the button action method would have to apply the reverse transformer itself, but it’s actually cleaner, because it doesn’t make the button behavior depend on the text field.

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Binding not setting model property
      • From: Roland King <email@hidden>
References: 
 >Binding not setting model property (From: Roland King <email@hidden>)
 >Re: Binding not setting model property (From: Dave Fernandes <email@hidden>)
 >Re: Binding not setting model property (From: Roland King <email@hidden>)

  • Prev by Date: Re: Binding not setting model property
  • Next by Date: Re: Binding not setting model property
  • Previous by thread: Re: Binding not setting model property
  • Next by thread: Re: Binding not setting model property
  • Index(es):
    • Date
    • Thread