• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSMatrix hangs in mouse tracking?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSMatrix hangs in mouse tracking?


  • Subject: Re: NSMatrix hangs in mouse tracking?
  • From: Tobias Hermann <email@hidden>
  • Date: Thu, 29 May 2003 22:08:22 +0200

hi!

I think the best was to override your matrix subclasses mouseDown, mouseDragged and mouseUp method and track the thing yourself. But without a tracking loop. IMHO controls should go away from these tracking loops, because they are somehow blocking, etc... (pse don't start a discussion about that now ! :-) ).

What I wanted to say is, that this is not really much effort (you need some membervariables to save the mousebutton state and such stuff, refers to your needs). You simply have to make your own versions of these three mouse methods and call the right cell's start/stop/continuetracking methods as you want.

regards

Tobi


On Thursday, May 29, 2003, at 06:03 PM, Daniel Jalkut wrote:

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.
_______________________________________________
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: 
 >NSMatrix hangs in mouse tracking? (From: Daniel Jalkut <email@hidden>)

  • Prev by Date: Re: Getting Application Path
  • Next by Date: Threads, messages and blocking
  • Previous by thread: Re: NSMatrix hangs in mouse tracking?
  • Next by thread: NSString from Carbon by AppleEvent
  • Index(es):
    • Date
    • Thread