In MacOS 10.8 I have a window that contains two NSTableViews
clipListTable and
tablesTable


In the data model. tablesTable has a to-many relationship with the selection of 
clipListTable

In the window controller awakeFromNib I set the window controller to be the 
delegate of the two tables

- (void) awakeFromNib
{
   [super awakeFromNib];
    [[self tablesTable] setDelegate:self];
    [[self clipListTable] setDelegate:self];
}

The window controller has a delegate procedure tableViewSelectionDidChange:

#pragma mark - NSTableViewDelegate methods

- (void)tableViewSelectionDidChange:(NSNotification *)aNotification
{
    id tableCandidate;
    tableCandidate = [aNotification object];
    DLog(@" tableCandidate %@", tableCandidate);
    DLog(@" clipListTable %@", [self clipListTable]);
    DLog(@" tablesTable %@", [self tablesTable]);

    if (tableCandidate == [self clipListTable]) {               //Change in 
clipListTable
      NSArray *selectedObjects = [[self videoClipArrayController] 
selectedObjects];
      if ([selectedObjects count] == 1) {
         VideoClip *clip = [selectedObjects lastObject];    // There should 
only be one...always.
      }
   }
    else if (tableCandidate == [self tablesTable]) {            //Change in 
tablesTable
        NSArray *selectedObjects = [[self tableArrayController] 
selectedObjects];
        if ([selectedObjects count] == 1) {
          Table *tab = [selectedObjects lastObject];    // There should only be 
one...always.
        }
    }
}

If i select a row in the clipListTable, the log reads:
2012-11-17 10:29:38.760 Roboplasm[82172:303] -[MediaWindowController 
tableViewSelectionDidChange:]  tableCandidate <NSTableView: 0x1006f20b0>
2012-11-17 10:29:39.727 Roboplasm[82172:303] -[MediaWindowController 
tableViewSelectionDidChange:]  clipListTable <NSTableView: 0x105407260>
2012-11-17 10:29:48.089 Roboplasm[82172:303] -[MediaWindowController 
tableViewSelectionDidChange:]  tablesTable <NSTableView: 0x1006f20b0>

and the Change in tablesTable branch gets executed

If I select  a row in the tablesTable, the log reads
2012-11-17 10:32:29.463 Roboplasm[82172:303] -[MediaWindowController 
tableViewSelectionDidChange:]  tableCandidate <NSTableView: 0x1006f20b0>
2012-11-17 10:32:30.131 Roboplasm[82172:303] -[MediaWindowController 
tableViewSelectionDidChange:]  clipListTable <NSTableView: 0x105407260>
2012-11-17 10:32:30.807 Roboplasm[82172:303] -[MediaWindowController 
tableViewSelectionDidChange:]  tablesTable <NSTableView: 0x1006f20b0>

and the Change in tablesTable branch also gets gets executed. In other words 
aNotification always reports the tablesTable as the tableCandidate no matter 
what table i click on in the window. 

How can I respond to a selection in the clipList Table?

Thanks,


Joseph Ayers, Professor
Department of Biology and
Marine Science Center
Northeastern University
East Point, Nahant, MA 01908
Phone (781) 581-7370 x309(office), x335(lab)
Boston: 444 Richards Hall (617) 373-4044
Cellular (617) 755-7523, FAX: (781) 581-6076
eMail: lobs...@neu.edu 
http://www.neurotechnology.neu.edu/
http://robobees.seas.harvard.edu/
http://cyberplasm.net/














_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to