• 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: NSButtonCell in NSTableView: How can I define button action?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSButtonCell in NSTableView: How can I define button action?


  • Subject: Re: NSButtonCell in NSTableView: How can I define button action?
  • From: Michael Becker <email@hidden>
  • Date: Fri, 31 Oct 2003 20:53:15 +0100

In your controller code where you programmatically add the buttons, you would do something like:


[yourNewButtonInstance setTarget: self]; // or whomever is supposed to do the job
[yourNewButtonInstance setAction: (SEL)@selector(jumpThroughHoops:)];
[yourNewButtonInstance setToolTip: @"Cycle Position of Origin"]; // optional

where jumpThroughHoops is your action method. You would define
jumpThroughHoops like this:

- (void) jumpThroughHoops:(id)sender
{
// here is your code to jump through hoops
}


Thanks! That was very helpful. Just one other little question and my problem is solved: I would like to use the row of the clicked button in my action method. How do I (syntactically) pass this argument to the action method?

This is my code (snippets):

// right now the variable rowIndex contains the row
[ myButtonCell setAction:(SEL)@selector(deleteObject:)];
. . .

- (void)deleteObject:(id)sender
{
// Here I would like to have the row-index
}

Sorry for asking these questions, but a quick answer will solve all my problems (I hope) :-)
Thank you!

Bye,
Michael
_______________________________________________
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: NSButtonCell in NSTableView: How can I define button action?
      • From: Henry McGilton <email@hidden>
References: 
 >Re: NSButtonCell in NSTableView: How can I define button action? (From: Henry McGilton <email@hidden>)

  • Prev by Date: Re: Mail hacking?
  • Next by Date: Re: Detecting login/logout?
  • Previous by thread: Re: NSButtonCell in NSTableView: How can I define button action?
  • Next by thread: Re: NSButtonCell in NSTableView: How can I define button action?
  • Index(es):
    • Date
    • Thread