• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: (no subject)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >(no subject) (From: Angelo Chen <email@hidden>)
 >Re: (no subject) (From: Nick Zitzmann <email@hidden>)

  • Prev by Date: Re: Prevent Asynchronous operation of beginSheetModalForWindow
  • Next by Date: Re: First Responder and taborder?
  • Previous by thread: Re: (no subject)
  • Next by thread: Re: (no subject)
  • Index(es):
    • Date
    • Thread