SC, Image Files and MPI

Drag And Drop more than one file

The last page deals with dropping one file onto our field, but it is handy to be able to drop more than one file to add them to the list.
To do this we need to find out how many files are in the drop. We should be able to do this by finding out how many lines are in the dragFlavors:
  put the number of lines in the dragFlavors into tMax

But there is a wee bug in SuperCard 4.1.2 which limits the dragflavors to 255 chars.
Luckily for us Chilton Webb supplies an Xcfn that does the job ListDragFlavors. This should be avalible sonn from but at the moment (( Jan 2004) you can get it from

For one file we used:
put dragData(1, "hfs " ) into tFilePath

That got the file path for the first file dragged on, we now need to loop through the list getting the file paths for all the files:
 on mouseDrop

put the number of lines in listdragflavors() into tMax
put "" into tImageList
--we are going to build a list of image file paths in tImageList
repeat with x = 1 to tMax
put dragData(x, "hfs " ) into tFilePath
put item 1 of dragData(x, "hfs ",type ) into tFileType
--then we check to see if it is an imageFile
if AltIsGraphicFile( tFileType,tFilePath) then put CR& tFilePath after tImageList
end repeat

We end up with a list of paths in tImageList, so now we can run through them and add then to our field (and userProp of paths), after checking if thety are already there.
 if tImageList is "" then return true

--we bail out if there are no images
put the uImagePaths of me into tImagePaths
repeat with x = 1 to the number of lines in tImageList
if line x of tImageList is "" or line x of tImageList is in tImagePaths then next repeat
--we go to the next file if the field already has the file
set the itemDel to colon
put last item of line x of tImageList into tFileName
if the number of lines in cd fld "imagelist" = 0
put tfileName into cd fld "imageList"
put line x of tImageList into tImagePaths
put CR&tfileName after cd fld "imageList"
put CR&line x of tImageList after tImagePaths
set the uImagePaths of cd fld "imageList" to the uImagePaths of cd fld "imageList"&CR&tFilePath
end if
--now we have filled our filed we set our userprop
set the uImagePaths of me to tImagePaths
end repeat
return true
end mouseDrop