• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
MacOS: Selecting from Multiple tables in the same window
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

MacOS: Selecting from Multiple tables in the same window


  • Subject: MacOS: Selecting from Multiple tables in the same window
  • From: Joseph Ayers <email@hidden>
  • Date: Sat, 17 Nov 2012 10:36:36 -0500

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: email@hidden
http://www.neurotechnology.neu.edu/
http://robobees.seas.harvard.edu/
http://cyberplasm.net/














_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: MacOS: Selecting from Multiple tables in the same window
      • From: Kyle Sluder <email@hidden>
  • Prev by Date: why LSSharedFileListInsertItemURL function can't work?
  • Next by Date: Re: Getting a .icns file from IconRef data
  • Previous by thread: why LSSharedFileListInsertItemURL function can't work?
  • Next by thread: Re: MacOS: Selecting from Multiple tables in the same window
  • Index(es):
    • Date
    • Thread