DraggedObject

Description

Returns a reference to the control that triggered a drag event.

NoteObsolete function You no longer need to call the DraggedObject function in a drag event. Use the event’s source argument instead.

Syntax

DraggedObject ( )

Returns

DragObject, a special datatype that includes all draggable controls (all the controls but no drawing objects). Returns a reference to the control that is currently being dragged.

NoteNo control If no control is being dragged, an execution error message is displayed.

Usage

Call DraggedObject in a drag event for the target object. The drag events are DragDrop, DragEnter, DragLeave, and DragWithin. Use TypeOf to obtain the datatype of the control. To access the properties of the control, you can assign the DragObject reference to a variable of that control’s datatype (see the example).

Examples

Example 1

These statements set which_control equal to the datatype of the control that is currently being dragged, and then set ls_text_value to the text property of the dragged control:

SingleLineEdit sle_which

CommandButton cb_which

string ls_text_value

DragObject which_control


which_control = DraggedObject()


CHOOSE CASE TypeOf(which_control)


CASE CommandButton!

    cb_which = which_control

    ls_text_value = cb_which.Text

CASE SingleLineEdit!

    sle_which = which_control

    ls_text_value = sle_which.Text

END CHOOSE

See also