Re: Who's got the focus?
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