Re: Misunderstanding re -[NSMatrix selectedCells]??
Re: Misunderstanding re -[NSMatrix selectedCells]??
- Subject: Re: Misunderstanding re -[NSMatrix selectedCells]??
- From: Robert Tillyard <email@hidden>
- Date: Fri, 15 Aug 2003 03:36:38 +0100
I think you need to use an enumerator to step through the NSMatrix,
like:
NSEnumerator *enumerator;
NSCell *cell;
enumerator = [[buttons cells] objectEnumerator];
while (cell = [enumerator nextObject])
if ([cell isSelected])
// do something.
You may need to tweak this a bit, I'm new at this myself.
Regards, Rob.
On Friday, August 15, 2003, at 03:00 am, Michael Norris wrote:
>
Hi there
>
>
I seem to be labouring under a misunderstanding about what exactly the
>
-[NSMatrix selectedCells] method does.
>
>
Reading the docs, I figure it ought to return an array of all the
>
"highlighted" cells of an NSMatrix.
>
>
However, in my current app I have an NSMatrix of checkboxes, and I
>
want to get an array of those NSButtonCells that are checked. I would
>
have thought that [theMatrix selectedCells] would give me this,
>
particularly given that [theMatrix selectAll] and [theMatrix
>
deselectAll] check and uncheck all the boxes respectively.
>
>
What it returns, however, is an array containing a single NSButtonCell
>
which is the last checkbox that was clicked on by the user, no matter
>
whether it to check or uncheck the checkbox.
>
>
I'm guessing that the problem must be that for checkboxes, being
>
checked and being selected are different things. A cell is selected if
>
the user clicks on it, whether or not they click on it to turn it off
>
or turn it on. Is that a fair assumption? How then can I easily
>
retrieve an array of checked checkboxes in my NSMatrix?
>
>
>
-----------------------
>
Michael Norris
>
Composer/Programmer
>
8 Bidwill St
>
Mt Cook
>
Wellington 6002
>
NEW ZEALAND
>
-----------------------
>
>
Ph: +64 4 803 3644
>
Web: http://mnorris.wellington.net.nz
>
Stroma: http://stroma.wellington.net.nz
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.