Re: Issuing NSTextField action message
Re: Issuing NSTextField action message
- Subject: Re: Issuing NSTextField action message
- From: Kyle Sluder <email@hidden>
- Date: Wed, 20 Aug 2014 12:24:27 -0700
> On Aug 20, 2014, at 11:53 AM, Carl Hoefs <email@hidden> wrote:
>
>
>> On Aug 20, 2014, at 11:18 AM, Kyle Sluder <email@hidden> wrote:
>>
>>> On Wed, Aug 20, 2014, at 01:13 PM, Carl Hoefs wrote:
>>> I’m working on a financial system that accepts three variable user inputs
>>> to a formula. When the user types into any of the three textfields, it
>>> must update the other fields as the user types, without an Enter or
>>> Return. Think of it like a currency exchange program or temperature
>>> conversion, etc. so the user can immediately see the changes based on
>>> each stroke of the input (sort of like how Spotlight takes as much as
>>> you’ve typed in).
>>>
>>> So what I’ve managed to program so far is a KVO setup between three
>>> textfields, and when the user enters a number into any one of them — and
>>> presses Return — the others textfields update to reflect the new input.
>>> I’m trying to do this same thing but without the need for the Return.
>>
>> NSTextField is not (documented to be) KVO-compliant. Don't try observing
>> it.
>>
>> Instead, turn on the isContinuous property of your text fields (the
>> "Continuous" checkbox under the State group on the Properties
>> inspector). That'll send the text field's action on each key press.
>
> For the textfield ‘state’ I do have Continuous checked, but I don’t get an action sent. Does that setting somehow override the ‘Action’ setting (Sent On End Editing)?
Well, I certainly *thought* it did…
You might need to sign up as the text fields’ delegate and implement -controlTextDidChange:. (Or listen for NSControlTextDidChangeNotification.)
--Kyle Sluder
_______________________________________________
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