Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

tab key behavior in edit fields



On Mac OS X 10.1.3 pressing Tab in our windows when an edit field is the focus actually inputs the character into the edit field. I'm trying to find out if this occurs on more than one 10.1.3 machine.

On Mac OS X 10.1.2 the same exact app works correctly (the tab key advances the focus to the next edit field).

I haven't debugged this yet, but thought I'd ask if anyone else is seeing this. One of thing of note is that we have an edit text control filter to enforce max lengths on the edit fields. It looks like this in case it appears I'm doing something wrong...

static pascal ControlKeyFilterResult EditControlMaxLengthKeyFilter(ControlRef control, SInt16 *keyCode, SInt16 *charCode, EventModifiers *modifiers)
{
#pragma unused (keyCode)
ControlKeyFilterResult result = kControlKeyFilterPassKey;
SInt32 maxLength;
OSStatus error;


error = GetEditTextControlMaxLength(control, &maxLength);

if ((error == noErr) && (maxLength > 0))
{
TEHandle teH;

GetEditTextControlTEHandle(control, &teH);

if (teH != NULL)
{
if ((*modifiers & cmdKey) != cmdKey) // let command key events pass
if ((TEGetLength(teH) + TEGetSelectionStart(teH) - TEGetSelectionEnd(teH) + 1) > maxLength)
switch (*charCode)
{
case kBackspaceCharCode:
case kTabCharCode:
case kLeftArrowCharCode:
case kRightArrowCharCode:
case kUpArrowCharCode:
case kDownArrowCharCode:
// let these pass
break;

default:
result = kControlKeyFilterBlockKey;
break;
}
}

}

return result;
}

Arrow keys work correctly.

(the max length is stored as a control property)

Anyone else having problems with edit text control key filters on 10.1.3?

Bryan
_______________________________________________
carbon-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/carbon-development
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.