Not logged inGosu Forums
Forum back to Help Search Register Login
Up Topic Gosu / Gosu Exchange / Any way for a file drag and drop ?
- - By bestguigui Date 2016-06-20 13:36
Hi guys,

would you know any way to allow drag and drop of FILES to a Gosu::Window ?

I'm not talking about moving an object inside the window (like a Gosu::Image), but really any file that would be taken from the file explorer and draged into the Gosu::Window.

Thanks a lot :)
Parent - - By jlnr (dev) Date 2016-06-20 19:37 Edited 2016-06-20 19:49
There is an SDL event we could use for this:

...but I would still prefer it if a Ruby GUI toolkit finally emerged that handled all of this for us :(

If you only need to do this on Windows, you can probably use the funky win32-api gem to install a hook of type WH_CALLWNDPROC:

And then when you receive the WM_DROPFILES message, you need to call the Drag* functions to figure out the filename:

It will be either easy or hard depending on how familiar you are with this gem :)

Edit: It turns out that the DragQueryFile function is already defined in this companion gem:

And here is someone who has successfully used SetWindowsHookEx with the win32-api gem:
Parent - By bestguigui Date 2016-06-21 18:37
That is a great reply ! Thanks, I'll try those :)
Up Topic Gosu / Gosu Exchange / Any way for a file drag and drop ?

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill