Drag-n-Drop of NSCells to/from an NSMatrix
Drag-n-Drop of NSCells to/from an NSMatrix
- Subject: Drag-n-Drop of NSCells to/from an NSMatrix
- From: Brad Werth <email@hidden>
- Date: Thu, 09 Aug 2001 10:02:39 -0700
- Organization: ORCAS, Inc.
I am trying to do drag-n-drop of some NSCell subclass instances to and
from my NSMatrix subclass. The desired behavior is this: On mousedown,
highlight the cell -- if the user then drags the mouse, start the
drag-n-drop. This allows for cells to be selected without starting the
dragging session unless the user intentionally drags the mouse. I have
implemented this by my NSCell overriding startTrackingAt:inView: to do
the hilight and continueTracking:at:inView to start the drag.
It works great but for this: Both of those methods are called from
NSCell trackMouse:inRect:ofView:untilMouseUp: which, after calling
continueTracking, blocks -- waiting for a mouseUp event. But since my
implementation of continueTracking initiates a drag session, the mouseUp
is captured for THAT purpose instead. The end result is that after
doing a drag-n-drop, my app will ignore all events until I click the
mouse again -- I can't even command-Q to quit.
Not sure how to avoid this problem -- is there an accepted design for
this sort of thing that avoids this problem? If I keep going down this
road then I think my next step will be spoofing a mouseUp event to occur
when the dragging session ends (which I'm not certain how to pursue).
This seems a little kludgy and I could imagine some wacky
side-effects... any advice?
Thanks,
Brad Werth
email@hidden