allowDrag

Type: Integer

Availability: Read or write at any time

The allowDrag property of the Table class enables rows and columns of a table to be dragged to new positions within the table.

The Table class constants that represent the allowDrag property values are listed in the following table.

Table Class Constant Integer Value Description
AllowDrag_None 0 Neither columns nor rows can be dragged (the default)
AllowDrag_Rows 1 Rows can be dragged
AllowDrag_Columns 2 Columns can be dragged
AllowDrag_Both 3 Rows and columns can both be dragged

Rows and columns can be dragged only if they have fixed rows and fixed columns, respectively.

To drag a row or column, the user:

  1. Clicks on the heading of the fixed column or row that is to be moved.

  2. Drags the selected heading to the new position. The column or row is then inserted in front of the column or row to which it was dragged.

  3. Releases the mouse.

The code fragment in the following example shows the use of the allowDrag property.

table1.allowDrag := Table.AllowDrag_Both;

The Table class queryRowMove or queryColumnMove event method is then called. If neither of these event methods is defined, the move is performed. If these event methods are defined, the move is performed only if a value of true is returned by the events. The move is aborted if a value of false is returned.

By default, clicking on a fixed row or column also causes all non-fixed cells of that row or column to be selected. To avoid this, set the selectMode property to the appropriate value.