FROM : Steve Nicholson
DATE : Fri Mar 28 19:41:28 2008
On Mar 28, 2008, at 11:30 AM, Christiaan Hofman wrote:
> On 28 Mar 2008, at 7:19 PM, Steve Nicholson wrote:
>> On Mar 28, 2008, at 10:44 AM, Christiaan Hofman wrote:
>>> There are 2 ways I know of.
>>>
>>> 1. Change the first responder of your window, to force edits to
>>> be committed.
>>
>> I put this in the beginning of the method that handles the button
>> click and it did the trick:
>>
>> if ([[self window] firstResponder] == [zoneText currentEditor])
>> {
>> [zoneText resignFirstResponder];
>> [zoneText becomeFirstResponder];
>> }
>>
>> Thanks, Christian. I really appreciate your help.
>>
>> -Steve
>
> Those are the wrong methods to call though. The docs on
> becomeFirstResponder and resignFirstResponder say:
>
> Use the NSWindow makeFirstResponder: method, not this method, to
> make an object the first responder. Never invoke this method directly.
>
> Christiaan
>
I think I can justify calling them directly since, technically, I'm
not changing the first responder. I'm simply jostling it. :-) I don't
want to change the first responder since the user didn't initiate the
change. My feeling is that we aren't supposed to invoke those methods
directly since doing it incorrectly might create zero or two first
responders. I'm going to go ahead and risk it. Anyway, this is an in-
house app which is pretty much only being used by me and one other
guy so if something weird happens It'll only affect us.
DATE : Fri Mar 28 19:41:28 2008
On Mar 28, 2008, at 11:30 AM, Christiaan Hofman wrote:
> On 28 Mar 2008, at 7:19 PM, Steve Nicholson wrote:
>> On Mar 28, 2008, at 10:44 AM, Christiaan Hofman wrote:
>>> There are 2 ways I know of.
>>>
>>> 1. Change the first responder of your window, to force edits to
>>> be committed.
>>
>> I put this in the beginning of the method that handles the button
>> click and it did the trick:
>>
>> if ([[self window] firstResponder] == [zoneText currentEditor])
>> {
>> [zoneText resignFirstResponder];
>> [zoneText becomeFirstResponder];
>> }
>>
>> Thanks, Christian. I really appreciate your help.
>>
>> -Steve
>
> Those are the wrong methods to call though. The docs on
> becomeFirstResponder and resignFirstResponder say:
>
> Use the NSWindow makeFirstResponder: method, not this method, to
> make an object the first responder. Never invoke this method directly.
>
> Christiaan
>
I think I can justify calling them directly since, technically, I'm
not changing the first responder. I'm simply jostling it. :-) I don't
want to change the first responder since the user didn't initiate the
change. My feeling is that we aren't supposed to invoke those methods
directly since doing it incorrectly might create zero or two first
responders. I'm going to go ahead and risk it. Anyway, this is an in-
house app which is pretty much only being used by me and one other
guy so if something weird happens It'll only affect us.
| Related mails | Author | Date |
|---|---|---|
| Steve Nicholson | Mar 28, 17:45 | |
| Christiaan Hofman | Mar 28, 18:44 | |
| Steve Nicholson | Mar 28, 19:19 | |
| Christiaan Hofman | Mar 28, 19:30 | |
| Steve Nicholson | Mar 28, 19:41 | |
| Christiaan Hofman | Mar 28, 23:04 |






Cocoa mail archive

