NSTextField, bindings and saving changes
NSTextField, bindings and saving changes
- Subject: NSTextField, bindings and saving changes
- From: Sanford Selznick <email@hidden>
- Date: Fri, 12 May 2006 15:56:34 -0700
I have an NSTextFiend in IB that is bound through shared user
defaults. If I type text into the field and quit, all changes are
saved just fine.
I have a button in the same window. When pushed, I programmatically
change the value in the NSTextField by getting an NSText object for
the field from the containing window. The change appears on screen
and everything seems fine. Unfortunately the new value created
through the NSText object is not saved through the binding when I
quit.
I've tried the following to no avail:
1. I'm calling commitEditing on the NSUserDefaultsController instance
created in the Nib.
2. I'm sure to pair endEditingFor with the fieldEditor as in:
NSText *t = [[self window] fieldEditor:YES forObject:myField];
[t replaceCharactersInRange:[t selectedRange] withString:replacement];
[[self window] endEditingFor:myField];
3. I've even tried calling [[self window] makeFirstResponder:nil]
which I found in a related posting. (Shot in the dark.)
4. I've tried logging the string data from the NSTextField and have
verified that the NSTextField has the new value in it.
None of this has synchronized the data from the field through the binding.
What am I missing?
Thank you,
Sanford
_______________________________________________
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