OK, I thought I had a solution to a problem in my application nailed but now I am confused. I have an instance of NSMatrix in my interface that contains a single column of 6 NSButtonCell objects, each set to type "Check Box". The idea is that the NSMatrix "relates" these check boxes together and allows me to iterate through them in order to get the title of each selected Check Box using the following code:
The problem at the moment is that I can select as many of the check boxes as I like but the NSArray returned by [subDocTypesMatrix selectedCells] only contains a single instance of NSButtonCell (the last one selected). Any ideas why the other selected cells aren't being returned in the array?
Code:
// Get the NSButtonCell objects for the selected Sub Doc types and add their
// titles to an array of strings
NSMutableArray *subDocsTitles = [[NSMutableArray alloc] init];
NSArray *subDocButtonCells = [subDocTypesMatrix selectedCells];
int count = 0;
while (count < [subDocButtonCells count]) {
[subDocsTitles addObject:[[subDocButtonCells objectAtIndex:count] title]];
count++;
}
The problem at the moment is that I can select as many of the check boxes as I like but the NSArray returned by [subDocTypesMatrix selectedCells] only contains a single instance of NSButtonCell (the last one selected). Any ideas why the other selected cells aren't being returned in the array?