• 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: Detecting focus on control
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Detecting focus on control
      • From: Erik Stainsby <email@hidden>
References: 
 >Detecting focus on control (From: Erik Stainsby <email@hidden>)

  • Prev by Date: Re: Detecting focus on control
  • Next by Date: Re: 32-bit on 10.8
  • Previous by thread: Re: Detecting focus on control
  • Next by thread: Re: Detecting focus on control
  • Index(es):
    • Date
    • Thread