How to know how many rows and columns are selected in a NSMatrix?

306 Views Asked by At

How to know how many rows and columns are selected in a NSMatrix ? I tried many things but it does not work.

I thought about first getting the selected cells by calling selectedCells method of NSMatrix but then I don't know what to do. I should save somewhere in each cell instance its position (row/col) inside the NSMatrix? Is there another solution?

1

There are 1 best solutions below

2
On

You can find out how many are selected by doing this:

NSArray *selectedArray = [myMatrix selectedCells];
NSUInteger selectedNum = [selectedArray count];

Where myMatrix is your NSMatrix instance.