NSMatrix hangs in mouse tracking?
NSMatrix hangs in mouse tracking?
- Subject: NSMatrix hangs in mouse tracking?
- From: Daniel Jalkut <email@hidden>
- Date: Thu, 29 May 2003 09:03:38 -0700
I am implementing a custom control as a subclass of NSMatrix with a
single row of cells that are implemented as subclasses of NSActionCell.
When one of my cells gets clicked, and for the duration of it being
tracked, it draws a graphic in its portion of the view. When the
tracking moves to another cell, that cell draws a graphic, and the old
cell relinquishes the graphic, etc.
I handle tracking by implementing startTrackingAt, continueTracking,
and stopTracking.
I have found in testing that as I move the mouse from one cell to the
next, the cell that's being departed gets a stopTracking, and the cell
that's being arrived at gets a startTracking. Great! But I've also
found a problem scenario in which the tracking appears to hang:
It seems that if I move the mouse quickly enough from one cell to the
next, and stop dead at the destination, I can get NSMatrix's tracking
loop to "hang." If the mouse is flicked fast enough and the timing is
right, then NSMatrix seems to get only one mouse event, and it uses it
up telling the old cell to stopTracking. At this point, the new cell
hasn't gotten a startTracking, even though I'm hovering over its
contents. As soon as I move the mouse again, it "unlocks" the tracking
loop and the new cell becomes selected.
While the "hang" is happening, the old cell doesn't update, even though
it's been told to stopTracking (so I've redrawn its contents). I
assume this means the NSMatrix tracking loop is stuck in event
blocking, probably waiting for any mouse event to occur.
I actually just reproduced it in Interface Builder using a 3x10 matrix
of simple pushbuttons, so if you want to see it for yourself you can
try in IB. Rush your mouse around the matrix frantically, stopping
abruptly from time to time (with the mouse still down). You'll find
that sometimes you end up hovering over a button but it's not selected.
When you move the mouse slightly again, that button finally becomes
selected.
Is this a problem other people have run into? Any way to workaround
it, short of writing my own tracking loop and implementing trackMouse?
Maybe I could post a fake mouse movement event everytime I get a
stopTracking?
And yes, I'll write up a bug...
Daniel
_______________________________________________
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.