LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Drag-and-drop from LabVIEW to another Application?

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?

0 Kudos
Message 1 of 10
(3,686 Views)

Hi Synaesthete, 

 

Can you clarify what you mean by "drag-and-drop"? What exactly would you like to do? 

 

Thanks,

 

 

--
Peter Rifken - Field Engineer & Business Manager
Boston / North New England & Maine
0 Kudos
Message 2 of 10
(3,653 Views)

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.

0 Kudos
Message 3 of 10
(3,646 Views)

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? 

--
Peter Rifken - Field Engineer & Business Manager
Boston / North New England & Maine
0 Kudos
Message 4 of 10
(3,640 Views)

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.

 

 

George Zou
0 Kudos
Message 5 of 10
(3,624 Views)

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.

0 Kudos
Message 6 of 10
(3,614 Views)

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.

 

 

George Zou
0 Kudos
Message 7 of 10
(3,595 Views)

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.

0 Kudos
Message 8 of 10
(3,553 Views)

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

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 9 of 10
(3,531 Views)

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.

0 Kudos
Message 10 of 10
(3,500 Views)