• 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 "Discard Change"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextField "Discard Change"


  • Subject: Re: NSTextField "Discard Change"
  • From: Quincey Morris <email@hidden>
  • Date: Sun, 07 Apr 2019 10:03:45 -0700

On Apr 5, 2019, at 20:55 , Richard Charles <email@hidden> wrote:
>
> Sending the text field an abortEditing message does not work. How can changes
> to the text field be discarded?

Caveat: I don’t know the answer to what you’re asking, but I suspect you may be
asking the wrong question.

First of all, what does “does not work” mean?

Second, looking at the documentation here:

https://developer.apple.com/documentation/appkit/nscontrol
<https://developer.apple.com/documentation/appkit/nscontrol>

the “abortEditing” method is listed under “Managing the Field Editor”. I
suspect it’s actually used internally to manage the relationship between the
text field’s cell and the field editor, and not to manage the editing state of
the control as a while. This method is probably just the wrong hammer for this
nail.

Third, what I think you’re looking for is “discardEditing”, which is a part of
the NSEditor protocol, to which NSTextField conforms. However, I’m not entirely
sure about timing, whether it’s reasonable to invoke in response to
“attemptRecoveryFromError:…”. But maybe.

Note that the documentation for NSEditor shows its methods as deprecated:

https://developer.apple.com/documentation/appkit/view_management/nseditor
<https://developer.apple.com/documentation/appkit/view_management/nseditor>

I believe this is a documentation error. At some point, NSEditor was converted
from an informal protocol to a formal protocol (so it would translate into
Swift properly), and that causes this error in the documentation. If you look
at the actual header file (NSKeyValueBinding.h), you can see that the formal
NSEditor protocol has no deprecations:

> @protocol NSEditor <NSObject>
>
> - (void)discardEditing;    // …
> - (BOOL)commitEditing;    // …


as well as the deprecations of the information protocol methods:

> @interface NSObject (NSEditor)
> - (void)discardEditing NS_DEPRECATED_MAC(10_0, API_TO_BE_DEPRECATED, "This is
> now a method of the NSEditor protocol.");
> - (BOOL)commitEditing NS_DEPRECATED_MAC(10_0, API_TO_BE_DEPRECATED, "This is
> now a method of the NSEditor protocol.");







_______________________________________________

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

  • Follow-Ups:
    • Re: NSTextField "Discard Change"
      • From: Richard Charles <email@hidden>
    • Re: NSTextField "Discard Change"
      • From: Sean McBride <email@hidden>
    • Re: NSTextField "Discard Change"
      • From: Richard Charles <email@hidden>
References: 
 >NSTextField "Discard Change" (From: Richard Charles <email@hidden>)

  • Prev by Date: Re: Dynamically change NSCollectionView items based on view width
  • Next by Date: Re: Dynamically change NSCollectionView items based on view width
  • Previous by thread: NSTextField "Discard Change"
  • Next by thread: Re: NSTextField "Discard Change"
  • Index(es):
    • Date
    • Thread