Re: Calling commitEditing text field loses focus

Christiaan Hofman <[email protected]> Tue, 20 Dec 2011 22:41:47 +0100
Newsgroups gmane.comp.macosx.devel
Message-ID <[email protected]>
On Dec 20, 2011, at 21:50, Kyle Sluder wrote:

> On Tue, Dec 20, 2011 at 5:14 AM, Christiaan Hofman =
<[email protected]> wrote:
>> I have a text field whose value is bound through an =
NSObjectController. Before performing certain actions I call =
-commitEditing on that object controller to make sure I have the current =
value from the text field. What I notice is that if there are any =
uncommitted changes to the text, the text field loses focus due to this =
call. This is certainly not what I want, I just want to commit the edit. =
I also don't recall this to happen in the past, but I am not sure for =
how long this has been going on. Also, the focus is not lost when the =
text had not changed since the last commit. To me this sounds like a =
bug. Can anyone confirm this is a bug, or tell me why this would make =
sense? Or tell me whether there is some kind of setting to change this =
behavior?
>=20
> Try using -commitEditingAndReturnError: (new in 10.7) instead?
>=20
> --Kyle Sluder

Not relevant, I support 10.5. Moreover, why would or should returning an =
error change this behavior?

Christiaan