Re: Knowing how a Text Editing Session ended
Re: Knowing how a Text Editing Session ended
- Subject: Re: Knowing how a Text Editing Session ended
- From: Keary Suska <email@hidden>
- Date: Thu, 22 Jul 2010 08:45:54 -0600
On Jul 22, 2010, at 2:47 AM, Motti Shneor wrote:
> Thanks Mike --- Following your recommendation and the docs, I managed to extract the value of the @"NSTextMovement" key from the notification userInfo Dictionary, which contains just what I needed.
>
> However, I found that my problem is a bit deeper --- I want to finish the text editing session in 2 extra "nonstandard" ways (option-Tab, and option-shift-Tab) which in our specific context mean "Tab to the field below this field" and "Tab to the field above this field". the up and down equivalents to the Tab and BackTab.
>
> Unfortunately, the FieldEditor does not end the editing session in reacion to these key-presses, and inserts the characters into the text instead.
>
> My Question: How can I Persuade the FieldEditor to end an Editing Session when these specific key-combinations occur? Should I override something? Is there a specific Delegate for that?
>
> I thought that there should be something like:
>
> - (BOOL)control:(NSControl *)control textShouldEndEditing:(NSText *)fieldEditor
>
> Where my delegate could decide if the current input (last key pressed) should cause the FieldEditor to resign editing on this field, or not.
> But this delegate is only called when Tab, BackTab, Esc or Enter/Return are pressed ---- so I don't have the chance to decide.
>
> Any ideas?
>
> How can I configure the FieldEditor? Any sample code known to anyone?
I would start with Googling around for modifying tab press behavior in an NSTextView, and/or how to override tab press behavior for an NSTextField. I believe Apple shows how to do the former in one of the standard docs. Somewhere you should find clues on how to capture arbitrary keystrokes, and then what to do with them. Also see all of the text system docs.
HTH,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
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