Re: TableView Event
Re: TableView Event
- Subject: Re: TableView Event
- From: Sherm Pendley <email@hidden>
- Date: Mon, 16 Apr 2007 18:57:03 -0400
On Apr 16, 2007, at 6:35 PM, hac wrote:
I have an NSTableView that I want to trigger an action when the
selected row
is changed. I have no idea how to do this as I've only used event
handling
where I can directly connect the objects in Interface Builder.
Thanks. :)
In general, you should make a habit of looking in the "Delegate
Methods by Task" and "Notifications" sections of the docs for the
class you're using. Both delegation and notification are core Cocoa
design patterns, so it pays to get used to them.
In this case, you have two options: You can implement -
tableViewSelectionDidChange: in your delegate. Or, you can register
to receive NSTableViewSelectionDidChangeNotification notifications
from your table view.
For more on delegation and notifications, have a look at:
<file:///Developer/ADC Reference Library/documentation/Cocoa/
Conceptual/CocoaFundamentals/CommunicatingWithObjects/
chapter_6_section_4.html>
<file:///Developer/ADC Reference Library/documentation/Cocoa/
Conceptual/Notifications/index.html>
Or online:
<http://developer.apple.com/documentation/Cocoa/Conceptual/
CocoaFundamentals/CommunicatingWithObjects/chapter_6_section_4.html>
<http://developer.apple.com/documentation/Cocoa/Conceptual/
Notifications/index.html>
sherm--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden