• 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: how do I use a SEL from another class?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how do I use a SEL from another class?


  • Subject: Re: how do I use a SEL from another class?
  • From: Ryan Britton <email@hidden>
  • Date: Mon, 26 Jun 2006 21:19:47 -0700

Buttons have both a target and an action. You're setting the action but neglecting to set the target so it's ending up with whatever value it has when passed in.

http://developer.apple.com/documentation/Cocoa/Reference/ ApplicationKit/Classes/NSControl_Class/Reference/Reference.html#// apple_ref/occ/instm/NSControl/setTarget:

On Jun 26, 2006, at 8:46 PM, Alan Smith wrote:

Hi all,
I'm playing around with NSSavePanel and want to assign the action of
the Okay button to my own custom button. The custom button will not be
accessible through my NSSavePanel category. It will be passed in and
then the category will take the action and setAction. Like so:

- (void)assignOkayActionTo: (NSButton*)newButton
{
   [newButton setAction: [_okButton action]];
}

When I try to use this it says: *** -[controller ok:]: selector not
recognized. ' controller' is the class from which this reassigning of
the button is called. It is obvious enough what this error means:
there is no method called 'ok:' in the controller class. That's fine
because I don't want the button to link to a new action. I want it
linked to the NSSavePanel - (IBAction)ok:(id)sender method.

So the question is, how do I get it to realize where it should expect
to find the method?

Many thanks, Alan

--
// Quotes from yours truly -------------------------
"You don't forget, you just don't remember."
"Maturity resides in the mind."
"Silence is the Universe's greatest gift."
"Don't waste your life doing things others have already done."
_______________________________________________
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

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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

References: 
 >how do I use a SEL from another class? (From: "Alan Smith" <email@hidden>)

  • Prev by Date: General Remote CoreData Stores Question
  • Next by Date: NSStrings and data bytes
  • Previous by thread: how do I use a SEL from another class?
  • Next by thread: General Remote CoreData Stores Question
  • Index(es):
    • Date
    • Thread