Re: This is more of a Drag than I thought it would be
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: Joe Muscara <email@hidden>
- Date: Fri, 14 Dec 2001 13:05:52 -0600
Thanks to Brian and Stiphane, I have made some progress.
On Friday, December 14, 2001, at 11:29 AM, Brian Webster wrote:
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.
How about a category? Declaring "@interface NSTextField (MyExtensions)"
seems to work, implementing the dragging methods there. Trick is now
that my concludeDragOperation method had some calls to self when it was
in the controller that I now need to send to the controller. Hmmm....
Second, how do you set an NSOutlineView/NSTableView to be a dragging
source?
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).
Are you sure of this? Isn't the Mailbox drawer in Mail an outline view?
It lets me grab an item most anywhere and drag it around. My app does as
well, now. :) Maybe it depends upon if vertical dragging is allowed. I
haven't tried with it turned off.
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 just copy/paste 'em from the docs, so no problem there.
What I ended up doing was adding Chuck Pisula's NSOutlineView_Extension
files from the DragNDropOutlineView project and voila - I was able to
drag my items around just as I wanted. Something in Brian's email
reminded me of Chuck's files, so thanks to both!
Now I have to figure out an implementation detail that I didn't think
about with this particular app until now. But that's my own fault!
Grazie!
Joe