Re: (id)sender tag
Re: (id)sender tag
- Subject: Re: (id)sender tag
- From: J B <email@hidden>
- Date: Thu, 10 Nov 2005 18:28:36 -0500
Perfect advice. Thanks.
-JB
On 11/10/05, Sherm Pendley <email@hidden> wrote:
> On Nov 10, 2005, at 6:00 PM, J B wrote:
>
> > Hello,
> > I'm trying to create a simple calculator as an exercise and I have
> > attached all the numeric buttons to one action in my controller class.
> > I was planning on figuring out which button has been pushed via the
> > [sender tag] method. I've set all the tags to match the numeric values
> > (i.e. the button I want to represent 7 has a tag of 7).
> >
> > When the button is pushed I can't seem to get a valid tag value
> > however. Invoking [sender tag] within the action simply gives me 0 no
> > matter what button has been pushed.
> >
> > Any clues?
>
> Are your buttons in an NSMatrix? If so, [sender tag] is probably
> giving you the tag for the matrix, not for the selected button cell.
> To get that tag, you could do something like [[sender selectedCell]
> tag].
>
> sherm--
>
> Cocoa programming in Perl: http://camelbones.sourceforge.net
> Hire me! My resume: http://www.dot-app.org
>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden