Re: clicking in NSMatrix.
Re: clicking in NSMatrix.
- Subject: Re: clicking in NSMatrix.
- From: email@hidden
- Date: Mon, 5 May 2003 21:11:01 +0200
On lundi, mai 5, 2003, at 08:06 PM, Oscar Morales Vivs wrote:
Greetings there. Maybe someone can help me with my NSMatrix troubles.
I have a NSMatrix of checkboxes. I wanted to use the tag of each
checkbox to know what to modify when they were clicked, and assigned
to each one of the cells' target an action (which is the same for all
of them). However, when I run the program, the sender of the action
that is performed when I click on one of the checkboxes isn't the
button cell, but the NSMatrix, so I can't just use [sender tag] to
know what to do (that action can also be called from menu items, so I
wanted to avoid type-checking)
Is that a bug of a feature? I figured a matrix cell would send itself
as the sender of an action if set to have one, but I might be wrong.
And if the NSMatrix is meant to be the sender, it makes for not very
elegant code.
Any good advice on how to keep the code the same for menus &
checkboxes and avoid having these problems will be greatly > appreciated.
IIRC, the solution is to:
- set the action from the NSMatrix to the target
- in the method:
- (void) someoneClickedOnOneOfMyCheckBoxes:(id) sender
{
int tag;
tag=[[sender selectedCell] tag];
// Do your process here
}
_______________________________________________
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.