Start Drag Method

LabView Local Project Settings

Start Drag Method

Short Name: Start Drag

Installed With: Base Package

Class: Control Methods

Starts a drag and drop operation using the specified control as the source.

You can use this method to start drag and drop operations in response to user-defined actions instead of the built-in behavior with string, tree, listbox, and multicolumn listbox controls. For controls other than the string, tree, listbox, and multicolumn listbox, the Start Drag method is the only way to start a drag using this control as a drag source. You must specify what data to provide during the drag and drop operation. Optionally, you can specify the drag mode, and corresponding default cursor feedback, to reflect whether this drag and drop operation supports moving the data instead of only copying it.

If there is already a drag in progress, LabVIEW returns an error. If you pass an empty array for the data parameter, the drag operation does not start and LabVIEW returns an error. If the array of data passed contains duplicate data names or data that conflicts with built-in types, LabVIEW returns an error.

After you use this method, LabVIEW remains in the middle of a drag and drop operation until the user cancels the drag by pressing the <Esc> key or lifting the mouse button, or until a window opens in front of the window that has the source control.

The Drag Data parameter is an array of clusters, each cluster containing a label and corresponding data. Each label must be unique and cannot use the LV_ prefix. Each element of the array must be of the same data type. The Drag Mode parameter specifies the operation of the drag, such as copy, move, or copy and move. If you select copy or move, pressing the <Ctrl> key copies the item.

Example

Parameters

NameRequiredDescription
Drag DataNoIndicates the LabVIEW or user-defined name that identifies the data type. You cannot use the prefix LV_ on a user-defined data name, because it is reserved for LabVIEW data types. You can use the following built-in LabVIEW data types and names:
LabVIEW Data Type Definition
LV_TEXT String
LV_TREE_TAG String
LV_TREE_ITEMS Array of a cluster containing an array of strings, from left to right, in the item you are dragging, an integer representing the glyph index associated with the item from which you are dragging data, and an integer representing the indent level of the item from which you are dragging.
LV_LISTBOX Cluster containing an array of strings from the row that you are dragging data and an integer representing the glyph index associated with the row from which you are dragging data.
LV_LISTBOX_ITEMS Array of a cluster containing an array of strings, from left to right, in the item you are dragging and an integer representing the glyph index associated with the item from which you are dragging data.
LV_PATH Path
Drag ModeNoSpecifies the operations that this control supports during the drag, such as copy or move, copy only, move only. If you select copy or move, pressing the <Ctrl> key copies the item. For filter events, you can modify this field to change the drag mode when this event is generated.

Remarks

The following table lists the characteristics of this method.

Available in Run-Time Engine and Real-Time Operating SystemYes (Read/Write)
Settable when the VI is runningYes
Loads the front panel into memoryNo
Need to authenticate before useNo
Loads the block diagram into memoryNo
Remote access disallowedNo
Must wait until user interface is idleNo
Available with control VIsNo
Available with global VIsNo
Available with strict type definitionsYes
Available with polymorphic VIsNo

Example

Refer to the Drag and Drop - Custom Source Handle Dropping VI in the labview\examples\general\dragdrop directory for an example of using the Start Drag method.

 Open example  Browse related examples