Re: (no subject)
Re: (no subject)
- Subject: Re: (no subject)
- From: Graham Cox <email@hidden>
- Date: Tue, 17 Jun 2008 11:50:12 +1000
This assumes you do have an outlet to each of course - if the buttons
otherwise don't need any programmatic access there's no reason to have
an outlet, so it's overkill (in my view) to add outlets just to tell
two buttons apart.
Having separate action methods is usually the best approach.
Graham
On 17 Jun 2008, at 11:31 am, Nick Zitzmann wrote:
On Jun 16, 2008, at 7:27 PM, Angelo Chen wrote:
I have following action, two NSButtons are linked to it, I'd like
to test which button trigger the action in the code, any way to do
this? thanks.
- (IBAction)doCopying:(id)sender
{
// how to determine which NSButton is clicked?
}
if (sender == someButtonOutlet)
{
// The button with the outlet connection "someButtonOutlet" was
pressed.
}
else if (sender == someOtherButtonOutlet)
{
// The button with the outlet connection "someOtherButtonOutlet"
was pressed.
}
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden