12-14-2011 05:20 AM
Is it possible to drag-and-drop from a LabVIEW application to another application? Is it possible to at least get the window handle of the window that was dropped to?
12-15-2011 09:45 AM
Hi Synaesthete,
Can you clarify what you mean by "drag-and-drop"? What exactly would you like to do?
Thanks,
12-15-2011 10:31 AM
Yeah, we may be able to be more specific if you clarify what you are trying to do. I've never really tried dragging between a labview and non labview app. Dragging between apps relies on a contract of sorts that operates through the windows OS, and there doesn't seem to be any native support for it in LabVIEW. That doesn't mean that its not possible, it just means that it might be more work than its worth to do from a native labview control. However, I know that you can do it using ActiveX or .Net controls used in a LabVIEW VI. That might be the easiest way.
12-15-2011 10:52 AM
There is no support function that I know of, what would you like to "drag" from LabVIEW? What application would you need to "drop" into?
12-15-2011 06:03 PM
It depends on what data type you want to drop, and/or if you can re-program the other application.
An EASY way to get the window handle of the drop over window:
1. Set the flag on cursor down; unset on cursor up.
2. On cursor leave panel, check cursor down flag. If true, start to poll for cursor up event.
3. On cursor up, call Windows API "WindowFromPoint" to get the handle.
12-15-2011 10:27 PM
Zou,
Awesome, I will try that immediately, that is exactly what I want to do.
Without going in to it much further, I basically want my user to be able to drag-and-drop "mini-reports" in to a Word document from a tree control, thereby stringing together a larger report in a single document.
12-16-2011 12:46 PM
In this case, you can launch the Word with ActiveX. Then you got the control of it, no need to find the handle of the drop window. Simply use ActiveX to insert your "mini-report" to the Word document.
Drag & Drop may be nice, but not very efficient. Double click the item in the tree control to add to the report may be faster.
03-08-2012 09:54 AM - edited 03-08-2012 10:01 AM
I just discovered this topic, which seems to have some similarity to my problem. I search for a solution to drag a vi running in a subpanel outside that subpanel and position its front panel where the user releases the mouse, or in other words where he drops it. As this can be anywhere on the screen, I think I need windows library functions to implement this, am I right? Or is there an easier way without them? So far I only got inspired by the example in the topic how to drag and drop to desktop.
03-08-2012 12:01 PM
I'm not usre if this meets your needs but I posted an example of how to implement "Docking" using LV and sub-panels here.
The code posted there should get you started, if that is what you want.
Pure-G, no Windows stuff.
Ben
03-12-2012 05:56 AM - edited 03-12-2012 06:00 AM
Hi Ben,
your example "Docking" is great. Running a vi inside a subpanel as part of a bigger front panel and then being able to "undock" and run it outside that front panel on its own is exactly what I'd like to do. Your example helps me a lot for that part of the task.
Additionally I'm searching for a more intuitive way a user switches between the "docked" and "undocked" state and with this a more visible transition. Especially the undocking would be very nice by drag+drop, as the undocking by a button is quite old fashioned and not that intuitive for users in the year 2012. I imagine having the vi with a kind of a title bar, that the user just drags outside the subpanel, and the vi front panel shows up where the user drops it. The visible transition would be at least the standard mouse cursor icon for dragging. Oliver Jourdan is showing something similar in his Demo of dynamic tabs (reorder, detach...) as in a mordern web browser , but as he doesn't show code, it doesn't help me...As the dragging would be then outside the LV front panel, I assumed windows library functions are needed for that.
Do you have more recommendations for that? I would be extremely happy about any help.