Re: Calling commitEditing text field loses focus
Jim Correia <[email protected]> Wed, 21 Dec 2011 08:32:52 -0800
| Newsgroups | gmane.comp.macosx.devel |
|---|---|
| Message-ID | <[email protected]> |
On Dec 21, 2011, at 8:28 AM, Christiaan Hofman wrote: > This makes no sense to me. An NSController does not even have *any* = properties, let alone a window. It's not an interface element. And = NSObjectController only knows (publicly) about things it binds to (its = content or selection), but what is needed is the objects that bind *to* = it. There's no API for that. So I really fail to see how you could have = done this without using SPI. You=92ve got two options here: You know where you use the controller, so you can associate one or more = windows with your controller. (It doesn=92t have any built-in properties = to track this association=97you=92ll have to add this.) Or, you can just snapshot the first responder and state for every = window, commit editing, and restore it in those windows where it has = changed. For my purposes, the latter performed perfectly acceptably (having = hundreds of windows open isn=92t a typical use case), so that was the = solution that I wrote. Jim=