How long a delay did you give performSelector? This is working for me now on 10.8 (and a new MBP) without needing performSelector, but on 10.7 with an old MBP, I had to use a delay of animationResizeTime + 0.5 seconds. I haven't yet tested other combinations of MBP age and OS version.
On 2012-08-06, at 1:25 AM, Graham Cox <graham....@bigpond.com> wrote: > 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/dave.fernandes%40utoronto.ca > > This email sent to dave.fernan...@utoronto.ca _______________________________________________ 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