• 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: Drag and drop like in Interface Builder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Drag and drop like in Interface Builder


  • Subject: Re: Drag and drop like in Interface Builder
  • From: "I. Savant" <email@hidden>
  • Date: Thu, 2 Aug 2007 20:20:24 -0400

I want to implement drag and drop between two windows in my application. How would I go about doing something like the way interface builder does the connections? I.e. when the user clicks and drags a line is drawn from the source to the cursor. I assume this would have something to do with NSBezierPath?

For the drawing part, google and read "Cocoa Drawing Guide" (your assumption is correct - NSBezierPath is what you're after). To get it to draw between windows, you essentially need a transparent window with a custom view on which to draw.


The transparent window / custom view assembly serves as a target for your drawing since you're drawing things that happen across multiple windows.

You'd set the transparent window's level to be above both the other windows involved in the drag (we'll call them the drag windows). You'd then set its frame rect to be equal to the union rect of both drag windows. This will position it exactly over both drag windows.

You'd then draw your drag line on the transparent window's custom view to connect the beginning and end points, converting the points between the views' and screen's coordinate systems.

--
I.S.



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Drag and drop like in Interface Builder
      • From: "I. Savant" <email@hidden>
References: 
 >Drag and drop like in Interface Builder (From: Chris Blackburn <email@hidden>)

  • Prev by Date: Drag and drop like in Interface Builder
  • Next by Date: Re: Drag and drop like in Interface Builder
  • Previous by thread: Drag and drop like in Interface Builder
  • Next by thread: Re: Drag and drop like in Interface Builder
  • Index(es):
    • Date
    • Thread