• 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
filtering drag and drop
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

filtering drag and drop


  • Subject: filtering drag and drop
  • From: Mike Margolis <email@hidden>
  • Date: Fri, 7 Sep 2001 00:57:06 -0700

Hey... ive spent all night stuck on what should be pretty simple.
I am trying to have an NSView accept audio files (i named it AudioWell).
The problem is, I cant seem to specify what I allow to be dropped in. if I registerForDraggedTypes with

[NSArray arrayWithObject: NSFilenamesPboardType];

It accepts everything. If i change it to

[NSArray arrayWithObject: NSTIFFPboardType];

it doesnt accept anything, not even tiffs, tiffs with.tiff extensions, tiffs with .tif extension, none of them. I tried hard coding an array of @"TIFF", @"tiff", @"tif ", etc.. still nothing. I cant seem to find in the documentation what exactly registerForDraggedTypes should take in besides these prefabricated NSTIFFPboardType, etc stuff...

later, in draggingEntered, I get the pasteboard from the sender, and I do this to see what file type was dropped in:

desiredType = [[pasteboard availableTypeFromArray:dragTypes] retain];

but that doesnt seem to yield any important or relevant information. I cant seem to find any other example of this behavior being used anywhere else (having an NSView filtering files) except in Sketch.app, but it just uses the NSFilenamesPboardType which doesnt seem to filter anything out.

So, in a nutshell, how do i only allow certain types (file types, OSTypes, extensions, whatever) to be droppable in an NSView, while not allowing anything else in?

Thanks in advance
Mike Margolis


  • Follow-Ups:
    • Re: filtering drag and drop
      • From: Izidor Jerebic <email@hidden>
  • Prev by Date: scientific library in obj-C
  • Next by Date: HELP How to open a default document at startup
  • Previous by thread: Re: scientific library in obj-C
  • Next by thread: Re: filtering drag and drop
  • Index(es):
    • Date
    • Thread