• 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: monitoring table selection
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: monitoring table selection


  • Subject: Re: monitoring table selection
  • From: Sherm Pendley <email@hidden>
  • Date: Sun, 4 May 2003 21:45:50 -0400

On Sunday, May 4, 2003, at 05:16 PM, Niko Matsakis wrote:

How can I be notified when particular row in a table is selected? I'm
using Cocoa-Java, though I expect it makes no difference. I tried calling
setAction(), but the method I provided to it never gets called. I don't
really understand setAction()'s workings anyhow.

To route action methods at run-time, you need to call both setAction() and setTarget() - the control needs to know not only what action to send, but what object to send it to. Of course, you can do the same thing at design-time in Interface Builder.

Another way to do it is to implement tableViewSelectionDidChange: in the table view's delegate, or listen for the NSTableViewSelectionDidChangeNotification.

All of these - action, delegate message, and notification - are triggered regardless of what row was clicked, so if you're only interested in a particular row, you need to check that yourself. You can find out what row was clicked with clickedRow().

sherm--


The highest sounds are hardest to hear.
Going forward is a way to retreat.
Great talent shows itself late in life.
Even a perfect program still has bugs.

-- The Tao of Programming
_______________________________________________
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.

  • Follow-Ups:
    • Re: monitoring table selection
      • From: Niko Matsakis <email@hidden>
References: 
 >monitoring table selection (From: Niko Matsakis <email@hidden>)

  • Prev by Date: I think I get most of the memory stuff but...
  • Next by Date: Re: I think I get most of the memory stuff but...
  • Previous by thread: Re: monitoring table selection
  • Next by thread: Re: monitoring table selection
  • Index(es):
    • Date
    • Thread