• 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: This is more of a Drag than I thought it would be
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: This is more of a Drag than I thought it would be


  • Subject: Re: This is more of a Drag than I thought it would be
  • From: Brian Webster <email@hidden>
  • Date: Fri, 14 Dec 2001 11:29:08 -0600

On Friday, December 14, 2001, at 09:38 AM, cocoa-dev-
email@hidden wrote:

First, can you set up an NSTextField as a dragging destination for files?

Yes, there shouldn't be a problem with this. It's not clear from your explanation, but it sounds like you might be implementing the draggingEntered etc. methods in your text field's delegate. In order to drag something into an NSTextField, you must make a subclass of it and implement the dragging methods in your subclass.

Second, how do you set an NSOutlineView/NSTableView to be a dragging
source?

As I mentioned above, I have successfully made these dragging
destinations. What I haven't been able to do is drag any item that's in
my outline view. Regardless of whether I drag horizontally or vertically
(and I do have [fwOutlineView setVerticalMotionCanBeginDrag:YES] set in
my awakeFromNib), I don't get a drag. Vertical dragging always gives me
a drag select instead of picking up the item I am holding. I went so far
as to put some code in my outlineView:writeItems:toPasteboard: method
instead of simply returning YES, but that had no effect.

Firstly, be aware that there's a little "feature" in NSOutlineView's dragging methods in that it will only start a drag if you start the drag by clicking in the outline table column (the one with the disclosure triangles). The second thing I'd try is to make sure your data source's method is actually getting called (i.e. put in an NSLog). It's very easy to mistype the method declaration when implementing delegate/data source methods. I remember one person who implemented outlineView:writeRows:toPasteboard: instead of outlineView:writeItems:toPasteboard: and couldn't figure out why it didn't work. D'oh!

--
Brian Webster
email@hidden
http://homepage.mac.com/bwebster


  • Follow-Ups:
    • Re: This is more of a Drag than I thought it would be
      • From: Joe Muscara <email@hidden>
  • Prev by Date: Re: ObjC from C
  • Next by Date: Re: Remote login is DEED!
  • Previous by thread: This is more of a Drag than I thought it would be
  • Next by thread: Re: This is more of a Drag than I thought it would be
  • Index(es):
    • Date
    • Thread