Re: Detecting focus on control
Re: Detecting focus on control
- Subject: Re: Detecting focus on control
- From: Andy Lee <email@hidden>
- Date: Fri, 10 Aug 2012 22:30:52 -0400
If there's one specific control class that you want to detect focus for, you can subclass it and override becomeFirstResponder. If super returns true, do your thing.
If you want to apply this to a bunch of varied controls, you might want to use a subclass of NSWindow and override makeFirstResponder: (again, checking what super returns).
--Andy
On Aug 10, 2012, at 8:54 PM, Erik Stainsby <email@hidden> wrote:
> Is it the case that setting up a trackingArea over a given control is the easiest way to detect the arrival of focus on a given control?
>
> I'm thinking in terms of tab-advancing keyboard activity here, where the user advances onto a modestly complex screen region (a postal address displayed in NSBox holding a multiLineLabel). Upon arrival of focus I want to swap in a fielded edit interface.
>
> It seems like this sort of awareness ought to be trivial to glean, but I'm not seeing it in NSView nor NSControl where I would expect to find it documented. Advice on where I ought to look?
>
> TIA
> ~ Erik
> _______________________________________________
>
> 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
_______________________________________________
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