• 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: Who's got the focus?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Who's got the focus?


  • Subject: Re: Who's got the focus?
  • From: Nicko van Someren <email@hidden>
  • Date: Mon, 6 Jun 2005 22:29:50 +0100

On 3 Jun 2005, at 21:11, James Bucanek wrote:
I have a window with two NSTableViews. I have menu items and commands need to know which table is currently selected/active. How does one find out which of the two tables has the current focus?

I'd do it like this:

NSWindow *myWindow;
NSTableView *table1, *table2;
NSView *v;

v = (NSView *) [myWindow firstResponder];
if ([v isKindOfClass: [NSView class]]) {
    if ([v isDescendantOf: table1]) {
        /* Do table one stuff */
    } else if ([v isDescendantOf: table2]) {
        /* Do table two stuff */
    }
}

Cheers,
    Nicko

----
Quantum materiae materietur marmota monax
si marmota monax materiam possit materiari?


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Who's got the focus? (From: James Bucanek <email@hidden>)

  • Prev by Date: SDK question
  • Next by Date: Re: [Moderator] EOT Re: NYT confirms rumor of Apple switch to Intel
  • Previous by thread: Re: Who's got the focus?
  • Next by thread: Need help with serialization using custom class objects
  • Index(es):
    • Date
    • Thread