Re: Question about NSResponder cancelOperation
Re: Question about NSResponder cancelOperation
- Subject: Re: Question about NSResponder cancelOperation
- From: Iain Delaney <email@hidden>
- Date: Sat, 24 Feb 2007 15:41:57 -0500
I still don't know why the sender is nil, but I have solved the problem.
In the cancelOperation method I can get the firstResponder, which is
the field editor for the window.
The delegate for the field editor is the current text field, so I can
test against that to see which text field accepted the Esc key.
The code is simply:
NSTextField *currentField = [(NSTextView *)[[self window]
firstResponder] delegate];
if ([currentField isEqualTo:textField1] == YES) {
...
Iain Delaney
email@hidden
Message: 9
Date: Sat, 24 Feb 2007 03:46:16 -0500
From: Iain Delaney <email@hidden>
Subject: Re: Question about NSResponder cancelOperation
To: email@hidden
Cc: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
I don't think that is necessary. My controller is a subclass of
NSWindowController, which inherits from NSResponder.
If I handled it in the NSTextField, I'd still have to get the message
back up to the window controller, so that it could deal with the
situation.
And I still don't set why the sender of the cancelOperation method is
nil, but the method definitely gets called.
Iain Delaney
email@hidden
On 24-Feb-07, at 1:01 AM, email@hidden wrote:
Shouldn't the cancelOperation be implemented in a subclass of
NSTextField, then passed to super after your custom action?
On Feb 23, 2007, at 8:43 PM, Iain Delaney wrote:
My controller class implements cancelOperation,
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden