views:

18

answers:

1

I have an NSTextField in a Preferences panel. It provides a field to enter a url in. However, if the user closes the Preferences panel after editing the text in the field, the new value does not get propagated to the User Defaults. This only happens after the user explicitly does Enter or Tab.
This kind of makes the whole approach useless, it seems to me, so I guess I must be doing something wrong?

+1  A: 

I fix this by setting the firstResponder to nil when the window closes.

[[self window] makeFirstResponder:nil];
Nathan Kinsinger