Run into a bug where if I have a number of NSTextFields in a window, and 
programatically switch the first responder of the window among these fields, it 
works fine, but if there is a NSTabView interposed between the fields and the 
window, they just cannot be set to be first responder programatically at all - 
it goes through the motions but it fails silently.

The text field has a blue focus ring, but there is no blinking cursor and 
typing results in a beep. The exact same code, without the tab view, works fine.

The field editor delegate causes the text field focus to shift every 4 
characters:

- (void)                controlTextDidChange:(NSNotification *)obj
{
        NSTextField* control = [obj object];
        
        NSString* text = [control stringValue];
        
        if([text length] >= 4 )
        {
                NSString* shortStr = [[text substringToIndex:4] 
uppercaseString];
                [control setStringValue:shortStr];
                
                NSResponder* nextField = [control nextKeyView];
                
                NSLog(@"got 4 characters: '%@', moving to field: %@", shortStr, 
nextField );
                
                if([nextField acceptsFirstResponder])
                        [[self window] makeFirstResponder:nextField];
                
        }
        
        [self conditionallyEnableOK];
}

The 'self' here is the window controller and field editor's delegate.

I also tested to see whether the window returned YES or NO from 
makeFirstResponder: and it always returns YES, indicating success.

Has anyone else run into this? I've seen a few postings in the archives on 
apparently similar topics, and one suggestion is to delay the 
makeFirstResponder using -performSelector:... I have tried that but it doesn't 
work either. Some of these postings go back to 2004 - it's hard to believe such 
a painfully obvious bug would still be unfixed in 10.8

--Graham



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to