Re: monitoring table selection
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.