• 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: End Editing with RETURN
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: End Editing with RETURN


  • Subject: Re: End Editing with RETURN
  • From: Greg Titus <email@hidden>
  • Date: Thu, 5 Jun 2003 12:24:42 -0700

On Thursday, June 5, 2003, at 11:18 AM, Lorenzo wrote:

Hi,
I have some NSTextFields (of my subclass) in a Window.
I want that when the user presses RETURN, more than ending the editing, I
perform an action. I found the delegate methods very useful.

Anyway, the following

- (void)textDidEndEditing:(NSNotification *)aNotification
{
NSLog(@"textDidEndEditing");
}

has been executed any time the user presses TAB or RETURN.
How could I detect the user ended to edit the field pressing a RETURN?
Is this info nested inside the aNotification

Yep. It is in the "NSTextMovement" key in the notification userInfo dictionary. So your code should look something like:

- (void)textDidEndEditing:(NSNotification *)aNotification
{
if ([[[aNotification userInfo] objectForKey:@"NSTextMovement"] intValue] == NSReturnTextMovement) {
// pressed return
} else {
// used tab or backtab
}
}

Hope this helps,
- Greg
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: End Editing with RETURN
      • From: Bill Cheeseman <email@hidden>
References: 
 >End Editing with RETURN (From: Lorenzo <email@hidden>)

  • Prev by Date: Re: OT: Where's flockfile
  • Next by Date: Re: launching an app in cocoa
  • Previous by thread: End Editing with RETURN
  • Next by thread: Re: End Editing with RETURN
  • Index(es):
    • Date
    • Thread