Re: Dragging a file out of an NSTableView
Re: Dragging a file out of an NSTableView
- Subject: Re: Dragging a file out of an NSTableView
- From: olivier <email@hidden>
- Date: Wed, 26 Mar 2003 12:33:45 -0600
my solution to dragging multiple flavor was to create a second paste
board and put my private data on there. Then on the receiving side i
check for promised file, if there are then i also look at that private
pasteboard
olivier
On Wednesday, March 26, 2003, at 12:24 PM, Mason Mark wrote:
Hello,
Thanks for the reply. This might work for Chris, but I don't think it
works for those (like me) who want to also include other pasteboard
types with the drag.
For example, my list of files can be drag-reordered (using a private
pasteboard type), and dragged into text-accepting views to insert the
list of selected files.
This is where I think the current API is insufficient (though if
somebody knows a way...?).
Regards,
--
Mason Mark
Five Speed Software, Inc.
On Wednesday, March 26, 2003, at 08:03 AM, olivier wrote:
In the meantime a work around is to do the following:
Subclass NSTableView.
- In your subclass, implement
-namesOfPromisedFilesDroppedAtDestination:. I would have it send a
message to your delegate.
- In your delegate, implement the method called by
namesOfPromised....
- In your delegate, implement
-tableView:writeItems:toPasteboard:. Return NO so that NSTableView
doesn't do the normal dragImage stuff on it's own. Instead, in this
method implementation, you will call
dragPromisedFilesOfTypes:fromRect:source:slideBack:event: yourself.
Olivier
On Wednesday, March 26, 2003, at 04:21 AM, Mason Mark wrote:
This issue has come up several times. Sorry, I don't have the
answer, just adding my $0.02 worth of "weight" to this thread.
There is a serious API shortcoming here, one of the more serious
Cocoa shortcomings that still exists, I think.
The AppKit release notes say that calling -[NSView
dragPromisedFilesOfTypes:fromRect:source:slideBack:event:] will also
"write a private type necessary to allow the destination to ask for
the filenames when the drag is dropped".
That might be one reason your attempt to create the promise from
scratch does not work.
I would like to see the promised files API brough updated to work as
one would expect within the well-established Cocoa
pasteboard/drag&drop system.
While waiting, it would be cool if Apple provided a workaround. I
have exactly the same need as you, except I need to also be able to
include standard text pasteboard types (filenames) and also internal
private pasteboard types. So I'd really like it if HFS Promise drags
worked like all the other kinds of drags...
I'd encourage you to join those of us who've filed bugs on this
issue. ;-)
Best regards,
--
Mason Mark
Five Speed Software, Inc.
Chris Hanson wrote:
I need to drag a file - generated on the fly - out of an
NSTableView and into the Finder.
I think the way to do this will be to generate a file promise.
However, I'm using an NSTableView, so I can't simply override
-[NSView
dragPromisedFilesOfTypes:fromRect:source:slideBack:event:]. OK, I
figure I'll attempt to create a promise from scratch. In handling
the drag in the table in my table data source, I use:
[pasteboard declareTypes:
[NSArray arrayWithObject:NSFilesPromisePboardType]
owner:self];
success = [pasteboard setPropertyList:
[NSArray arrayWithObject:@"myExtensio"]
forType:NSFilesPromisePboardType];
And then in my NSTableView subclass, I override
-namesOfPromisedFilesDroppedAtDestination:. (In doing so I'm
assuming that in a drag initiated by an instance of NSTableView,
that the NSTableView instance is the drag's owner.) However, the
Finder refuses my drag.
Does anyone have any suggestions as to how to go about this? I'm
running out of ideas.
-- Chris
_______________________________________________
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.
_______________________________________________
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.