I am writing a UI application using Racket and would like to be able to drag and drop elements, such as images, from other applications. In particular, I want to drag an image from a web page in a browser (for example, in Chrome or FF) and transfer it to canvas% in the application, resulting in raw image data (the application will consider PNG metadata before accepting the discarded image).
There is no functionality (which I can find) directly in the canvas% class or superclasses that relate to clipboard events.
I am familiar with the dnd clipboard in other environments such as Swing and Win32.
The clipboard-client% class seems to be what is required, but the Racket documentation makes it harder to connect points to the binding to one of the window classes.
Are there any good tutorials or code examples that I can reference?
Update: I looked at the source of Racket (OSX) for clipboard.rkt and seems to have turned to a βcommonβ file cabinet. OSX has a separate cardboard for drag-n-drop operations.
So, it seems that dnd does not work in Racket on OSX, and I will have to use Objective-C FFI to implement the required functionality and limit my users to those using a Mac.
The completion of this question.
source share