Implementing Custom Drag-and-Drop Behavior
- Updated2026-08-05
- 2 minute(s) read
Although LabVIEW provides built-in drag-and-drop behavior for text-based controls, you can programmatically implement custom drag-and-drop behavior for any controls, including non-text-based controls. Programmatically implement drag-and-drop behavior with drag-and-drop events to accomplish the following tasks:
- Allow users to drag and drop data between non-text-based controls.
- Provide custom drag-and-drop behavior for text-based controls.
Complete the following steps to implement custom drag-and-drop behavior:
- Identify which controls to use as the drag source and drop target.
- Prepare the VI to detect when the user causes drag-and-drop events to occur.
- Detect when the user aborts a drag-and-drop operation.
- Start the drag-and-drop operation by providing the drag data.
- Verify that the drop target can accept the drag data.
- Update the drop target with the drag data.
- Determine when to stop the VI.
Additional Examples
Refer to the Drag and Drop - Passing Custom Drag Data VI in the labview\examples\Structures\Event Structure directory for an example of using drag-and-drop events to implement drag-and-drop behavior.
Refer to the Drag and Drop - Initiating a Custom Drag VI in the labview\examples\Structures\Event Structure directory for an example of implementing drag-and-drop behavior on the plots of graphs.
Related Information
- Configuring Run-Time Drag-and-Drop Behavior for Text-Based Controls
- Choosing How an Event Structure Monitors For Events
Event registration is the term for specifying which events you want a LabVIEW Event structure to handle. LabVIEW can register events either statically or dynamically.
- Creating Properties and Methods
- Step 1: Identify Which Controls to Use as the Drag Source and Drop Target
- Step 2: Prepare the VI to Detect When the User Causes Drag-and-Drop Events to Occur
- Step 3: Detect When the User Aborts a Drag-and-Drop Operation
- Step 4: Start the Drag-and-Drop Operation by Providing the Drag Data
- Step 5: Verify that the Drop Target Can Accept the Drag Data
- Step 6: Update the Drop Target with the Drag Data
- Handling Boolean Controls in an Event Structure
If you use a latching action for Boolean controls alongside event handling, you must place the control in the Event structure. Additionally, to avoid responding to undo and redo interactions as if they were button presses, use a Case structure.
- Handling Errors