Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Mar 25, 2008, 06:14 AM   #1
satyam90
macrumors regular
 
Join Date: Jul 2007
Location: Bangalore, India
Send a message via Yahoo to satyam90
Panel & Delegate methods of its controls

Hi, I am having a NSTableView inside a panel. I implemented "- (void)tableViewSelectionDidChangeNSNotification *)aNotification".
But I noticed that it is not called at all even though I am changing the table view's items. Can anyone tell me why this is happening? How to make the delegate called inside a Panel?
satyam90 is offline   0 Reply With Quote
Old Mar 25, 2008, 07:13 AM   #2
kainjow
Moderator emeritus
 
kainjow's Avatar
 
Join Date: Jun 2000
So your table view is inside an NSPanel, and the tableViewSelectionDidChange: notification is not being called? Are you sure your delegate is properly setup? You could also try subscribing to the NSTableViewSelectionDidChangeNotification notification manually (especially if you're using bindings).
kainjow is offline   0 Reply With Quote
Old Mar 26, 2008, 01:31 AM   #3
satyam90
Thread Starter
macrumors regular
 
Join Date: Jul 2007
Location: Bangalore, India
Send a message via Yahoo to satyam90
Hi Kainjow,
I didn't set the delegate. I implemented "- (void)tableViewSelectionDidChangeNSNotification *)aNotification" in the controller of the panel.
Can you please some reference how to handle this.
Also can u tell me how to subscribe to notification manually.
Thanks & Regards,
satyam90 is offline   0 Reply With Quote
Old Mar 26, 2008, 06:53 AM   #4
kainjow
Moderator emeritus
 
kainjow's Avatar
 
Join Date: Jun 2000
tableViewSelectionDidChange: gets called only in 2 situations:

1) you set the NSTableView delegate
2) you added your class as an observer of the NSTableViewSelectionDidChangeNotification notification

So if you didn't do 1, you need to do 2:

Code:
- (void)awakeFromNib {
    [[NSNotificationCenter defaultCenter] addObserver:self
        selector:(tableViewSelectionDidChange:)
        name:NSTableViewSelectionDidChangeNotification
        object:myTableView];
}

- (void)tableViewSelectionDidChange:(NSNotification *)notification {
    // yay it changed
}
You will need an IBOutlet to your NSTableView.
kainjow is offline   0 Reply With Quote
Old Apr 1, 2008, 10:45 PM   #5
satyam90
Thread Starter
macrumors regular
 
Join Date: Jul 2007
Location: Bangalore, India
Send a message via Yahoo to satyam90
Hi Kainjow,
The second option is working fine but not the first one.
For first option, in IB, I selected table view control and then associated its delegate to my controller class where I implemented textDidChange. Do I have to include or change anything for that?
satyam90 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
overriding of delegate method? MACloop iPhone/iPad Programming 2 Dec 15, 2009 03:23 AM
UIView calls method of its UIViewController?! siliconKai iPhone/iPad Programming 6 Dec 17, 2008 09:18 AM
nstableview delegate method is not getting called hrishidev Mac Programming 1 Nov 24, 2008 05:19 AM
Learning Control Panel & security stuff eclipse Web Design and Development 2 Nov 9, 2008 01:27 PM
Complete Noob question regarding NSTextField and delegate methods Sidespin Mac Programming 10 Jul 17, 2008 09:22 PM


All times are GMT -5. The time now is 11:07 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC