In Panorama X, pretty much every type of object is a button and will trigger code when clicked, including rectangles, stars, text display, whatever. This could be disabled, but I can think of situations where it might be useful to process clicks on a drag receiver (for example, you might set it up so that clicking on a drag receiver opens a file selection dialog), so I think I will leave it in. Though perhaps disabling clicks could be added as an option on an object-by-object basis.
For now, however, I think you can simply include this at the top of your code:
if info("droptypes")="" return endif
However, this would still allow dropped text. If you want to make sure only files have been dropped on your object, you could do this:
if catcherror("",info("dropfiles"))="" return endif
This is basically the same as your code, but I think a bit cleaner. I just love the
catcherror(function in Panorama X, I use it all the time and very rarely use
if error any more.
Here’s an example that would allow files to be dropped on the Drag Receiver, or the user can click on the Drag Receiver to select one or more files with a standard file selection dialog.
let chosenFiles = catcherror("",info("dropfiles"))
if chosenFiles = ""
if chosenFiles = "" return endif
// continue to process chosenFiles