filtering drag and drop
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