1

I have in my mac app an NSMatrix made up of NSButtonCells. I do this:

[matrix setAction:@selector(matrixbutton:)];

However this is always called when the user releases the mouse click. Is it possible to alter this so it is called as soon as the mouse goes down?

Thanks.

PengOne
  • 48,188
  • 17
  • 130
  • 149
Josh Kahane
  • 16,765
  • 45
  • 140
  • 253

1 Answers1

0

No; controls on the Mac activate on mouse-up, not mouse-down. (Otherwise, it's impossible to distinguish between a click and a drag, for instance, since both begin with a mouse-down.)

  • What would you then suggest I do to have my method run upon mouseDown of my NSButtonCell? As I don't believe that NSButtonCell had a mouseDown event. – Josh Kahane Jul 27 '11 at 23:41
  • NSMatrix is a subclass of NSView, so you can make your own subclass of it and work that way. Alternatively, take a look at the `-[NSCell sendActionOn:]` method, which will let you change what events trigger the action. –  Jul 27 '11 at 23:45