Re: NSTableView - Responder - 'Focus'
Re: NSTableView - Responder - 'Focus'
- Subject: Re: NSTableView - Responder - 'Focus'
- From: Allan Odgaard <email@hidden>
- Date: Fri, 27 Feb 2004 22:00:09 +0100
On 27. Feb 2004, at 21:40, Ruediger Merz wrote:
How am I able to know which TableView is selected ?
NSWindow implements:
- (NSResponder *)firstResponder
Which return the view which is first responder, i.e. the one with
focus. So compare the result to the table views.
A perhaps better solution is to implement "addToActiveTableView:" (as a
category) for the table view and let it be something like:
- (void)addToActiveTableView:(id)sender
{
[NSApp sendAction:@selector(addToTableView:) to:nil from:self];
}
Implement addToTableView: in your controller (which should be in the
responder chain) and connect the 'add' button to first responder and
choose addToActiveTableView: as action (you'll have to add this action
to first responder first).
Using this scheme, you'll have the system traverse the list of views,
and finding the first table view in the responder chain, which will
rebroadcast the action message, but with itself as sender (so the
controller knows which table view from the sender argument).
The advantage is that there could be situations e.g. where the scroll
view enclosing the table view was actually first responder or
similar...
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.