• 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: content inside sender
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: content inside sender


  • Subject: Re: content inside sender
  • From: Andrew Merenbach <email@hidden>
  • Date: Thu, 1 Aug 2002 13:11:28 -0700

If your buttons have different titles, then you can do this:

- (void)Dosth:(id)sender
{
if ([[sender title] isEqualToString:@"First Button"]) {
// the first button was clicked
} else if ([[sender title] isEqualToString:@"Second Button"]) {
// the second button was clicked
}

}

Take care,
Andrew Merenbach


On Thursday, August 1, 2002, at 02:43 AM, cocoa-dev-
email@hidden wrote:

I have cocoa application, with 2 buttons, button1 and button2, they both
attach to the send action "Dosth"

- (void) Dosth:(id)sender
{
}

1) Inside "Dosth", how can I find out whether button1 or button2 trigger the
action?
- a) Can I use the tag method to do it? (In interface builder, set the tag
value of button1 to 1, button2 to 2 )
- b) Or use the variable "sender" to figure it out? But how?

Thank you very much!
_______________________________________________
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.

  • Follow-Ups:
    • Re: content inside sender
      • From: Chris Hanson <email@hidden>
  • Prev by Date: Returning an error from Applescript
  • Next by Date: FTP with Cocoa
  • Previous by thread: Re: content inside sender
  • Next by thread: Re: content inside sender
  • Index(es):
    • Date
    • Thread