Skip navigation.
 
mlRe: OK on Enter, not Return
FROM : Andrew Merenbach
DATE : Fri Jun 06 20:19:11 2008

Quoting James Walker <<email_removed>>:

> I have a dialog containing an NSTextField and an OK button.  I'd like
> the Enter key to act as an equivalent for the OK button, but the Return
> key to add a line break to the text.  What's the best way to do that?


I believe that you might do some magic with -keyDown: -- I'm sure that 
someone else will have more knowledge about this -- but bear in mind 
that the latest-gen MacBooks (of which I have one) do not have 
separate Return and Enter keys -- just one.  (Maybe the fn button 
changes it, but even if so, users would have to figure that out.) 
What about making alt-Enter/alt-Return add a newline, while leaving 
Return and Enter both to do the job of activating the OK button? Hope 
this helps, even if only a little!

Cheers,
Andrew

Related mailsAuthorDate
mlOK on Enter, not Return James Walker Jun 6, 19:54
mlRe: OK on Enter, not Return Andrew Merenbach Jun 6, 20:19
mlRe: OK on Enter, not Return Douglas Davidson Jun 6, 21:26
mlRe: OK on Enter, not Return Ken Thomases Jun 6, 21:27
mlRe: OK on Enter, not Return Andrew Merenbach Jun 6, 21:29
mlRe: OK on Enter, not Return Clark Cox Jun 6, 21:40
mlRe: OK on Enter, not Return Andrew Merenbach Jun 6, 21:47
mlRe: OK on Enter, not Return James Walker Jun 6, 21:56
mlRe: OK on Enter, not Return Jim Correia Jun 7, 03:14