• 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: Kenny Leung <email@hidden>
  • Date: Mon, 23 Jun 2008 21:39:17 -0700

Hi Markus.

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:

http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CommunicatingWithObjects/chapter_6_section_5.html

-Kenny


On Jun 23, 2008, at 8:38 PM, Markus Spoettl wrote:

Hello List,

this is almost too embarrassing to ask but I can't for the life of me figure out how to get notified (on a NSWindowController class) when RETURN was pressed in a certain NSTextField sitting in on the window of that controller.

I get -insertNewLine: when return is pressed on anything but the text field. For the text field it's not invoked, so there must be another message. Which? keyDown or keyUp is not called.

I'm using Xcode 3.0 on OS X 10.5.3

Thanks for your help!

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

_______________________________________________

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

  • Prev by Date: How to get a message when RETURN is pressed in a NSTextField
  • Next by Date: Re: How to get a message when RETURN is pressed in a NSTextField
  • Previous by thread: 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