FROM : Dustin Sallings
DATE : Fri Nov 01 17:52:01 2002
Around 16:15 on Nov 1, 2002, Steve Dekorte said:
# I need to implement a custom dragging behavior in a subclass of
# NSMatrix but the mouseDragged: method never seems to get called.
# mouseDown: gets called, but never
# mouseDragged: or mouseUp:. Is there a secret to overriding dragging
# behavior on an NSMatrix?
Yeah, it's just a bit more complicated than that if you're doing
what I think you're doing. I'll describe to you what I remember about
what I did, and you can go from there. Please ignore if this is unrelated
to what you're doing. :)
You have to implement
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
And return a proper value before dragging will be enabled. Here
is the implementation I'm using for dropping files into my matrix:
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
{
NSDragOperation sourceDragMask = [sender draggingSourceOperationMask];
if (sourceDragMask & NSDragOperationLink) {
return NSDragOperationLink;
} else if (sourceDragMask & NSDragOperationCopy) {
return NSDragOperationCopy;
}
return NSDragOperationNone;
}
When I'm ready to deal with what was dragged (a list of files), I
do this (performDragOperation in my case):
-(BOOL)performDragOperation:(id <NSDraggingInfo>)sender
{
NSPasteboard *pboard=[sender draggingPasteboard];
NSArray *files = [pboard propertyListForType:NSFilenamesPboardType];
[...stuff with files];
return (TRUE);
}
--
SPY My girlfriend asked me which one I like better.
pub 1024/3CAE01D5 1994/11/03 Dustin Sallings <<email_removed>>
| Key fingerprint = 87 02 57 08 02 D0 DA D6 C8 0F 3E 65 51 98 D8 BE
L_______________________ I hope the answer won't upset her. ____________
DATE : Fri Nov 01 17:52:01 2002
Around 16:15 on Nov 1, 2002, Steve Dekorte said:
# I need to implement a custom dragging behavior in a subclass of
# NSMatrix but the mouseDragged: method never seems to get called.
# mouseDown: gets called, but never
# mouseDragged: or mouseUp:. Is there a secret to overriding dragging
# behavior on an NSMatrix?
Yeah, it's just a bit more complicated than that if you're doing
what I think you're doing. I'll describe to you what I remember about
what I did, and you can go from there. Please ignore if this is unrelated
to what you're doing. :)
You have to implement
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
And return a proper value before dragging will be enabled. Here
is the implementation I'm using for dropping files into my matrix:
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
{
NSDragOperation sourceDragMask = [sender draggingSourceOperationMask];
if (sourceDragMask & NSDragOperationLink) {
return NSDragOperationLink;
} else if (sourceDragMask & NSDragOperationCopy) {
return NSDragOperationCopy;
}
return NSDragOperationNone;
}
When I'm ready to deal with what was dragged (a list of files), I
do this (performDragOperation in my case):
-(BOOL)performDragOperation:(id <NSDraggingInfo>)sender
{
NSPasteboard *pboard=[sender draggingPasteboard];
NSArray *files = [pboard propertyListForType:NSFilenamesPboardType];
[...stuff with files];
return (TRUE);
}
--
SPY My girlfriend asked me which one I like better.
pub 1024/3CAE01D5 1994/11/03 Dustin Sallings <<email_removed>>
| Key fingerprint = 87 02 57 08 02 D0 DA D6 C8 0F 3E 65 51 98 D8 BE
L_______________________ I hope the answer won't upset her. ____________
| Related mails | Author | Date |
|---|---|---|
| Steve Dekorte | Nov 1, 16:16 | |
| Dustin Sallings | Nov 1, 17:52 | |
| Steve Dekorte | Nov 1, 19:51 |






Cocoa mail archive

