Re: NSTextField "Discard Change"

2019-05-06 Thread Richard Charles
I have a custom NSNumberFormatter which does validation. If I bind the text field using NSValueBinding then when validation fails an alert panel will automatically appear. However it is the binding machinery that brings up the alert panel. Apple integrates bindings with user interface elements u

Re: NSTextField "Discard Change"

2019-05-06 Thread Keary Suska
IIRC, you get this behavior automatically when validating with a formatter, so applying a custom NSNumberFormatter subclass might be more canonical and less kludgey. HTH, Keary Suska Esoteritech, Inc. "Demystifying technology for your home or business" > On May 6, 2019, at 5:33 AM, Richard Cha

Re: NSTextField "Discard Change"

2019-05-06 Thread Richard Charles
Thank you Quincey, Sean, Gary and Alex for your comments and suggestions. To recap I have a NSTextField subclass bound to an array controller using a derived value binding. The user selects one or more objects in a graphic view. Object properties are shown in an inspector containing the text fie

Re: NSTextField "Discard Change"

2019-04-29 Thread Alex Zavatone
It looks like time to subclass or extend and add the functionality you need. Sent from my iPhone On Apr 27, 2019, at 7:26 PM, Richard Charles wrote: >> On Apr 7, 2019, at 11:03 AM, Quincey Morris >> wrote: >> >>> On Apr 5, 2019, at 20:55 , Richard Charles wrote: >>> >>> Sending the text fi

Re: NSTextField "Discard Change"

2019-04-28 Thread Quincey Morris
On Apr 27, 2019, at 10:26 , Richard Charles wrote: > > Contrary to the documentation NSTextField does not support the NSEditor > protocol. Well, I apologize for not researching my answer better when I answered before. However, be careful of what you assume from the documentation. NSTextField m

Re: NSTextField "Discard Change"

2019-04-27 Thread Gary L. Wade
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 p

Re: NSTextField "Discard Change"

2019-04-27 Thread Richard Charles
> On Apr 9, 2019, at 9:40 AM, Sean McBride wrote: > > NSTextField in fact does *not* support commitEditing/discardEditing, as per > this a decade ago: > > > > I don't think I ever did find another solution to my problem other

Re: NSTextField "Discard Change"

2019-04-27 Thread Richard Charles
> On Apr 7, 2019, at 11:03 AM, Quincey Morris > wrote: > >> On Apr 5, 2019, at 20:55 , Richard Charles 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

Re: NSTextField "Discard Change"

2019-04-09 Thread Sean McBride
On Sun, 7 Apr 2019 10:03:45 -0700, Quincey Morris said: >Third, what I think you’re looking for is “discardEditing”, which is a >part of the NSEditor protocol, to which NSTextField conforms. A timely thread, as I'm investigating something quite similar, and was searching my email for 'commitEdit

Re: NSTextField "Discard Change"

2019-04-08 Thread Richard Charles
Quincey, thanks so much for your insight. Unfortunately I will be gone for the next several weeks. I thought I would be able to tackle this problem before I left but now I have run out of time. I will be able to look more carefully at your comments when I get back. Thanks again. --Richard Charl

Re: NSTextField "Discard Change"

2019-04-07 Thread Quincey Morris
On Apr 5, 2019, at 20:55 , Richard Charles 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 d

NSTextField "Discard Change"

2019-04-05 Thread Richard Charles
In a document window enter garbage into a text field and press return. An alert panel will be presented as a sheet attached to the window. In the alert panel the user can choose "Discard Change" or "OK". So far so good. In my case I have a text field subclass with a derived value custom binding