• 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
Re: How to get a message when RETURN is pressed in a NSTextField
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get a message when RETURN is pressed in a NSTextField


  • Subject: Re: How to get a message when RETURN is pressed in a NSTextField
  • From: Markus Spoettl <email@hidden>
  • Date: Mon, 23 Jun 2008 23:41:04 -0700

Hi Kenny,

On Jun 23, 2008, at 9:39 PM, Kenny Leung wrote:
NSTextField is a single-line entry control, so it wants to end editing when you hit return. In order to be notified, you should wire up its target outlet to be your controller and wire up its action to be an action method in your controller. If you are not familiar with target-action, you should read about it in the dev docs:


Thanks for your suggestion. Unfortunately that doesn't work because I cannot differentiate between the multiple possibilities of what makes the action fire. The NSTextField action is sent not only for pressing enter but also when the control looses firstResponder status.

Sure, I could workaround this by checking if the text field is still firstResponder and then assume it was enter that caused the event.

However, I was hoping that there is a definitive way to actually know that RETURN has been pressed on the text field.

Regards
Markus
--
__________________________________________
Markus Spoettl

_______________________________________________

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: How to get a message when RETURN is pressed in a NSTextField
      • From: "Patrick Burleson" <email@hidden>
    • Re: How to get a message when RETURN is pressed in a NSTextField
      • From: Kenny Leung <email@hidden>
References: 
 >How to get a message when RETURN is pressed in a NSTextField (From: Markus Spoettl <email@hidden>)
 >Re: How to get a message when RETURN is pressed in a NSTextField (From: Kenny Leung <email@hidden>)

  • Prev by Date: Re: How to get a message when RETURN is pressed in a NSTextField
  • Next by Date: Re: Assert trigged in -[NSEvent eventNumber]
  • Previous by thread: Re: How to get a message when RETURN is pressed in a NSTextField
  • Next by thread: Re: How to get a message when RETURN is pressed in a NSTextField
  • Index(es):
    • Date
    • Thread