Re: keyUp falling through to window when sheet dismissed
Re: keyUp falling through to window when sheet dismissed
- Subject: Re: keyUp falling through to window when sheet dismissed
- From: Ken Worley <email@hidden>
- Date: Tue, 21 Oct 2008 15:35:31 -0600
On Oct 21, 2008, at 3:20 PM, Ken Worley wrote:
On Oct 21, 2008, at 1:36 PM, Kyle Sluder wrote:
On Tue, Oct 21, 2008 at 1:43 PM, Ken Worley
<email@hidden> wrote:
It seems like the correct solution is to somehow avoid the keyUp
being sent
to the window/edit field after the sheet is dismissed, but I also
wonder if
I'm catching the right event in the edit field.
Have you read the Text Editing Progamming Guide for Cocoa? The
document specifically deals with handling the Return key:
http://developer.apple.com/documentation/Cocoa/Conceptual/TextEditing/Tasks/InterceptKeys.html
Basically, don't handle -keyUp: or -keyDown:. Use the
-control:textView:doCommandBySelector: delegate method.
--Kyle Sluder
I somehow managed to miss that or I read it long enough ago that I
forgot. Thanks much!
Ken
This, by the way, is a constant source of confusion for me in Cocoa.
Why is a delegate method specific to NSTextView listed under NSControl
which is the parent class? Not to mention the fact that NSControl
lists these delegate methods, but does not itself support a delegate.
Looking at control:textView:doCommandBySelector:, textView is listed
as an NSTextView* in the document mentioned above. NSTextView,
however, doesn't derive from NSControl so is this really for
NSTextView or is it for NSTextField which is mentioned at the top of
the doc, but doesn't appear anywhere within. I'm using an NSTextField.
Those are rhetorical questions, by the way. Things I think about every
time I'm frustrated because I've forgotten to search all the way up
the inheritance chain looking for something I don't think should be up
there :)
At least with this starting point thanks to Kyle, I should be able to
find the correct way to do this.
--
Ken Worley
Software Engineer, Tiberius, Inc.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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