Re: How to catch all mouse clicking (or avoid multiple click filtering in startTrackingAt)
Re: How to catch all mouse clicking (or avoid multiple click filtering in startTrackingAt)
- Subject: Re: How to catch all mouse clicking (or avoid multiple click filtering in startTrackingAt)
- From: Ken Thomases <email@hidden>
- Date: Fri, 25 Apr 2008 02:02:42 -0500
On Apr 25, 2008, at 1:29 AM, Joan Lluch (casa) wrote:
I have implemented a NSButtonCell subclass in the usual way to
catch mouse tracking. I get the startTrackingAt and stopTracking
messages called correctly on the first click of the mouse. However
the startTrackingAt is not quickly called again if I quickly click
again the mouse, such as if I did a double click. I mean, if I
perform a double or triple click I only get one pair of
startTrackingAt and stopTracking calls instead of the desired two
or three pairs. So the desired behaviour is to be able to catch all
the mouse clicking activity in almost real time. What I get instead
is some filtering of the actual mouse clicking. This is the way I
implemented the methods
I'm guessing that this "filtering" is being done in -[NSControl
mouseDown:]. That is, if [theEvent clickCount] is greater than one,
it doesn't invoke the cell's trackMouse:inRect:ofView:untilMouseUp:
method.
You can try subclassing the NSControl in question (presumably an
NSButton?), overriding mouseDown:, and passing a different object to
[super mouseDown:aDifferentEvent]. You can either create a new
NSEvent whose properties are all the same as theEvent, or you can
wrap theEvent in a proxy object which forwards all messages
faithfully except clickCount, which it intercepts to always return 1.
Good luck,
Ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden