How to use HandleMouseDrag
-
On 03/01/2013 at 16:13, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R14.032
Platform: Windows ;
Language(s) : C++ ;---------
Hi folks,
I'm trying to simulate a file drag'n'drop from my user area.
The goal is to get the same behavior as if an importable file (I'm using a c4d for testing) was dragged directly from the explorer.
The documentation does not tell much about HandleMouseDrag so I just tried the following:Bool InputEvent(const BaseContainer& msg) { if (msg.GetLong(BFM_INPUT_DEVICE) == BFM_INPUT_MOUSE) { if (msg.GetLong(BFM_INPUT_CHANNEL) == BFM_INPUT_MOUSELEFT) { Filename file = "D:\\test.c4d"; //HandleMouseDrag(msg, DRAGTYPE_FILENAME_SCENE, &file;, 0L); HandleMouseDrag(msg, DRAGTYPE_FILENAME_OTHER, &file;, 0L); } } }
Any idea why this is not working?
Thanks for any help! -
On 05/01/2013 at 09:10, xxxxxxxx wrote:
Can you be more specific about what "Not working" means?
I've never used HandleMouseDrag myself. And because I don't use a copy of the _api directory in my solution (it bloats the solution file size). I keep getting undefined errors no matter what .h files I include.
So because of that irritating header problem. I was forced to use the cinema4dsdk solution to try it out.I used the AsyncTest plugin to do my testing in.
And I put this code inside the InputEvent() function's code block:Filename file = "C:\\atest.c4d"; HandleMouseDrag(msg, DRAGTYPE_FILENAME_OTHER, &file, 0L);
When I hold down the left mouse and drag in the gradient user area. The mouse changes to a hand icon. And I can then do a drop into any of the rows text box gizmos.
I get an error: "Dropped unknown object". But that's because I don't have the text box set up to handle scene files.
So as far as I can tell. It is technically working as expected.BTW: I think the Maxon employees are on holiday this week.
-ScottA
-
On 05/01/2013 at 13:12, xxxxxxxx wrote:
Hi, thanks for your help!
And sorry I should have been more precise. What I want to achieve is to drop items from an userarea so that they behave like when you drag and drop a file from the windows explorer into the CINEMA viewport/GUI (a + symbol appears and the file is automatically imported). Seems that HandleMouseDrag is not doing this job, so is there maybe another way to do that? -
On 08/01/2013 at 01:04, xxxxxxxx wrote:
Is it really not possible to detect a drop into the viewport??
-
On 10/01/2013 at 14:57, xxxxxxxx wrote:
Is it possible to simulate a drag as if it where from the content browser by using DRAGTYPE_BROWSER and the SDKBrowserDragInfo? This way the viewport would "know" how to react to importable files.
-
On 08/02/2013 at 03:10, xxxxxxxx wrote:
Hi Satara,
did you get any further with this? I too am trying to get some drag info working with a userarea, but the opposite to you. I'm trying to go from a browser in a dialog to the userarea. But I'm trying to read the mouse input while the drag is still in process - or while the mouse button is still down as it crosses from the browser to the userarea.
So not technically dropping, but continuing the drag.
WP. -
On 11/02/2013 at 00:28, xxxxxxxx wrote:
I am doing it manually now using MouseDragStart and MouseDrag inside GeUserArea::InputEvent and checking if the cursor is above the viewport. But you don't need to use this hacky way because you can handle the drop directly, since you are able to change the drop target.
Did you have a look at the "Drag and Drop" page in the docs? There is a block about "Receiving a drop" it should help you. -
On 13/02/2013 at 03:23, xxxxxxxx wrote:
Thanks Satara,
I may have sorted this one out finally. I've used the HandleMouseDrag from one userarea, and am capturing the message in the other. It 'seems' to be doing what I wanted (though I have spoken too soon before...)!
Stumbling my way through things here Cheers,
WP. -