• 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: Bindings don't populate dialog fields?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bindings don't populate dialog fields?


  • Subject: Re: Bindings don't populate dialog fields?
  • From: Jeff LaMarche <email@hidden>
  • Date: Mon, 16 Jan 2006 22:15:43 -0500

On Jan 16, 2006, at 9:56 PM, Guy Umbright wrote:

I have a dialog that uses bindings (via NSObjectController) to edit an object. If I edit the fields, the new values
show up in the object (with a caveat I will mention later). The one thing it does not do is populate the dialog
fields with the values in the object when the dialog is displayed.

Dialog or sheet? In my experience, bindings work correctly in both directions, so if the thing they are bound to has a value, the value should show up in the fields when the sheet or dialog is shown. I address the one exception to that below.


I haven't used modal dialogs much under OS X, though, since sheets are what the HIG says to use in most situations, but I would assume they would have similar behavior.

Am I missing something or should those initial values from the object be displayed in the dialog?

You might need to give more specifics. From your description, it does sound like it should be working, but it's a little vague to really diagnose a problem.


Also, the text fields in the object only update if I leave the field after editing. Usually you don't leave
the field after editing and just hit the OK. Is there a standard way to force this final update?

For this situation, what you probably need to do is send the dialog or sheet a makeFirstResponder:nil message when the sheet or dialog is dismissed. I've found that while a field is the first responder, it will not take updates made programmatically to the entity or object it is bound to. I assume that this behavior is because the system assumes that the user is interacting with the first responder, and therefore gives preference to the value entered by the user over the one done programmatically... but that's just a guess. It does seem like a control on a sheet or dialog should yield first responder status after being dismissed, but like I said, I've found some instances where it doesn't - where a field on the sheet maintains first responder status for a short time after it is dismissed. If the KVO notification happens while the field still retains first responder status... the update doesn't happen.



_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Bindings don't populate dialog fields?
      • From: Guy Umbright <email@hidden>
References: 
 >Bindings don't populate dialog fields? (From: Guy Umbright <email@hidden>)

  • Prev by Date: Re: Recommendation for keeping track of money in Core Data
  • Next by Date: Re: Recommendation for keeping track of money in Core Data
  • Previous by thread: Bindings don't populate dialog fields?
  • Next by thread: Re: Bindings don't populate dialog fields?
  • Index(es):
    • Date
    • Thread