Re: Return and Enter don't "behave" in Text Field (Newb)
Re: Return and Enter don't "behave" in Text Field (Newb)
- Subject: Re: Return and Enter don't "behave" in Text Field (Newb)
- From: Aki Inoue <email@hidden>
- Date: Mon, 20 Oct 2008 12:29:00 -0700
John,
"End editing" doesn't necessarily mean losing focus in terms of
behavior visually users can see.
In this case, NSTextField does end editing, but calls -selectAll:
immediately afterwards to keep the focus.
Discussion Field editors interpret Tab, Shift-Tab, and Return
(Enter) as
cues to end editing and possibly to change the first responder.
Notice "possibly" in the sentence. Return (Enter) does not change the
first responder.
Aki
On 2008/10/20, at 11:49, John Velman wrote:
This must have a simple answer, but I can't find it.
I have several text fields in in a window. I've set the nextKeyView
as I
like it, and tabbing works. But pressing enter or return highlights
the
whole cell as selected, rather than ending editing of that cell as I
believe it should.
I used caveman debugging in the following way:
I made files owner the delegate for the text field in one of the
boxes. In
Files Owner, I put in the delegate
- (BOOL)control:(NSControl *)control
textView:(NSTextView *)aTextView
doCommandBySelector:(SEL)aSelector
Here I test for which selector (either return or enter gives
"insertNewline:"). I also test "aTextView" with "isFieldEditor",
which
returns 1 (YES);
Now the documentation says of isFieldEditor:
<quote>
Return Value YES if the text views sharing the receiver’s
layout manager
behave as field editors, NO otherwise.
Discussion Field editors interpret Tab, Shift-Tab, and Return
(Enter) as
cues to end editing and possibly to change the first responder. Non-
field
editors instead accept these characters as text input. See Text
Fields,
Text Views, and the Field Editor for more information on field
editors. By
default, text views don’t behave as field editors.
</quote>
So where can I look to find out why my field editor is not behaving
as a
field editor?
Thanks,
John Velman
_______________________________________________
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
_______________________________________________
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