• 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: NSTabView and edit fields
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTabView and edit fields


  • Subject: Re: NSTabView and edit fields
  • From: John Stiles <email@hidden>
  • Date: Tue, 01 Aug 2006 08:30:40 -0700



Matt Neuburg wrote:
On Mon, 31 Jul 2006 13:54:48 -0700, John Stiles <email@hidden> said:
I'd really appreciate it if someone would download my demo and see if
they notice anything obviously wrong with it. The code is dead simple:

- (IBAction)goToFirstTab:(id)sender
{
[myTabView selectTabViewItemAtIndex:0];
}

- (IBAction)goToSecondTab:(id)sender
{
[myTextField setStringValue:@""];
[myWindow makeFirstResponder:myWindow];
[myTabView selectTabViewItemAtIndex:1];
}

(1) myWindow outlet was not hooked up, so second line was pointless.

Ah. That's what happens when you make a sample app in a hurry :)
(2) the problem you're describing (the field has apparent focus but typing
does nothing) is easily solved by using delayed performance:

- (void) doIt: (id) dummy {
    [myTabView selectTabViewItemAtIndex:1];
}

- (IBAction)goToSecondTab:(id)sender {
    [myTextField setStringValue:@""];
    [self performSelector:@selector(doIt:) withObject:nil afterDelay:0.1];
}

I experimented with this---it worked on my machine but then I tried it on a coworker's machine and it failed (the bug reappeared just like before). So I don't know. He has full keyboard access enabled, and I don't, and the machines likely have other differences which I didn't notice as well. It certainly merits further experimentation.
(3) The real bug here is, it seems to me, that the text field is not
focussed at startup, since it is the only focusable thing in the window. The
behavior otherwise (after the fix above) is right - the text field has focus
when you return to the first tab view, because something must. m.
I don't think it's apparent that a control in the window /must/ have focus. The window itself, or the window frame container, can have the focus. That's perfectly legitimate AFAICS. And I certainly don't think the impetus is on the developer to force focus on a control in a window whenever you show a window or sheet---this certainly isn't a common Cocoa programming technique.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSTabView and edit fields
      • From: Ricky Sharp <email@hidden>
References: 
 >Re: NSTabView and edit fields (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: Frameworks + sharedFrameworksPath
  • Next by Date: Re: Copying large files with progress indicator
  • Previous by thread: Re: NSTabView and edit fields
  • Next by thread: Re: NSTabView and edit fields
  • Index(es):
    • Date
    • Thread