TCustomStringGrid.Modified property
Indicates whether the content in the grid cells has been changed.
Declaration
property Modified: Boolean read FModified write FModified;Description
Modified is a
Boolean property which indicates whether
the cell content in the grid control has been changed. Modified is set to
True when the
Cells property is updated and the
SetCells method is called to apply the new value. This occurs when
a cell is edited using a built-in cell editor, or when a value is directly
assigned to the Cells property.
Modified is set to
False when the control is Loaded using
the LCL streaming mechanism.
Methods which use Cells to indirectly assign value(s) also set Modified to True. These include: AssignTo, SelectionSetText, SelectionSetHTML, SetCheckBoxState, SetEditText, LoadContent, Clean, InsertRowWithValues, LoadContent, LoadFromFile, LoadFromStream, LoadFromCSVFile and LoadFromCSVStream.
In contrast, methods which perform row or column operations without changing Cells do not cause the Modified property to be set. These are generally methods from an ancestor class where Modified does not exist, and include: ClearCols, ClearRows, DeleteColRow, DeleteCol, DeleteRow, ExchangeColRow, InsertColRow, MoveColRow, SortColRow, DoOPDeleteColRow, DoOPExchangeColRow, DoOPInsertColRow, and DoOPMoveColRow.
The event handlers signalled from these methods can be used to update the value in Modified, including: OnColRowDeleted, OnColRowExchanged, OnColRowInserted, OnColRowMoved, and OnCompareCells. Or, as an alternative, update Modified from an event handler like OnClick assigned to the control which triggers one of these operations.
Methods which save the grid content do not reset the value in Modified when the operation is completed. These include: SaveContent, SaveToFile, SaveToCSVFile, SaveToStream, and SaveToCSVStream. These actions are triggered by a control in the application, and its OnClick or OnExecute handler can be used to set the value in Modified.
See also
An experiment, built from Lazarus main 2dfa93c66e of 10-22-2026. Not the official Lazarus documentation.
