• 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: Determining which control has focus
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Determining which control has focus


  • Subject: Re: Determining which control has focus
  • From: Lee Ann Rucker <email@hidden>
  • Date: Thu, 25 Oct 2012 12:43:10 -0700

On Oct 25, 2012, at 11:59 AM, Erik Stainsby wrote:

> Hi list,
>
> It seems to me this ought to be a trivial function of the OS, but I can't find anything that tells me how to go about this.
>
> I have a window which contains half a dozen text fields and three table views. I'd like to be able to use a single key-combo to trigger an insert into the current table. To make this work I need to be able to recognize each tableView distinctly, obviously. I also need to recognize if the current focus is not within one of the tables, which case I will handle differently.
>
> I have thought of overriding - keyDown: but reading though the docs it looks like I would have to create a tag and reference a hand-built index associating the tags with the input controls, which seems insanely error prone and tedious.
>
> Is there something in the docs which I've missed? Any pointers please?

Subclass NSTableView and implement keyDown: there. What I tend to do is add my own delegate method, something like

if (... check for keys the table view should handle, like delete...)
   [self interpretKeyEvents:...]
else if ([[self delegate] respondsToSelector:@selector(tableView:keyDown:)])
  [[self delegate] tableView:self keyDown:theEvent];
_______________________________________________

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

References: 
 >Determining which control has focus (From: Erik Stainsby <email@hidden>)

  • Prev by Date: Determining which control has focus
  • Next by Date: Re: Determining which control has focus
  • Previous by thread: Determining which control has focus
  • Next by thread: Re: Determining which control has focus
  • Index(es):
    • Date
    • Thread