Re: drop location
Re: drop location
- Subject: Re: drop location
- From: "Louis C. Sacha" <email@hidden>
- Date: Sat, 19 Jun 2004 11:56:01 -0700
Hello...
Actually the draggingLocation is relative to the window, so when the
view you were dragging to was the only thing in the window you
probably didn't notice the problem, but now that the destination view
is only a part of the window it is more obvious.
You need to convert the point returned by draggingLocation to your
view's coordinates, which you can do with NSView's
convertPoint:fromView: method (supplying nil as the fromView:
parameter uses the view's enclosing window as the coordinate system
to convert from).
NSPoint drawLocation = [destinationView convertPoint:[sender
draggingLocation] fromView:nil];
[[[self document] drawing] addItemWithName: itemTag
atLocation: drawLocation];
(where destinationView is the view you are dragging to, which would
usually just be self when this code is part of the implementation of
the view's class)
Hope that helps,
Louis
...
And to accept the drop:
- (BOOL)dropItem:(id <NSDraggingInfo>)sender
{
...
[[[self document] drawing] addItemWithName: itemTag
atLocation: [sender draggingLocation]];
...
}
My guess is that the draggingLocation is relative to the tableview.
If that is the case, is there a way to fix this, or maybe there is
another way to get the droplocation?
thanks,
- Koen.
_______________________________________________
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: | |
| >drop location (From: Koen van der Drift <email@hidden>) |