Reverse update value binding when control editing stops, not only when the action fires. This causes tabbing out of a text field to update the binding source. Based on the description of the bindings option NSContinuouslyUpdatesValueBindingOption this is the right thing to do: if NSContinuouslyUpdatesValueBindingOption is on, update on every character; "otherwise the update is made only when the user interface item resigns as the responder."

This commit is contained in:
Alexander Ljungberg committed 2010-05-26 19:51:51 -04:00
1 parent be13a14330
commit ef9d2d1775
1 file changed
+5
+5
View File
@@ -520,6 +520,11 @@ var CPControlBlackColor = [CPColor blackColor];
if([note object] != self)
return;
var theBinding = [CPKeyValueBinding getBinding:CPValueBinding forObject:self];
if (theBinding)
[theBinding reverseSetValueFor:@"objectValue"];
[[CPNotificationCenter defaultCenter] postNotificationName:CPControlTextDidEndEditingNotification object:self userInfo:[CPDictionary dictionaryWithObject:[note object] forKey:"CPFieldEditor"]];
}