RE: Return and Enter keys in NSTextView
RE: Return and Enter keys in NSTextView
- Subject: RE: Return and Enter keys in NSTextView
- From: Christian Mike <email@hidden>
- Date: Thu, 30 Aug 2001 07:59:15 -0500
From my experience, if you try to catch these keys at a low level, you have
to be careful. The Return key comes in as a 0x0D, but the keypad Enter key
comes in as a 0x03. You then have to check the modifier flags for the
NSNumericPadKeyMask bit.
uiModifierFlags = [theEvent modifierFlags];
eventCharacters = [theEvent characters];
iLength = [eventCharacters length];
for(iIndex=0; iIndex<iLength; ++iIndex)
{
unicodeChar = [eventCharacters characterAtIndex:iIndex];
if(unicodeChar == 0x0D ||
(unicodeChar == 0x03 && (uiModifierFlags &
NSNumericPadKeyMask) == 0))
{
... process key...
Michael Christian
Thomson multimedia Inc.