Re: NSImageView as a drag source - how?
Re: NSImageView as a drag source - how?
- Subject: Re: NSImageView as a drag source - how?
- From: Bill Bumgarner <email@hidden>
- Date: Thu, 6 Jun 2002 16:38:05 -0400
Instead of implementation -mosueDragged:, try implementing the drag in
mouseDown:
- (void)mouseDown:(NSEvent *)e
{
NSPoint location;
NSSize size;
NSPasteboard *pb = [NSPasteboard pasteboardWithName:(NSString *)
NSDragPboard];
if ([e clickCount] > 1) {
;
}
if ([self copyDataTo:pb]) {
size = [[self image] size];
location.x = ([self bounds].size.width - size.width)/2;
location.y = ([self bounds].size.height - size.height)/2;
[self dragImage:[self image] at:location offset:NSZeroSize
event:(NSEvent *)e pasteboard:pb source:self slideBack:YES];
}
}
If you really want to differentiate between mouseDown: and mouseDragged:,
I believe you need to play some games w/ event handling. By default,
NSWindow does not propagate mouse moved events into the view hiearchy.
b.bum
On Thursday, June 6, 2002, at 04:26 PM, email@hidden
wrote:
Date: Thu, 06 Jun 2002 12:34:32 -0700
Subject: NSImageView as a drag source - how?
From: Chris DeSalvo <email@hidden>
To: <email@hidden>
I've created a subclass of NSImageView and added the following selectors:
- (BOOL) acceptsFirstMouse:(NSEvent *)theEvent;
- (NSDragOperation) draggingSourceOperationMaskForLocal:(BOOL)flag;
- (void) mouseDragged:(NSEvent *)theEvent;
But my class still won't act as a drag source. The above selectors never
even get called when I click and drag in that view.
What am I doing wrong?
b.bum
Wake up. Breathe....
.... keep breathing.
_______________________________________________
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.