• 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: NSTableView - Responder - 'Focus'
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >NSTableView - Responder - 'Focus' (From: Ruediger Merz <email@hidden>)

  • Prev by Date: Re: NSTableView - Responder - 'Focus'
  • Next by Date: Re: smaller icon
  • Previous by thread: Re: NSTableView - Responder - 'Focus'
  • Next by thread: Re: smaller icon
  • Index(es):
    • Date
    • Thread