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

Re: controlTextDidEndEditing vs controlTextDidChange


  • Subject: Re: controlTextDidEndEditing vs controlTextDidChange
  • From: Brian Webster <email@hidden>
  • Date: Mon, 3 Jun 2002 09:51:39 -0500

On Monday, June 3, 2002, at 06:28 AM, cocoa-dev-
email@hidden wrote:

For example, if I attach a delegate to a field, and watch the Text Did change
notification, I get called everytime any part of string changes. This sounds
fine, but what if I want to post an Undo event for every text change. I do
not want 10 events to undo when someone types in a 10 char string. I want
just one event, when string is completed. So I can watch
controlTextDidEndEditing. But that is only called when focus changes to
another field. It is not called for important actions like saving document,
or selecting menu item, ie. actions that really do indicate the user is done
typing some text.

For implementing undo, I would use the controlTextDidEndEditing. If you're concerned about changes being committed at other times such as before saving a document, you can just end the editing session yourself before such an operation. Do this by calling endEditing: on the text field's cell, passing in the window's field editor as the NSText argument. This should in turn trigger the delegate method, so you can put the next text into your document's data before going through with the save operation.

--
Brian Webster
email@hidden
http://homepage.mac.com/bwebster
_______________________________________________
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.

  • Prev by Date: Re: Switching between editable and not in a NSTableView
  • Next by Date: Re: Switching between editable and not in a NSTableView
  • Previous by thread: controlTextDidEndEditing vs controlTextDidChange
  • Next by thread: Releasing NSWindowController object
  • Index(es):
    • Date
    • Thread