• 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: NSTextField controlTextDidEndEditing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: NSTextField controlTextDidEndEditing


  • Subject: RE: NSTextField controlTextDidEndEditing
  • From: Ulai Beekam <email@hidden>
  • Date: Sat, 6 Mar 2010 01:57:32 +0000
  • Importance: Normal

Sweet, thanks! I didn't even know of NSTextMovement, but doing a search for in Spotlight, I saw that it was indeed buried somewhere in the Event Handling Guide :)

So anyway, this is how I'm doing it now, and so far it seems to be working well:

- (void)controlTextDidEndEditing:(NSNotification *)aNotification
{
  NSTextField *textField = [aNotification object];
  NSView *nextKeyView = [textField nextKeyView];
  NSUInteger whyEnd = [[[aNotification userInfo] objectForKey:@"NSTextMovement"] unsignedIntValue];
    BOOL returnKeyPressed = (whyEnd == NSReturnTextMovement);
  BOOL tabOrBacktabToSelf = ((whyEnd == NSTabTextMovement || whyEnd == NSBacktabTextMovement) && (nextKeyView == nil || nextKeyView == textField));
    if (returnKeyPressed || tabOrBacktabToSelf)
    NSLog(@"focus stays");
  else
    NSLog(@"focus leaves");
}


> NSText handles this properly; when it posts an NSTextDidEndEditingNotification, that includes NSTextMovement as a key. I'm not sure if NSControlTextDidEndEditingNotification is kind enough to pass that on too, or if you'll have to listen out for the original notification from the field editor.

_________________________________________________________________
Hotmail: Free, trusted and rich email service.
https://signup.live.com/signup.aspx?id=60969_______________________________________________

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: 
 >NSTextField controlTextDidEndEditing (From: Ulai Beekam <email@hidden>)
 >Re: NSTextField controlTextDidEndEditing (From: Mike Abdullah <email@hidden>)

  • Prev by Date: Re: predicate for a Core Data fetch request rejected by SQL
  • Next by Date: Re: [NSTableview] can't make selected text stay black
  • Previous by thread: Re: NSTextField controlTextDidEndEditing
  • Next by thread: NSURLConnection Asynchronous vs. Synchronous Asymmetry
  • Index(es):
    • Date
    • Thread