• 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: "Gary L. Wade" <email@hidden>
  • Date: Sat, 27 Apr 2019 11:36:54 -0700

From what you’ve described and shown, your expectations for discardEditing are
not correct.  The method discardEditing is a method you implement, typically on
your view controller that owns/manages your text field.  There’s not really any
good sample source using discardEditing I could find to point you to, but this
one seems to give as best as can be.

https://sourceforge.net/p/skim-app/mailman/message/22781851/
<https://sourceforge.net/p/skim-app/mailman/message/22781851/>

It sounds like you want to fill the field with the previous value that was in
there, and while you could do it in a text field subclass, you’re probably
better off managing that from its controller.  By the time your sheet shows up,
your text field is no longer performing any editing since it’s no longer the
first responder.
--
Gary L. Wade
http://www.garywade.com/ <http://www.garywade.com/>

> On Apr 27, 2019, at 10:26 AM, Richard Charles <email@hidden> wrote:
>
>> On Apr 9, 2019, at 9:40 AM, Sean McBride <email@hidden> wrote:
>>
>> NSTextField in fact does *not* support commitEditing/discardEditing, as per
>> this a decade ago:
>>
>> <https://lists.apple.com/archives/cocoa-dev/2008/Aug/msg00529.html>
>>
>> I don't think I ever did find another solution to my problem other than to
>> use an NSObjectController.
>
>
> My testing shows you are correct. Contrary to the documentation NSTextField
> does not support the NSEditor protocol. No App Kit user interface elements
> that I can find support this protocol. It is only supported by NSController
> and NSViewController.
>
> --Richard Charles

_______________________________________________

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 "Discard Change" (From: Richard Charles <email@hidden>)
 >Re: NSTextField "Discard Change" (From: Quincey Morris <email@hidden>)
 >Re: NSTextField "Discard Change" (From: Sean McBride <email@hidden>)
 >Re: NSTextField "Discard Change" (From: Richard Charles <email@hidden>)

  • Prev by Date: Re: NSTextField "Discard Change"
  • Next by Date: Re: NSTextField "Discard Change"
  • Previous by thread: Re: NSTextField "Discard Change"
  • Next by thread: Re: NSTextField "Discard Change"
  • Index(es):
    • Date
    • Thread