Re: What is the best way to get events fired on keypress for an NSTextField?
Re: What is the best way to get events fired on keypress for an NSTextField?
- Subject: Re: What is the best way to get events fired on keypress for an NSTextField?
- From: Mike Abdullah <email@hidden>
- Date: Thu, 12 Mar 2015 18:15:32 +0100
> On 12 Mar 2015, at 17:46, Steve Mills <email@hidden> wrote:
>
> On Mar 12, 2015, at 11:04:55, Patrick J. Collins <email@hidden> wrote:
>>
>> I hooked up an action from IB to my view controller, but I don't see an
>> option for where to define what kind of action it is... So my problem
>> is events are only being fired when a textfield stops being edited. I
>> would like it to fire anytime a key is pressed, What is the best way to
>> do this currently?
>
> I'm not aware of a way to do that. Have you tried subclassing NSTextfield and overriding keyDown, and calling the action handler from there?
Please don’t do that. NSTextField already provides such messaging to its delegate:
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSTextField_Class/index.html#//apple_ref/occ/instm/NSTextField/textDidChange:
_______________________________________________
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