• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: drop location
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Follow-Ups:
    • Re: drop location
      • From: Koen van der Drift <email@hidden>
References: 
 >drop location (From: Koen van der Drift <email@hidden>)

  • Prev by Date: iChat plug-ins?
  • Next by Date: No notification when app crashes?
  • Previous by thread: drop location
  • Next by thread: Re: drop location
  • Index(es):
    • Date
    • Thread