[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'Grids' (#lcl)

TCustomGrid.DoOPMoveColRow

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

Declaration

Source position: grids.pas line 1047

protected procedure TCustomGrid.DoOPMoveColRow(

  IsColumn: Boolean;

  FromIndex: Integer;

  ToIndex: Integer

);

Arguments

IsColumn

  

True 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

TCustomGrid.MouseUp

  

Handles a mouse up event for the grid control.

TCustomGrid.Columns

  

Definitions for the columns displayed the grid.

TCustomGrid.GridFlags

  

Contains grid-specific state flags active for the control.

TCustomGrid.SortColumn

  

Column number used to sort the rows in the grid.

TCustomGrid.AdjustEditorBounds

  

Updates the selected cell and sets the bounds for the optional cell Editor.

TCustomGrid.ColRowMoved

  

Performs actions when a column or row is moved in the grid.

TCustomGrid.ColumnIndexFromGridColumn

  

Gets the position of the specified column relative to the first column in the grid.

TCustomGrid.VisualChange

  

Updates the grid after changes to the visual properties in the control.

TGridColumns.MoveColumn

  

Moves the column from the first index to the second.

TGridColumn

  

Implements a column definition used for tabular data in TCustomGrid.


Version 4.0 Generated 2025-05-03 Home