Step 4: Start the Drag-and-Drop Operation by Providing the Drag Data

LabVIEW 2018 Help

Edition Date: March 2018
Part Number: 371361R-01
View Product Info

DOWNLOAD (Windows Only)

LabVIEW 2016 Help
LabVIEW 2017 Help
LabVIEW 2018 Help
LabVIEW 2019 Help
LabVIEW 2020 Help

To transfer data from the drag source to the drop target, you first must store the drag data when the user presses the mouse button and moves the cursor outside the bounds of the drag source. LabVIEW can retrieve the stored drag data later to update the drop target when the user causes the drop operation to occur.

What to Use

Use the following block diagram objects to start the drag by providing the drag data:

Case Structure Value To Variant Bundle Build Array Start Drag

What to Do

Create the following block diagram to start the drag by providing the drag data.

The following list describes important details about the previous block diagram.

The shift register indicates if the user has pressed the mouse button without releasing it. If the user presses the mouse button within the bounds of the drag source and does not release the button, the shift register value is TRUE. Start the drag by providing the drag data in the True case of the Case structure.
The Value property refers to the data value of the drag source.
Convert the data from the Property Node into a form that the Start Drag method can use. The Start Drag method requires drag data as a 1D array of clusters that consist of the variant data and a custom data name you choose.
Note Note  When you choose custom data names, do not begin the data names with the prefix LV_. The LV_ prefix is reserved for built-in LabVIEW data types.
The Start Drag method stores the array of drag data you create and begins the drag-and-drop operation. To access the drag data at a later time, use the Get Drag Drop Data function.
Note Note  This example implements copy only drag-and-drop behavior. To implement move behavior or move and copy behavior, change the Drag Mode parameter of the Start Drag method. You also must use the Drag Ended event to control when to clear data from the drag source.
The FALSE value returns the shift register to its original state. Provide a FALSE value to the shift register in the True and False cases. The FALSE constant is the only object in the False case of the Case structure, because the False case indicates an aborted drag-and-drop operation.

After you start the drag-and-drop operation by providing the drag data, verify that the drop target can accept the drag data.


Not Helpful