Re: How to get a message when RETURN is pressed in a NSTextField
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