On Sep 3, 2009, at 7:58 AM, Scott Andrew wrote:
I think you need to create a subclass of NSButton that uses your cell. Then use setAction and setDoubleAction.
Creating a subclass of NSButton isn't necessary; the custom cell can be set in IB (Leopard+).
Dave needs to subclass NSButtonCell and provide a custom trackMouse:inRect:ofView:untilMouseUp:, since the superclass will always call the -action, even for a doubleclick, and there is no way to prevent that.
An optional "easy hack", might be to look at [NSApp currentEvent]'s clickCount (first making sure it is a mouse event). You could do this in the action itself. If it is a double click, then do something different. If it is a single click, make sure it is where you want it to be (hit test the event location) before doing the work you want.
A subclass is more reusable and the best approach, but probably more work.
corbin _______________________________________________ Cocoa-dev mailing list ([email protected]) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
