Custom NSControl target/action howto!
Question
I have a custom NSControl that acts as sort of a two dimensional slider where you can drag a handle around the view. I added a few class specific methods and the only ones I overrode were the mouse actions and drawRect. My question is, how do I get it to implement target action? How can I make it behave like a slider and continuously send action messages to a bound target? As of now I can wire it up in interface builder but no action is sent. I've read alot about methods like sendActionOn: and sendAction:to: but I don't know exactly how to use them. If someone would explain it I'm sure I'd get it.
Solution
-sendActionOn:
is only relevant if you are subclassing NSControl and implementing a cell, which you are not.
In -mouseDragged:
(or whatever method is called from -mouseDragged:
to change the slider position), you should just call [[self target] performSelector:[self action]]
.