Initiates a Drag&Drop Copy or Move operation for a dBASE Plus UI object.

Syntax

<oRef>.drag(<type expc>, <name expC>, <icon expC>)

<oRef>

The object to be copied or moved.

<type expc>

A string, typically identifying the object's type.

<name expC>

A string, typically containing the name of the object.

<icon expC>

The filename of a cursor icon to be displayed while the object is being dragged. This parameter is required, but is currently unused. The default Windows OLE cursor will be displayed.

Property of

Many Form objects

Description

Use drag( ) to initiate a Drag&Drop operation for a Drop Source object. Drop Source objects may only be dropped upon “active” Drop Target objects; that is, any object whose allowDrop property is set to true. The drag( ) method is typically called from within the Drop Source’s onLeftMouseDown event handler.

drag( ) returns true or false, according to the success of the drop operation.

For Copy operations, <type expC> and <name expC> are passed directly from a Drop Source’s drag( ) method to a Drop Target’s onDragEnter, onDragOver, and onDrop events. Other than a length restriction of 260 characters, these parameters have no mandatory format and may be used to communicate any information.

The type of operation initiated is determined by the object’s dragEffect property, and the state of the Control key when the mouse button is pressed. The following table shows the possible settings and resulting operations:

dragEffect

Control key

Operation type

0 - None

(ignored)

None (dragging disabled)

1 - Copy

(ignored)

Copy

2 - Move

up

Move

2 - Move

down

Copy

 

For a Move operation, the dragged object moves with the mouse and may only be dropped within its containing object, e.g. a parent Form or Container. The operation will only take place if the containing object is also an active Drop Target. The Move operation terminates when the mouse button is released. The Target’s onDrop event is not fired for Move operations.

For a Copy operation, the dragged object appears to remain in place and may be dropped either within its containing object, or on any active Drop Target object. When the mouse button is released, the Drop Target’s onDrop fires, processes the event, then returns true or false to the initiating drag( ) method.