Re: mouseDragged event
Re: mouseDragged event
- Subject: Re: mouseDragged event
- From: James DiPalma <email@hidden>
- Date: Tue, 22 Jun 2004 19:58:01 -0700
On Jun 22, 2004, at 12:29 PM, Rick Bischoff wrote:
I have a subclassed NSMatrix that has drag and drop implemented
correctly (triggered on the mouseDown: event).
We should start a club.
However, I wish to add a new behavior that would require the NSMatrix
to distinguish between clicking and dragging... But when I wrote the
method
-(void)mouseDragged:(NSEvent*)event {
NSLog(@"in mouseDragged:");
}
It was never called, even if I disabled my mouseDown method.
Yes. NSMatrix's mouseDown: method allows cells to track mouse events
and if they do, your matrix instance will not get mouseDragged:
messages. Interestingly, if you had implemented mouseDown: to do
nothing, you probably would have been sent mouseDragged: messages.
I have a mouseDown: that does little if an event might start a drag
(all mouse events unless a modifier flag exists) and calls [super
mouseDown:] otherwise. This technique worked, but it was a challenge to
get right especially since mouseUp: needs to be overridden to handle
what NSMatrix would have done if it handled a mouseDown: that did not
start a drag.
Depending on your use for a drag matrix, you will also have to make
some difficult decision about when to let cells track a mouse down and
when to initiate a drag. For instance, a slider cell within a
drag-allowing NSTableView doesn't work too well since all mouse drags
start a drag. NSButtonCells as a checkbox will change their value on a
mouse up and will drag rows when dragged (my drag matrix is unlikely to
get this behavior right).
Is there any convention/documentation on what a control should do when
it both allows dragging and has a cell that tracks mouse drags?
-jim
Rick Bischoff
Blog, and home for some MacOS X apps -- http://rickjr.org
_______________________________________________
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.