Or just trust what Xojo returned as I said above in a simple “if”.
Wow, they finally added FolderItem.Extension? … One would think that should of been added long go. Oh well, no worries.
I only have a license for Xojo 2022 so it doesn’t have that. I downloaded 2025 to check it out and see if I my stuff still works with it.
Your example works. Pretty cool.
Thanks.
Still a bug I’d say though, since it’s accepting the file drop, but that’s a nice workaround.
It should reject the drop and the item should snap back to where it originally was.
This worked fine in REALbasic, but it is broken since XojoBASIC (API2) or so…
So it turns out the implementing DragEnter is required to refuse the drop with visual feedback on macOS.
Function DragEnter(obj As DragItem, action As DragItem.Types) Handles DragEnter as Boolean
If obj.FolderItemAvailable And obj.FolderItem.Type > "" Then
return false // using a registered type
Else
return true // Why does returning true prevent the drop instead of false???
End
End Function
drop.xojo_binary_project.zip (5.1 KB)
Still seems like a bug that the implementation is different between Mac and Windows and it isn’t quite right because it doesn’t show the icon like native prevented drops do, but it’s much better.
@Rick_Araujo Would you mind testing on Windows to see if this is cross platform compatible?
Because the default value is False. If you don’t implement the event at all, it returns False. Return True is the only positive action you can take to prevent the drag.
For Windows nothing changes, still working as the previous one without DragEnter()
Windows auto-refuse the “not registered types” you simply can’t drop them on the area, it shows a forbidden sign.
I agree, even in API1. I recall mentioning ithe issue a couple of years ago on this forum.