I want to display some informative text (in another part of the window)
whenever a row in a TableView is selected. It appears that what I need
to do is register a method to handle a notification, etc. Unfortunately,
the exact details escape me.
This is the description of the registration routine:
addObserver:selector:name:object:
- (void)addObserver:(id)anObserver
selector:(SEL)aSelector
name:(NSString *)notificationName
object:(id)anObject
Registers anObserver to receive notifications with the name
notificationName and/or containing anObject. When a notification
of name notificationName containing the object anObject is posted,
anObserver receives an aSelector message with this notification as
the argument. The method for the selector specified in aSelector must
have one and only one argument. If notificationName is nil, the
notification center notifies the observer of all notifications with
an object matching anObject. If anObject is nil, the notification
center notifies the observer of all notifications with the name
notificationName.
The notification center does not retain anObserver or anObject.
Therefore, you should always send removeObserver: or
removeObserver:name:object: to the notification center before
releasing these objects.
Here is a test method I hacked up:
sub NSTableViewSelectionDidChangeNotification
{
my ($self) = @_;
NSLog("NSTableViewSelectionDidChangeNotification");
return $self;
}
My suspicion is that I need to put something like the following in
MyWindowController.pm's "new" method:
my $dnc = NSNotificationCenter->defaultCenter();
$dnc->addObserver_selector_name_object(
NSTableViewSelectionDidChangeNotification,
'Access row selected', '');
but that doesn't do anything. Help?
-r
--
email: [EMAIL PROTECTED]; phone: +1 650-873-7841
http://www.cfcl.com/rdm - my home page, resume, etc.
http://www.cfcl.com/Meta - The FreeBSD Browser, Meta Project, etc.
http://www.ptf.com/dossier - Prime Time Freeware's DOSSIER series
http://www.ptf.com/tdc - Prime Time Freeware's Darwin Collection