PDA

View Full Version : different output for NSFilesPromisePboardType




MrFusion
Mar 12, 2009, 06:21 PM
Hi,

I have an NSOutlineView with drag and drop. I want to add NSFilesPromisePboardType as a dragtype. However, based on which modifer key is pressed at the time of drop (e.g. in the finder), I want to create different files and different filecontent. This should be possible, since I keep a pointer to the dragged data around (i.e. the data is not written to the pasteboard directly).

According to the docs, I should implement this function.

-(NSArray *) outlineView:(NSOutlineView *)outlineView namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination forDraggedItems:(NSArray *)items


But it's not telling what kind of NSDragoperation (generic/move/copy/... as determined by the modifer keys such as command and option) was performed.

If I drag, I want to create a file with the original, imported content.
If I command-drag, or option-drag, I want to create a file which has new, derived content.

Is there a way around this?

Thanks



kainjow
Mar 12, 2009, 09:11 PM
For a command-drag, you could try checking for ([[NSApplication currentEvent] modifierFlags] & NSCommandKeyMask)

MrFusion
Mar 13, 2009, 12:56 PM
For a command-drag, you could try checking for ([[NSApplication currentEvent] modifierFlags] & NSCommandKeyMask)

That works. Thanks.