bitsdojo_window
bitsdojo_window copied to clipboard
Please support making native app window a drag & drop target
It would be great if bitsdojo_window is being extended in a way that Drag & Drop operations to the native window are accessible in the Dart code of the flutter app. This would allow for dropping files onto a Flutter app which could then be processed with Dart!
This has been on my mind for some time and I will definitely look into it!
I got Drag & Dropping to work on Windows by modifying FlutterWindow
:
https://codereview.stackexchange.com/questions/253264/make-flutter-app-on-windows-a-drop-target-to-accept-files
But I am unsure whether this can be used in a plugin. Maybe it helps though.
Hi Thomas,
Thank you for sharing!
It is a good start and there are only a couple of things I would change about that implementation. For example, the QueryInterface
should return an object in ppvObject
when returning S_OK
and that should only happen for IID_IUnknown
, IID_IDropTarget
and maybe IDropSource
as well.
Normally QueryInterface
would also call AddRef
and AddRef
/Release
would increment/decrement some sort of a private counter and delete the object when that counter comes to zero but I would leave those empty in your sample as we probably don't want to free the FlutterWindow object by ourselves.
I will implement it in the package as soon as I finish the macOS support (next days).
To answer your question: yes, this can be done in the plugin, it is just a matter of time.
Thank you for the reminder!
Hey there, just curious where you are at with this? We're currently working on a couple of PR's, one to add Linux support. Wondering if this is worth looking into, or if you are well underway here? Maybe we can divy up the work? We're shooting for some end of February deadline for our desktop app.
@bitsdojo - great package, but has there been any progress on this issue? DnD is a key feature for my app and I'd like to use bitsdojo_window, but lacking built-in DnD support I've tried unsuccessfully to use the package along with the desktop_drop package and they appear to conflict in some way. No error, but I don't get a working drop target (just the red 'no entry" icon).
Any status or thoughts on workaround? I see the @technolion solution above, but would rather not mess with the generated code if possible. Thanks!
@bitsdojo - my sincere apologies: the package does appear to be working fine with desktop_drop. I had been doing a lot of editing and hot-reloading, and must've gotten my state all out of sorts. With a fresh build-run, it's working fine. For those seeking a solution for DnD with bitsdojo_window, I think this combination works well as we can easily define a specific target widget for finer control. Thanks again for the work on this useful package.