Re: Return key should enter return in textfield and not press default button
Re: Return key should enter return in textfield and not press default button
- Subject: Re: Return key should enter return in textfield and not press default button
- From: Jim Correia <email@hidden>
- Date: Mon, 18 Oct 2010 20:13:43 -0700
On Oct 11, 2010, at 2:21 AM, Thorsten Lemke wrote:
> I have a dialog in my app wich should let the user enter a carriage return.
>
> How can I avoid pressing the default button with return? Only enter should
> press it in this case.
As you probably know, implementing this will be hugely popular with people who understand how it works, and confusing to everyone else.
That said…
For your edit field implement
- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)commandSelector;
When the command selector is insertNewline:, act accordingly based on the current event.
—Jim
_______________________________________________
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