• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Return and Enter don't "behave" in Text Field (Newb)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Subject: Return and Enter don't "behave" in Text Field (Newb)
  • From: John Velman <email@hidden>
  • Date: Mon, 20 Oct 2008 11:49:22 -0700

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

  • Follow-Ups:
    • Re: Return and Enter don't "behave" in Text Field (Newb)
      • From: Aki Inoue <email@hidden>
  • Prev by Date: How to draw a Recessed Button Shadow
  • Next by Date: Re: Return and Enter don't "behave" in Text Field (Newb)
  • Previous by thread: Re: How to draw a Recessed Button Shadow
  • Next by thread: Re: Return and Enter don't "behave" in Text Field (Newb)
  • Index(es):
    • Date
    • Thread