Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Return and Enter don't "behave" in Text Field (Newb)



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Return and Enter don't "behave" in Text Field (Newb) (From: John Velman <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.