Sign in Join
FPDoc Onlineexperiment

TCustomGrid.DoOPMoveColRow procedure

Member of TCustomGridprotectedIn unit Grids

Performs a move operation for the column or row at the specified position.

Declaration

pascal
procedure DoOPMoveColRow(IsColumn: Boolean; FromIndex: Integer; 
 ToIndex: Integer)

Arguments

IsColumnTrue if index values are for columns instead of rows.
FromIndex

Ordinal position for a column or a row moved in the method.

ToIndex

Ordinal position where the column or row is relocated in the method.

Description

DoOPMoveColRow is called from the MouseUp method when the mouse button is released during a column or row drag operation.

DoOPMoveColRow ensures that FromIndex and ToIndex contain valid index values for the grid. When FromIndex and ToIndex contain the same value, the drag operation has ended without changing the position for the column or row. In this situation, the grid control is redrawn and no additional actions are performed in the method.

IsColumn determines whether column or row data is affected in the method. When set to True, the index values refer to column positions on the grid. Otherwise, the index values refer to row positions.

Column Movement

Column movements are handled using either the Columns collection or the internal list of column widths maintained in the grid control. When Columns has been enabled, and column order is not locked using GridFlags, the MoveColumn method in the collection is used to move the specified column to its new position.

If Columns have not been defined, the internal column list is used to perform the operation. ColRowMoved is called to perform an event notification (implemented in descendent classes) when the action has been completed.

Row Movement

Row movements are handled using the internal list of row heights in the control. The Move method in in the list is called to relocate the specified row to its new position. ColRowMoved is called to perform an event notification (implemented in descendent classes) when the action has been completed.

DoOPMoveColRow calls AdjustEditorBounds to re-select the active cell and position an active cell editor (when needed). For a column movement, the value in SortColumn is updated to reflect the new position for the sort column.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.