Hi Brian,

you seem to only check for gameScoresTableView and playerManagementTableView.
Are your Controller outlets actually connected to these 2 NSTableViews?

Regards,
Florian.

On 06 Jul 2009, at 20:14, Brian Hughes wrote:


Hi,
I have two tableViews in my application. One works perfectly the other doesn't. For both I use a simple data source. The tableView uses numberOfRowsInTableView: (NSTableView *)aTableView to get the number of rows by doing a count of the objects in my array. This number happens to be 22. When I run the program I get a zillion empty rows after my 22 rows of data. However if I use the constant 22 as the return value the tableView displays 22 rows of my data. Any idea about what I am doing wrong?
Here is my code:
   -(int) numberOfRowsInTableView: (NSTableView *)aTableView
{
          int returnValue;
        
          if (aTableView == gameScoresTableView) //This works as expected
          {
                if (currentIndex_>= 0)
                {
LNPlayer *currentPlayer = [playersArray objectAtIndex: currentIndex_]; NSMutableArray *tempGameRecordsArray = [NSMutableArray arrayWithArray: [currentPlayer gameRecordsArray]];
                        returnValue = [tempGameRecordsArray count];
                }
                else
                {
                        NSBeep ();
                        NSLog (@"ERROR in LNAppController -- 
numberOfRowsInTableView:");
                        return -1;
                }
                
          }
else if (aTableView == playerManagementTableView) //This is the one that doesn't work
          {
                returnValue = [playersArray count];  //[playersArray count] = 22
                NSLog (@"playersArray count = %d", returnValue);  //returnValue 
= 22
          }
        
return returnValue; //However if I change this to: return returnValue = 22 it works fine!
   }



-(id) tableView: (NSTableView *) aTableView objectValueForTableColumn: (NSTableColumn *) aTableColumn row: (int) rowIndex
   {
          id returnValue = nil;
        
          if (aTableView == gameScoresTableView)
          {
LNPlayer *currentPlayer = [playersArray objectAtIndex: currentIndex_]; NSMutableArray *tempGameRecordsArray = [NSMutableArray arrayWithArray: [currentPlayer gameRecordsArray]];
                
                id theRecord, theValue;
                
                theRecord = [tempGameRecordsArray objectAtIndex:rowIndex];
                theValue = [theRecord objectForKey:[aTableColumn identifier]];
                
                returnValue = theValue;
          }
          else if (aTableView == playerManagementTableView)
          {
                //Which Player?
                LNPlayer *player = [playersArray objectAtIndex: rowIndex];
                //What is the value of the attribute named identifier?
                //returnValue = [player valueForKey: [aTableColumn identifier]];
                if ([[aTableColumn identifier] isEqualTo: @"firstName_"] == YES)
                        returnValue = [player firstName_];
                else if ([[aTableColumn identifier] isEqualTo: @"lastName_"])
                        returnValue = [player lastName_];
                else if ([[aTableColumn identifier] isEqualTo: @"playerName_"])
                        returnValue = [player playerName_];
else if ([[aTableColumn identifier] isEqualTo: @"trebleClefGameLevel_"]) returnValue = [NSNumber numberWithInt: [player trebleClefGameLevel_]]; else if ([[aTableColumn identifier] isEqualTo: @"altoClefGameLevel_"]) returnValue = [NSNumber numberWithInt: [player altoClefGameLevel_]]; else if ([[aTableColumn identifier] isEqualTo: @"tenorClefGameLevel_"]) returnValue = [NSNumber numberWithInt: [player tenorClefGameLevel_]]; else if ([[aTableColumn identifier] isEqualTo: @"bassClefGameLevel_"]) returnValue = [NSNumber numberWithInt: [player bassClefGameLevel_]]; else if ([[aTableColumn identifier] isEqualTo: @"symbolTextConcentrationGameLevel_"]) returnValue = [NSNumber numberWithInt: [player symbolTextConcentrationGameLevel_]];
          }
        
         return returnValue;
   }
Any help would be much appreciated.
Thanks,
Brian

Than
_________________________________________________________________
Windows Live™ SkyDrive™: Get 25 GB of free online storage.
http://windowslive.com/online/skydrive?ocid=TXT_TAGLM_WL_SD_25GB_062009_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/florian.soenens%40nss.be

This email sent to florian.soen...@nss.be



Looking for Web-to-Print Solutions?
Visit our website :   http://www.vit2print.com


This e-mail, and any attachments thereto, is intended only for use by the 
addressee(s) named herein and may contain legally privileged and/or 
confidential information and/or information protected by intellectual property 
rights.
If you are not the intended recipient, please note that any review, 
dissemination, disclosure, alteration, printing, copying or transmission of 
this e-mail and/or any file transmitted with it, is strictly prohibited and may 
be unlawful.
If you have received this e-mail by mistake, please immediately notify the 
sender and permanently delete the original as well as any copy of any e-mail 
and any printout thereof.
We may monitor e-mail to and from our network.

NSS nv Tieltstraat 167 8740 Pittem Belgium _______________________________________________

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

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

Reply via email to