• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: makeFirstResponder: and tab views
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: makeFirstResponder: and tab views


  • Subject: Re: makeFirstResponder: and tab views
  • From: Dave Fernandes <email@hidden>
  • Date: Tue, 07 Aug 2012 09:46:41 -0400

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 <email@hidden> 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 (email@hidden)
>
> 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:
>
> This email sent to email@hidden


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

References: 
 >makeFirstResponder: and tab views (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: Debugging -setNeedsDisplayInRect:
  • Next by Date: Re: +underPageBackgroundColor
  • Previous by thread: makeFirstResponder: and tab views
  • Next by thread: setting font
  • Index(es):
    • Date
    • Thread