Binding <enter> key to different action in a textview?
Binding <enter> key to different action in a textview?
- Subject: Binding <enter> key to different action in a textview?
- From: Jerry LeVan <email@hidden>
- Date: Sat, 14 Feb 2004 12:56:00 -0500
Hi, I have a text window that contains some sql and I would like to
bind the enter key
to something other than insertNewLine: (in a simple way :). I want to
keep the return key
action unchanged.
My intent is grab any "selected" code and send it to the sql backend
when the enter key is hit.
One strategy that might work would be to implement
textView:doCommandBySelector and when
insertNewLine: is detected examine [NSApp currentEvent] and look at the
keycode.
It appears that the keycode (by experimentation) for return is 36 and
the keycode for enter is 76.
I am leary of hard coding the numbers but have nat been able to find
"symbolic" names for the key codes
that might track changes to the keycodes ( I am not even sure that the
keycodes are keyboard independent).
Is hard coding the keycode value the only way to do this task?
--jerry
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.