Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Best way to get different events for a button mouseDown and mouseUp?



Buttons are not really set up for this, so what you describe may be the easiest thing.

If what you intend is to have something going on while the button is down and then stop when it is up, though, you might want to look at the -setContinuous: and -setPeriodicDelay:interval: API...

Mike


Begin forwarded message:

From: Dan Wood <email@hidden>
Date: Sat Dec 28, 2002 2:30:26 PM US/Pacific
To: Cocoa dev <email@hidden>
Subject: Best way to get different events for a button mouseDown and mouseUp?

I have a need for some buttons that need to notify my code on both the "mouse down" AND the "mouse up". It looks like one way to do this is to make a subclass of NSButtonCell and override startTrackingAt:inView: and stopTracking:at:inView:mouseIsUp:, and also subclass NSButton and call setCellClass: to associate my button cell class with the button. Then I'd store selectors that the button cell would invoke, and hook up a pseudo "action" for mouse up and mouse down.

Is this the preferred way to do this? It seems like there ought to be something simpler, but I don't see it.....



--
Dan Wood
Karelia Software, LLC
email@hidden
http://www.karelia.com/
Watson for Mac OS X: http://www.karelia.com/watson/
_______________________________________________
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.
_______________________________________________
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.

References: 
 >Best way to get different events for a button mouseDown and mouseUp? (From: Dan Wood <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.