1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

different output for NSFilesPromisePboardType

Discussion in 'Mac Programming' started by MrFusion, Mar 12, 2009.

  1. macrumors 6502a


    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?

  2. Moderator emeritus


    For a command-drag, you could try checking for ([[NSApplication currentEvent] modifierFlags] & NSCommandKeyMask)
  3. macrumors 6502a

    That works. Thanks.

Share This Page