dragMode

Type: Integer

Availability: Read or write at any time

The dragMode property of the Window class contains the drag mode for a form or control. Any form or control can be dragged and dropped on any other form or control belonging to the application.

This process is initiated by setting the dragMode property of a form or control to DragMode_Drag (1). A default or user-assigned drag cursor is displayed while the drag process is in progress. This process is usually initiated by logic when the user presses the left mouse button over the form or control that is to be dragged. Any form or control of the application over which the mouse cursor moves receives a dragOver event.

The settings for the dragMode property are listed in the following table.

Window Class Constant Value Description
DragMode_None 0 Drag mode not in effect
DragMode_Drag 1 Drag mode
DragMode_Drop 2 Causes the drag process to terminate and generates a dragDrop event

The form or control of the application over which the drag process is terminated receives a dragDrop event. The dragging process is terminated when a left mouseUp or mouseLeave event is received or by logic setting the value of the dragMode property of the dragged form or control to DragMode_Drop (2).

Setting the value of the dragMode property to DragMode_None (0) also aborts the drag process and does not issue a dragDrop event. While dragging is in progress, no normal mouse events are available for logic processing.

The Application class showBubbleHelp property is ignored when dragging is in progress.

The following example shows the use of the dragMode property.

table1_mouseDown(table: Table input; button: Integer;
                 shift: Integer; x: Real; y: Real) updating;
begin
    if button = 1 then
        dragMode := DragMode_Drag;
    endif;
    if button = 2 then
        popupMenu(menuItemAction, x.Integer, y.Integer);
    endif;
    selectedColumn := table.column;
end;

For the ListBox control, the dragListIndex method can also be interrogated during the dragOver and dragDrop events to determine which entry of the list box was involved.

For the Table control, the dragSheet, dragColumn, and dragRow methods can also be interrogated during the dragOver and dragDrop events to determine which sheet and cell of the table was involved.