Classes for displaying tabular data as a series of rows and columns.

grids.pas contains classes, types, constants, variables, and routines used to implement grid controls for the Lazarus Component Library (LCL). Classes include:

- TVirtualGrid
- TCustomGrid
- TDrawGrid
- TStringGrid

Original author: Jesus Reyes Aguilar (jesusrmx@yahoo.com.mx) [2002]

Current revision level for the grids.pas file.

1
  Initial revision
2
  Introduced goSmoothScroll grid option
3
  Introduced Col/Row FixedAttr and NormalAttr

Lazarus message for setting the value in a grid edit control.
Lazarus message for getting the value in a grid edit control.
Lazarus message for setting the grid for an edit control.
Lazarus message for setting the bounds for a grid edit control.
Lazarus message for selecting the content in a grid edit control.
Lazarus message for setting the edit mask used in a grid edit control.
Lazarus message for setting the position of a grid edit control.
Lazarus message sent when the grid can display its editing controls.
Lazarus message used to get the grid for an editing control.
Represents the auto-size editor option in a grid message.
Represents the hook key down editor option in a grid message.
Represents the hook key press editor option in a grid message.
Represents the hook key up editor option in a grid message.
Represents the select all content editor option in a grid message.
Represents the implemented editor option in a grid message.
Default width for columns in a grid control.

DEFCOLWIDTH is a constant used as the default width for columns in a grid control. The value for the constant is 64 (pixels). DEFCOLWIDTH is used when getting the value for the DefColWidth in TCustomGrid.

Default width for edit control buttons in a grid.

DEFBUTTONWIDTH is a constant that contains the default width for the button displayed in a grid cell editor. The value for the constant is 25 (pixels). DEFBUTTONWIDTH is used when setting the bounds for TButtonCellEditor controls.

Default padding used for title images displayed in a grid.

DEFIMAGEPADDING is a constant which contains the padding added to images displayed in the fixed title area for grid controls. The value for the constant is 2 (pixels). DEFIMAGEPADDING is used in methods like TCustomGrid.DrawColumnTitleImage and TCustomStringGrid.AutoAdjustColumn.

Default value used as the minimum grid column size.
Default value used as the maximum grid column size.
Default value for SizePriority property in a grid column.
Exception raised when an error has occurred in a Grid class.

Used mainly when a row or a column position is invalid for a grid control.

Represents grip option values available for grid controls.

TGridOption is an enumerated type with values that represent grid options available in LCL grid controls. Values from TGridOption are stored in a TGridOptions set type to indicate that the grid feature or behavior is enabled.

Values from TGridOption are stored in the DefaultGridOptions constant which defines the default set of options for LCL grid controls.

Shows vertical lines around fixed cells.
Shows horizontal lines around fixed cells.
Show vertical lines.
Show horizontal lines.
Enables range selection for grid cells.
Enables focused drawing for selected cell(s).
Allow user to change row height.
Allow user to change column width.
Enables moving the position of an entire row in a grid.
Enables moving the position of an entire column in a grid.
Allows editing in grid cells.
Automatically add new rows.
Does not add rows if the last cell is empty and goAutoAddRowsSkipContentCheck is not set.
Controls Tab key behavior in the grid.

When included in the TCustomGrid.Options property, the Tab key changes the active cell within the grid. When omitted from the grid Options, the Tab key changes to the next active control.

Select the whole row instead of only one cell.
Always shows the cell editor.

Always shows the cell editor. If not set, the user has to enter edit mode by data characters for the cell, or by pressing the F2 key.

Enables tracking of the thumb position in grid scroll bars.
Enable cellextent calculations.
User can see focused cell on goRowSelect.
Double clicking column's borders (on headers) resize column.
Switch scrolling mode.
Default is pixel scroll.
Show row numbers in first fixed column.

The displayed row numbers starts with 1. The row number is displayed when no text has been directly assigned to the fixed cell.

Keeps focused cell visible while scrolling.
Header cells change look when mouse is over them.
Header cells looks pushed when clicked.
Setting grid selection also moves the cell cursor.
Allow to resize fixed columns.
Selecting a partially visible cell will not scroll the grid content.
Show individual cell hints.
Requires the ShowHint to be set to TRUE. If set, the Hint will be ignored. Instead the OnGetCellHint event will be called for each cell.
Truncates cell hints when they are longer than the cell content.
Shows an Ellipsis (...) at the end of truncated cell hints.
Also add a row if last row is empty.
goAutoAddRows
must also be set. Otherwise this option does not take effect at all.
Highlights the current Row in a grid control.
Set type used to store enabled grid options.

TGridOptions is a set type used to store values from the TGridOption enumeration. The features or behaviors in TGridOption are enabled when their enumeration values are included in the set. TGridOptions is the type used for the TCustomGrid.Options property.

Represents grid options introduced in Version 2 of grid controls.
Allows scrolling to last column (so that last column can be leftcol).
Allows scrolling to last row (so that last row can be toprow).
Set type used to store enabled grid options from TGridOption2.
Represents save options available for LCL grid controls.
Enables saving grid structure (col/row count and Options).
Enables saving grid attributes (Font, Brush, TextStyle).
Enables saving Grid content (Text in TStringGrid).
Enables saving the Grid cursor and selection position.
Set type used to store TGridSaveOptions values.
Enumeration with Grid draw state values.

TGridDrawState is an enumeration with values that represent grid drawing states for a grid control. Values in TGridDrawState indicate the display attributes applied to a row, column, or individual cell in a grid control.

TGridDrawState arguments are passed to event handlers and methods in TCustomGrid.

Drawn in its Selected state.
Drawn in its Focused state.
Drawn using the Fixed cell colors.
Drawn using the Hot display attributes.
Drawn in a Pushed state.
Drawn using the row highlighting color.
Enumerated type with grid state values.

TGridState is an enumerated type with values that reflect the state in a grid control. TGridState values represent actions performed using a grid control, rather the display state for rows, columns, and/or cells.

TCustomGrid maintains an internal TGridState member used to track the state for the grid control. Methods in TCustomGrid cause the value in the member to be read or updated to reflect the request and/or completion of an action in the grid control.

Use the TCustomGrid.Options and TCustomGrid.Options2 properties to determine if specific features or behaviors are enabled for a grid control.

Normal state for the grid when navigation or editing can be performed.
Grid is selecting a row, column, or cell after keyboard or mouse activity.
Grid is resizing a row.
Grid is resizing a column.
Grid is moving or dragging a row.
Grid is moving or dragging a column.
A fixed header cell has been clicked in the Grid.
A button in a column has been clicked.
Enumerated type for grid zone values.

TGridZone is an enumeration type with values representing zones in a grid control which are monitored to determine activity and subsequent changes in the grid control state.

Area normally used for cell data (not fixed row or column headers).
Area used for fixed column headers
Area used for fixed row headers
Area for fixed cells (both column and row are fixed).
Area not valid for grid cells.
Set type used to store TGridZone enumeration values.
Enumerated type with values controlling grid auto advance behavior.

TAutoAdvance is an enumerated type with values that represent the auto advance behaviors available in a grid control. TAutoAdvance is the type used to represent the AutoAdvance and TabAdvance properties in TCustomGrid.

Auto advance is not enabled.
Advances down to the next row in the grid.
Advances to the right (next cell) in the grid.
Advances to the left (previous cell) in the grid.
Advances to the right and then to the next row.
Advances to the left and then to the next row.
Advances to the right and then to the previous row.
Advances to the left and then to the previous row.
Range selection modes available in a grid control.
Allows range selection for a single range in a grid.
Allows range selection for multiple ranges in a grid.
Not used in the current LCL implementation.

Not used in the current LCL implementation.

Enumeration with cell editor types available in a grid control.

TColumnButtonStyle is an enumerated type with values that represent the different cell editor types available in a grid control. TColumnButtonStyle is the type used for the TGridColumn.ButtonStyle property, and passed as an argument when an editor is requested for a column definition. It is also used when the TCustomGrid.GetDefaultEditor method is called to get the default cell editor for a given column.

Button style is automatically determined by the grid control. Results in a TStringCellEditor being used for the cell.
Button style with an Ellipsis (...) is displayed as the cell editor. Results in a TCompositeCellEditor being used for the cell.
Indicates no editor is required for a cell.
Indicates a Pick List is used in the grid column. Results in a TPickListCellEditor being used for the cell.
Indicates a CheckBox is displayed as the editor for the grid column.
Indicates a cell editor with a Button is used in the grid column. Causes a TButtonCellEditor to be created.
Indicates a button centered in the cell is used in the grid column.
Enumeration with values that control the display style for fixed title cells.

TTitleStyle is an enumerated type with values that determine the drawing style used for fixed title cells in a grid. TTitleStyle is the type used to implement the TCustomGrid.TitleStyle property, and used in the implementation of the TCustomGrid.DrawCellGrid method.

Titles are displayed using the Lazarus drawing style.
Titles are displayed using the standard drawing style (higher contrast).
Titles are displayed using the drawing style Native to the OS or platform.
Represents state flags used in a grid control.

TGridFlagsOption is an enumerated type with values which reflect temporal state changes in a grid control. Values from TGridFlagsOption are stored at run-time in the TGridFlags set type used for the TCustomGrid.GridFlags property.

Indicates a cell is locked during a cell editor update.
Indicates a selection needs to be active prior to mouse down or move actions.
Indicates a Tab key can be applied to focus the next cell in the grid.
Indicates if Shift+Tab can be used to select the previous cell in the grid.
Indicates visible changes to row or column sizes can be applied to the grid.
Indicates columns in the grid are locked and cannot be reordered.
Indicates editing using a cell editor has been completed.
Indicates a row or column sizing action is in effect.
Indicates the grid is being redrawn.
Indicates the grid is updating its size.
Indicates the client rectangle for the grid has changed.
Indicates a cell editor is being prepared for a newly selected cell in the grid.
Indicates the visibility of scrollbar(s) has been changed for a grid.
Set type used to store TGridFlagsOption enumeration values.

TGridFlags is a set type used to store TGridFlagsOption enumeration values. TGridFlags is the type used to implement the TCustomGrid.GridFlags property.

Enumerated type with sort orders supported in a grid control.

TSortOrder is an enumerated type with values for the sort orders supported in a grid control. TSortOrder is the type used to implement the TCustomGrid.SortOrder property.

Rows are sorted such that the column is in ascending order.
Rows are sorted such that the column is in descending order.
Indicates if accelerator keys in column titles are handled for a grid.
Accelerator keys are ignored in the grid column.
Accelerator keys emulate a mouse click on the column title.
Enumerated type with values that control mouse wheel operation in a grid.
Causes the mouse wheel to move the cursor on the screen.
Causes the mouse wheel to scroll the content in the grid.
Represents the cell hint display priorities.

A grid control can display three types of hint: the default hint (in the Hint property), individual cell hints (using the OnCellHint event), and hints for truncated cells. TCellHintPriority determines how the hint text is determined when multiple hint text values are available for display.

Uses all hints (control and cell hints) including short and long display text values.
Uses all hints except the default hint for the grid control.
Uses the truncated cell hint text.
Identifies the action performed for cell content.

TCellProcessType is an enumerated type with values that identify the action performed for the content in a grid cell. Values in the enumeration indicate whether cell content is copied or pasted in event handlers. TCellProcessType arguments are passed to the TCustomStringGrid.OnCellProcess event handler.

Copies the content in a grid cell.
Pastes content into the grid cell.
All save options available for grid controls.

soAll is a TSaveOptions constant with the set representing all of the TGridSaveOptions values available for a LCL grid control.

Set with the default grid options enabled for instances of the grid control.

DefaultGridOptions is used as the default value for the Options property in TCustomGrid.

Default grid options enabled for version 2 of the grid control.

DefaultGridOptions2 is used as the default value for the Options2 property in TCustomGrid.

Default spacing around rubber band rectangles.
Default padding for the content in grid cells.

Cell padding is the amount of space added around cell values and hints drawn for a grid control. The value represents the number of pixels added to the boundaries at the default display density (96 PPI). The value may be scaled and stored in the varCellPadding variable when a new instance of a grid control is created. varCellPadding contains the padding value actually applied to the values and hints in the control.

Minimum proximity to row or column borders for resizing operations.
Default padding for the rubber banding rectangle in grid cells.
Default padding for the content in grid cells.

Cell padding is the amount of space added around cell values and hints drawn for a grid control. The value represents the number of pixels added to the boundaries at the default display density (96 PPI). The value may be scaled and stored in the varCellPadding variable when a new instance of a grid control is created. varCellPadding contains the padding value actually applied to the values and hints in the control.

Proximity threshold for a mouse click near a column boundary.

Used during grid column resizing when fixed column sizing has been enabled.

Pointer to a TCellProps type.
Contains attributes, data, and text for grid cells.
Attributes for a grid cell.
Data for a grid cell.
Display text for a grid cell.
Pointer to a TColRowProps type.
Contains the size and display attributes for a column or row in a grid.
Not used in the current implementation.
Not used in the current implementation.
Not used in the current implementation.
Pointer to a TGridMessage type.
Contains a LCL message and its auxiliary values.

TGridMessage is a record type with members representing an LCL message passed to cell editors in a string grid. It is passed as an argument to TStringCellEditor methods (msg_SetMask, msg_GetGrid, et. al.) which handle and apply a specific LCL message.

The LCL message value.
Grid for the LCL message.
Grid column for the LCL message.
Grid row for the LCL message.
Cell value for the LCL message.
Rectangle coordinates for the LCL message.
Options for the LCL message.
Implements the default editor for cells in TCustomGrid.

TStringCellEditor is a TCustomMaskEdit descendant that implements the default editor for cells in TCustomGrid. TStringCellEditor contains internal members used to reference its Grid control, and to access the row and column numbers for the underlying grid cell. TStringCellEditor also implements methods needed for LCL message passing using TGridMessage. An event handler is also published to perform actions needed when editing has been completed in the cell editor.

TCustomMaskEdit"
Window handling procedure for the cell editor.
LCL message for the window handling procedure.
Issues a message for specifying mask.
Message for the control.
Issues a message for specifying value.
Message for the control.
Issues a message for obtaining value.
Message for the control.
Issues a message for specifying the grid for the editor.
Message for the control.
Issues a message for Selecting all content in the editor.
Message for the control.
Issues a message for specifying the position for the editor.
Message for the control.
Message used to get the grid control for the cell editor.
Message for the control.
Constructor for the class instance.

Create is the overridden constructor for the class instance. Create calls the inherited constructor using the value in AOwner as an argument. Create sets the value in the AutoSize property to False.

TCustomEdit.AutoSize
Owner of the class instance.
Performs actions needed when the cell editor has finished editing the value in a cell.

EditingDone is an overridden procedure used to perform actions required when the cell editor has finished editing the value in a cell. EditingDone calls the inherited method, and calls the EditingDone method in the attached Grid control (when assigned) for the cell editor.

EditText is a published property in TStringCellEditor.
OnEditingDone is a published property in TStringCellEditor.
The editor used for button cells in a grid.

TButtonCellEditor is a TButton descendant which implements a grid cell editor which uses a button to activate the editor control. TButtonCellEditor maintains interval member variables for the TCustomGrid hosting the editor control. The row and column numbers for the underlying cell in editor control are available in the Row and Col properties. TButtonCellEditor includes methods used to perform LCL message passing using a TGridMessage message type.

Issues a message to specify the grid for the editor.
Issues a message to specifying the bounds for the editor.
Issues a message to specify the position for the editor.
LCL message for the grid control.
Issues a message when the editor is ready.
LCL message for the grid control.
Issues a message to get the grid control for the button cell editor.
LCL message for the grid control.
Column number for the grid cell editor.

Col is a public read-only Integer which contains the column number for the cell hosting the editor control.

Use Row to access the row number for the cell hosting the editor control.

Row number for the grid cell editor.

Row is a public read-only Integer which contains the row number for the cell hosting the editor control.

Use Col to access the column number for the cell hosting the editor control.

Implements a cell editor control which displays a Pick List.

TPickListCellEditor is a TCustomComboBox descendant which implements a cell editor control that displays a Pick List. TPickListCellEditor provides overridden methods to alter the behavior of the TCustomComboBox ancestor.

TPickListCellEditor has an internal member used to store the TCustomGrid for the cell editor. In addition, the Row and Column numbers for the underlying cell are stored in internal members. TPickListCellEditor provides methods needed to implement LCL message passing using the TGridMessage message type.

Notifies the Grid control when the value for the cell editor has been changed.

Change is an overridden method used to perform actions needed when the value for the control has been changed. In TPickListCellEditor, it ensures that the grid control is notified when the value in the cell editor has been changed.

Changed calls the inherited method to signal the OnChange event handler (when assigned).

TCustomComboBox.Change
Issues a message to find the value for the editor.
LCL message for the grid control.
Issues a message to specify the grid for the editor.
LCL message for the grid control.
Issues a message to specify the value for the editor.
LCL message for the grid control.
Issues a message to specify the position for the editor.
LCL message for the grid control.
Issues a message to get the grid control for the editor.
LCL message for the grid control.
A single item on which a Composite cell editor operates.
The Editor to be used for this item.
How this item is aligned.
Returns True if this item is part of an active control.
A general purpose editor for cells in a grid.
Issues a message to get the value for the editor.
Issues a message to specify grid for the editor.
Issues a message to specify the value for the editor.
Issues a message to specify the bounds for the editor.
Issues a message to specify the mask for the editor.
Issues a message to Select all content in the editor.
Issues a Control Message for a change in a control.
Issues a message to specify the position for the editor.
Handles the message to get the Grid control for the composite cell editor.
Grid message handled in the method.
Gets the editor marked as the active control for the composite cell editor.
TWinControl descendant that is the editor for an active control.
Transmits the specified character and returns an integer status result.
0 - failure, 1 - success
Sets the value for the Color property.

Overridden in TCompositeCellEditor to ensure that the new color value is also applied to the ActiveControl property (when assigned).

TControl.Color
New value for the Color property.
Destructor for the class instance.

Frees the internal list of TEditorItem instances, and calls the inherited destructor.

Sets the position for the single editor in the composite control.

Overridden in TCompositeCellEditor to apply control alignment for the single control used in the composite editor. No provisions are made for calling CustomAlignInsertBefore() or sharing space with other editors in the control.

CustomAlignPosition does not call the inherited method.

TWinControl.CustomAlignPosition
Adds the specified Editor with the given alignment and specified ActiveControl.
Indicates if the composite control and one of its editors are focused.
True when the control and one of its editors are focused.
Maximum length for the value in the composite editor control.

The property value contains the maximum length from the TCustomEdit control in ActiveControl. Changing the value for the property causes the MaxLength property in the TCustomEdit control to be updated.

Contains the active control in use in one of the editors for the composite control.
Defines the event handler signalled to draw a cell a grid control.
Grid control for the event notification.
Column number to draw in the event handler.
Row number to draw in the event handler.
Rectangle to draw in the event handler.
Grid drawing state used in the event handler.
Specifies the event handler signalled when a cell is selected in a grid control.

TOnSelectCellEvent specifies the event handler signalled when a cell is selected in a custom-drawn grid control. TOnSelectCellEvent is the type used to implement the OnSelectCell in TCustomDrawGrid.

Control for the event notification.
Column number for the selection notification.
Row number for the selection notification.
Set to True if the specified cell can be selected.
Specifies an event handler signalled for a selection in a grid control.

TOnSelectEvent specifies an event handler signalled when a selection is made in a grid control. TOnSelectEvent is the type used to implement event handler properties in TCustomGrid, including:

- OnAfterSelection
- OnBeforeSelection
- OnButtonClick
- OnSelection

Applications must implement an object procedure using the signature for the event handler to respond to the event notification.

Control generating the event notification.
Column number for the selection.
Row number for the selection.
Event handler signalled when rows or columns are added, deleted or moved in a grid.

TGridOperationEvent specifies an event handler signalled when rows or columns are added, deleted or moved in a custom-drawn grid control. TGridOperationEvent is the type used to implement event handler properties in TCustomDrawGrid, including:

- OnColRowDeleted
- OnColRowExchanged
- OnColRowInserted/
- OnColRowMoved

Applications must implement an object procedure using the signature for the event handler to respond to the event notification.

Control for the event notification.
True when the notification is for a column and not a row.
Starting index position for the row or column.
Final index position for the row or column.
Specifies an event handler signalled when an event occurs in a fixed header cell.

THdrEvent specifies an event handler signalled when an event occurs in a column header. Arguments passed to the event handler indicate whether the action occurred for a column or a row header, and the index position for the row or column.

THdrEvent is the type used to implement the OnHeaderClick and OnHeaderSized properties in TCustomDrawGrid. Applications must implement an object procedure using the event signature to respond to the event notification.

Control generating the event notification.
True if the event applies to a column header; False when a row header is affected.
Index position for the row or column in the event notification.
Specifies an event handler signalled to compare cell values.

TOnCompareCells specifies an event handler signalled to compare the cells at the coordinates in ACol, ARow, BCol, and BRow. ACol and ARow are the column and row numbers for the first value in the comparison. BCol and BRow are the column and row number for the second value in the comparison.

Result is a variable Integer argument used to return the relative sort order for the compared values. The event handler must perform the actions needed to compare the cell values, and set the value in Result accordingly. Result should contain the following values:

-1
  The cell value at ACol, ARow occurs before the value at BCol, BRow
0
  The compared cells contain the same values
1
  The cell value at ACol, ARow occurs after the cell value at BCol, BRow

TOnCompareCells is the type used to implement the OnCompareCells in TCustomGrid.

Relative sort order for the compared values.
Control generating the event notification.
Column number for the first compared cell value.
Row number for the first compared cell value.
Column number for the second compared cell value.
Row number for the second compared cell value.
Specifies an event handler signalled to get an editor control for the specified cell.

TSelectEditorEvent specifies an event handler signalled to get an editor control for the cell at the coordinates in ACol and ARow.

Editor is the TWinControl or descendent class instance to use as the cell editor for the given cell.

TSelectEditorEvent is the type used to implement the OnSelectEditor in TCustomGrid. Applications must implement an object procedure using the event signature to respond to the event notification.

Control generating the event notification.
Column number for the cell editor.
Row number for the cell editor.
Editor control to use for the specified cell.
Specifies an event handler signalled when preparing the canvas for a grid control.

TOnPrepareCanvasEvent specifies an event handler signalled when the canvas for a grid control is prepared for rendering. TOnPrepareCanvasEvent allows the canvas for the grid control to be altered prior to rendering cell data.

Sender is the grid control triggering the event notification.

ACol and ARow are the column and row numbers (respectively) for the grid cell in the event notification.

AState contains the grid drawing state for the cell data.

TOnPrepareCanvasEvent is the type used to implement the OnPrepareCanvas in TCustomGrid. Applications must implement an object procedure using the event signature to respond to the event notification.

Grid control for the event notification.
Column number for the cell in the event notification.
Row number for the cell in the event notification.
Grid drawing state for the cell in the event notification.
Specifies an event handler signalled to get the user-supplied bitmap for a check box cell.

TUserCheckBoxBitmapEvent is the type used for the OnUserCheckboxBitmap property in TCustomGrid.

Object (TCustomGrid) for the event notification.
Column number for the cell with the check box.
Row number for the cell with the check box.
Checked state for the check box.
Bitmap image with the state needed for the check box cell.
Specifies the event handler used to get the image drawn for a Checkbox column.

TUserCheckBoxImageEvent specifies an event handler signalled to get the image drawn for a grid cell which displays a Checkbox.

Sender is the grid control generating the event notification.

ACol and ARow are the column and row numbers (respectively) for the cell where the Checkbox is drawn.

CheckedState indicates whether the Checkbox is drawn using the Checked state.

ImageList contains the images used for the Unchecked and Checked states.

ImageIndex indicates the image in ImageList used for the drawing operation.

TUserCheckBoxImageEvent is the type used to implement the OnUserCheckboxImage in TCustomGrid. Applications must implement an object procedure using the event signature to respond to the event notification.

Grid generating the event notification.
Column number for the cell.
Row number for the cell.
State for the check box.
Image list with unchecked and checked images.
Position of the image in ImageList to use for the check box cell.
Specifies the event handler used to validate the content in a grid cell.

TValidateEntryEvent specifies an event handler used to validate the content in a grid cell. TValidateEntryEvent is the type used to implement the OnValidateEntry in TCustomGrid. Applications must implement an object procedure using the event signature to respond to the event notification.

Grid generating the event notification.
Column number for the cell.
Row number for the cell.
Value checked in the event handler.
Value returned from the event handler.
Specifies an event handler signalled when the value in a CheckBox cell is changed.

TToggledCheckboxEvent specifies an event handler signalled when the value in CheckBox-style cell is changed in a grid. Arguments passed to the event handler identify the grid control for the event notification, the row and column numbers for the altered cell, and the state for a CheckBox cell editor.

TToggledCheckboxEvent is the type used to implement the OnCheckboxToggled in TCustomGrid and descendent classes. Applications must implement an object procedure using the signature for the event handler to respond to the event notification.

Grid control for the event notification.
Column number for the altered cell.
Row number for the altered cell.
State for the CheckBox in the associated cell editor.
Specifies an event handler signalled when a fixed cell header in a grid is resized.

THeaderSizingEvent specifies an event handler signalled when a fixed cell header in a grid is resized. Arguments passed to the event handler identify the grid control for the event, and information the row or column affected by the operation.

THeaderSizingEvent is the type used to implement the OnHeaderSizing property in TCustomDrawGrid. Applications must implement an object procedure using the signature for the event to allow responding to the event notification.

Grid control for the event notification.
True when the affected cell is a column header; False when it is a row header.
Position of the row or column in the grid control.
Size (in pixels) for the resized cell.
Specifies an event handler used to process the value in a grid cell.

TCellProcessEvent specifies an event handler used to process the value in a grid cell in TCustomStringGrid. Arguments to the event handler identify the grid generating the event notification, the row and column numbers for the affected cell, and the value for the cell after processing. The processType argument specifies whether aValue is copied from or pasted to the cell.

TCellProcessEvent is the type used to implement the OnCellProcess in TCustomStringGrid. Applications must implement an object procedure using the signature for the event handler to respond to the event notification.

Grid control generating the event notification.
Column number for the cell in the event notification.
Row number for the cell in the event notification.
Process to perform on the cell value.
Value for the cell after processing has been applied.
Event used to get cell hints.

TGetCellHintEvent is an object procedure type used to get a hint for a string grid cell. TGetCellHintEvent is the type used for the OnGetCellHint property in TCustomGrid.

Arguments passed to the procedure can be used to determine the content in HintText displayed as the cell hint.

The grid for the notification.
Column index for the notification.
Row index for the notification.
Text displayed as hint for the cell.
Specifies an event handler used to load/save the configuration for a grid column.

TSaveColumnEvent is the type used to implement the OnLoadColumn and OnSaveColumn properties in TCustomGrid.

Grid for the event notification.
Column object for the event notification.
Index of the column in the grid.
XML configuration file for the column information.
Grid version for the event.
Path expression in the configuration file the column.
Implements a grid with metadata where rows and columns are stored as Pointer arrays.

TVirtualGrid is a class used to represent a grid where the rows and columns containing grid metadata are stored as arrays of Pointers. Data stored in the grid includes the Size for data in a cell, and pointers to attributes for fixed and normal cell display.

TVirtualGrid is the type used for an internal member in TCustomDrawGrid.

Gets the value for the indexed Celda property.
Value for the property.
Column number for the cell value.
Row number for the cell value.
Gets the value for the indexed Rows property.
Value for the property.
Row number for the property value.
Gets the value for the indexed Cols property.
Value for the property.
Column number for the property value.
Sets the value for the indexed Celda property.
Column number for the cell value.
Row number for the cell value.
Pointer to the properties for the cell.
Sets the value for the indexed Rows property.
Row number for the property value.
Pointer to the properties for the row.
Sets the value for the ColCount property.
New value for the property.
Sets the value for the RowCount property.
New value for the property.
Sets the value for the indexed Cols property.
Column number for the properties stored in the method.
New value for the property.
Destroys an Item at the given Row and Column location.

Performs actions needed to free the Item at the specified column and row numbers.

Item is a Pointer to the column/row properties for the cell at the coordinates in Col and Row. No actions are performed in the method when Item is unassigned (contains Nil).

Sender contains the object instance for the column, row, or cell affected in the method. Calls the DisposeColRow method when Sender is for a column or row array. Calls DisposeCell when Sender contains a pointer to another object class.

The value in Item is set to Nil prior to exiting from the method.

doDestroyItem is the default handler assigned to the OnDestroyItem event handler for the cell, column and row arrays used in the virtual grid.

Column, row, or cell properties affected in the method.
Column number freed in the method.
Row number freed in the method.
Pointer to the column, row, or cell properties freed in the method.
Creates a new item at the location specified by Col and Row.
Removes either a column or a row in the grid.
Moves either a column or a row using the specified index positions.
Exchanges values for the current column or row with those at the specified position.
Disposes of the resources and the pointer for the given cell.
Disposes of the specified row or column, and frees its pointer.
Indicates if the specified ordinal column number is valid for the grid.
True if the index is valid for the grid.
Ordinal column number examined in the method.
Indicates if the specified ordinal row number is valid for the grid.
True if the index is valid for the grid.
Ordinal row number examined in the method.
Constructor for the class instance.

Create is the overridden constructor for the class instance, and calls the inherited method on entry.

Create allocates TPointerPointerArray resources needed for the column, row, and cell arrays used in the class instance. OnDestroyItem and OnNewItem event handlers in the array classes are set to the doDestroyItem and doNewItem methods in the class instance.

Creates sets the default values for the RowCount and ColCount properties to 4 (for both).

TObject.Create
Destructor for the class instance.

Destroy is the overridden destructor for the class instance. Destroy calls Clear to free content in the internal cell, column, and row arrays used in the class instance. Resource allocated to the cell, row, and column arrays are freed. The row and column counts for the virtual grid are reset to 0 (zero).

Destroy calls the inherited destructor prior to exiting from the method.

TObject.Destroy
Clears the content in the virtual grid.

Clear is a method used to remove the content in the virtual grid. Clear ensures that values in the cell, column, and row arrays used in the class instance are cleared. Values in the ColCount and RowCount properties are reset to 0 (zero).

Gets the default values for a new cell added to the grid.

GetDefaultCell is a PCellProps function used to get the default values for a new cell added to the grid. GetDefaultCell calls New to allocate resources for the PCellProps instance in the return value. Nil values are explicitly assigned to the Text and Attr members in the new instance.

GetDefaultCell is called when a value is assigned to a cell in the Celda property and its PCellProps instance has not already been allocated.

Pointer to the cell properties with the default values for a cell.
Gets a pointer to the default values used in a new column and row properties instance.

Used in the implementation of the doNewItem method called when a new column row is added to the virtual grid.

Pointer to the PColRowProps allocated in the method.
Number of columns defined for the grid.

ColCount is an Integer property which indicates the number of columns defined for the grid. When a new value for the property is specified, the internal arrays used for column and cell properties are resized to the length in the property value.

Number of rows defined for the grid.

RowCount is an Integer property which contains the number of rows defined for the grid. When setting a new value for the property, the internal arrays used for rows and cells are resized to the length in the new property value.

Provides indexed access to cell properties by their column and row numbers.
Celda
is an indexed PCellProps property which provides access to the data, attributes, and text for a given cell. Values are accessed by their column and row numbers. Setting a new value for the indexed property causes an existing cell to be freed from the internal cell array (when assigned) by calling DisposeCell.
Column number for the cell.
Row number for the cell.
Provides indexed access to column properties by their ordinal column number.
Column number to access in the grid.
Provides indexed access to row properties by their ordinal row number.
Row number to access in the grid.
Inserts either a column or a row at the specified index position.
True to insert a column at the given position, False for a row.
Position where the column or row is inserted.
Provides properties and methods need to represent a column title in a grid.

TGridColumnTitle is TPersistent descendant used to represent properties and methods for the title for a column in a grid. Use the published properties in the class to access the layout and display attributes for the column title, including:

- Alignment
- Color
- Font
- ImageIndex
- ImageLayout
- Layout
- MultiLine
- PrefixOption

Use the Caption to read or write the text displayed as the title for a grid column.

Use the Column to read the column reference (assigned in the constructor for the class instance) to which the column title is attached.

TGridColumnTitle is the type used to implement the TGridColumn.Title property.

Updates the column for when font for the title has changed.
Class generating the notification.
Gets the value for the Alignment property.
Value for the property.
Gets the value for the Caption property.
Value for the property.
Gets the value for the Color property.
Value for the property.
Gets the value for the Font property.
Value for the property.
Gets the value for the Layout property.
Value for the property.
Indicates if the Alignment is stored when saving the component.

IsAlignmentStored indicates if the Alignment is used for the component. IsAlignmentStored contains True when the Alignment has been assigned (is not Nil) for the class instance.

It is used in the TCustomGrid.SaveColumns method. It is also used as the storage specifier for the Alignment as used in LCL component streaming.

True if Alignment is available for the column title.
Indicates if the Caption is available in the component.
True when Caption is available for the column title.
Indicates if the Color is assigned for the column title.
True when Color has been assigned
Indicates if the Font has been assigned for the column title.
True when Font has been assigned in the column title.
Indicates if the Layout has been assigned in the column title.
True when the Layout has been assigned in the column title.
Sets the value in the Alignment property.
New value for the property.
Sets the value in the Color property.
New value for the property.
Sets the value in the Font property.
New value for the property.
Sets the value in the Layout property.
New value for the property.
Indicates if the Font contains a default value.

IsDefaultFont is a read-only Boolean that indicates if the Font contains a default value. The value in IsDefaultFont is set to False when a new value is assigned to the Font property.

Returns the default caption for the column title.
Default value for the Caption property.
Returns the default alignment for the column title.
Default value for the Alignment property.
Returns the default color for the column title.
Default value for the Color property.
Returns the default layout for the column title.
Default value for the Layout property.
Gets the persistent object which owns the class instance.
TPersistent
Persistent object which owns the class instance.
Specifies the caption used for the column title.
New value for the property.
Specifies which properties in the persistent object are used during LCL component streaming.

DefineProperties is an overridden method used to define the properties which are included during LCL component streaming. The TFiler instance in Filer is used to set the read and write procedures for specific properties. In TGridColumnTitle, the Caption is written when it has an explicit non-default value. This implements the storage specifier declared for the property.

TFiler instance used to read and write the class during LCL streaming.
Constructor for the class instance.

Create is the virtual constructor for the class instance. Create calls the inherited constructor, allocates resources, and sets the default values for members in the class instance.

Create calls the FillTitleDefaultFont method to get the default value used in the Font property. It can contain either the font for titles in the Grid instance or the font for the Column definition; preference is given to the value in the Grid.

Create assigns the FontChanged method as the OnChange event handler for the Font property.

TheColumn contains contains the TGridColumn instance where the column title is used.

TObject.Create
Column class instance where the column title is used.
Destructor for the class instance.

Destroy is the overridden destructor for TGridColumnTitle. It frees resource allocated for properties like Font, Alignment, Color, Caption, and Layout. It calls the inherited destructor prior to exiting from the method.

TPersistent.Destroy
Copies property value from the specified persistent object into the current class instance.

Assign is an overridden method used to implement object persistence for the class. When Source is a TGridColumnTitle instance, the values from the following properties are copied:

- Alignment
- Layout
- Caption
- Color
- Font
- ImageIndex

If Source is not derived from TGridColumnTitle, the inherited method is called using Source as an argument.

TPersistent
Persistent object with property values copied in the method.
Stores the default font used for the column title.

When Grid has been assigned, the TitleFont property from the Grid is used in the Font property. Otherwise, the Font from the Column is used. IsDefaultFont is set to True in the method.

Corrects the design-time PPI for the column title.

FixDesignFontsPPI is a procedure used to correct the design-time Pixels Per Inch setting for the component. Pixels Per Inch for Fonts is not saved in LFM files, and the design-time setting may differ from the run-time setting on a target machine. This adversely affects font scaling.

FixDesignFontsPPI calls the DoFixDesignFontPPI method in the Grid control for the column to adjust the font PPI to the value specified in ADesignTimePPI.

TControl.DoFixDesignFontPPI
Design-time display density applied in the method.
Scales font sizes in the class instance to the specified display density.

ScaleFontsPPI is an overridden procedure used to scale the size for the fonts in the Grid and Title properties to the specified display density (PPI) (Pixels Per Inch).

AToPPI contains the value assigned to the fonts used when a non-zero value is specified.

If AToPPI is omitted, the scaling factor in AProportion is used to adjust the existing PPI setting in the fonts by the indicated factor.

ScaleFontsPPI is called when the AutoAdjustLayout method is used to apply a layout policy to a control.

Explicit Pixels per Inch setting for the fonts.
Scaling factor applied to the existing PPI setting for the fonts.
Returns True if the column title uses the default property values.

IsDefault is a Boolean function used to determine if the column title uses the default values assigned when the class instance was created. The return value is True when all of the following conditions are met:

- Alignment is Nil (unassigned).
- Caption is Nil (unassigned).
- Color is Nil (unassigned).
- Layout is Nil (unassigned).
- ImageIndex is 0 (zero).
- ImageLayout is blGlyphRight.
- IsDefaultFont returns True.

IsDefault is when the coloumns for the parent grid are streamed using the LCL component streaming mechanism. Columns which contain default values (including the title) are not written during component streaming.

True if the column title uses the default property values.
The Column to which the title applies.
The Alignment (whether justified or centered) for the column title.
The Caption for the column title.
The Color for the column title.
The Font for the column title.
The index for the image used in the title (default=0, i.e. no image).
The layout used for any image in the column title.
The layout used for the text in the column title.
Indicates if the column title can be displayed as multiple lines.

MultiLine is a Boolean that indicates if the column title can be displayed as multiple lines. The default value for the is False. Changing the value in MultiLine cause the ColumnChanged method for the TGridColumn class instance to be called.

Indicates if accelerator keys are used in the column title.

PrefixOption is a TPrefixOption that indicates if accelerator keys are recognized and displayed in the column title. The default value for the is poNone, and indicates Accelerator keys are ignored for the column title. Changing the value in PrefixOption causes the ColumnChanged method for the TGridColumn class instance to be called.

Implements a column definition used for tabular data in TCustomGrid.

TGridColumn is a TCollectionItem descendant which implements a column definition for grid controls. TGridColumn contains properties which control the appearance, layout, and editing behavior used for a column in TCustomGrid and descendent classes. For instance:

- Alignment
- ButtonStyle
- Color
- DropDownRows
- Font
- Layout
- MinSize
- MaxSize
- PickList
- ReadOnly
- Width
- Visible
- ValueChecked
- ValueUnchecked

The column has an associated TGridColumnTitle class instance in Title that defines the fixed cell header displayed for the column. As a convenience, the column includes a reference to the TCustomGrid which uses the column definition.

Instances of TGridColumn are created by and stored in the TGridColumns collection class. Use the methods in TGridColumns to create, access, and maintain the items in the collection.

Performs actions needed when the Font has been changed for the grid column.

FontChanged is a procedure used to perform actions needed when the Font for the grid column has been changed. For TGridColumn, it sets the value in IsDefaultFont to False and calls the ColumnChanged method.

Class instance generating the notification.
Gets the value for the Alignment property.
Value for the property.
Gets the value for the Color property.
Value for the property.
Gets the value for the Expanded property.
Always returns True in the current implementation.
Value for the property.
Gets the value for the Font property.
Value for the property.
Gets the value for the Grid property.
Value for the property.
Gets the value for the Layout property.
Value for the property.
Gets the value for the MaxSize property.
Value for the property.
Gets the value for the MinSize property.
Value for the property.
Gets the value for the SizePriority property.
Value for the property.
Gets the list of strings in the picklist.
Value for the property.
Gets the value for the ReadOnly property.
Value for the property.
Gets the value for the Visible property.
Value for the property.
Gets the value for the Width property.
Value for the property.
Indicates if the Alignment is used for the class instance.
True when Alignment has been assigned in the class instance.
Indicates if the Color is used in the class instance.
True when Color has been assigned in the class instance.
Indicates if the Font has been assigned for the column.
True when Font has a value other than the default font.
Implements the storage specifier for the ImageLayout property.
True when the property member contains a value other than Nil.
Implements the storage specifier for the MinSize property.
True when the property member contains a value other than Nil.
Implements the storage specifier for the MaxSize property.
True when the property member contains a value other than Nil.
Implements the storage specifier for the ReadOnly property.
True when the property member contains a value other than Nil.
Implements the storage specifier for the SizePriority property.
True when the property member contains a value other than Nil.
Implements the storage specifier for the Visible property.
True when the property member contains True.
Implements the storage specifier for the Width property.
True when the property member contains a value other than Nil.
Sets the value in the Alignment property.
New value for the property.
Sets the value in the ButtonStyle property.
New value for the property.
Sets the value in the Color property.
New value for the property.
Sets the value in the Expanded property.
New value for the property.
Sets the value in the Font property.
New value for the property.
Sets the value in the Layout property.
New value for the property.
Sets the value in the MaxSize property.
New value for the property.
Sets the value for the MinSize property.
New value for the property.
Sets the value for the PickList property.
New value for the property.
Sets the value for the ReadOnly property.
New value for the property.
Sets the value for the SizePriority property.
New value for the property.
Sets the value for the Title property.
New value for the property.
Sets the value for the Visible property.
New value for the property.
Sets the value for the Width property.
New value for the property.
Copies property values from the specified persistent object to the current class instance.

Assign is an overridden method in TGridColumn. It implements the object persistence mechanism from the FPC RTL. Assign copies property value from the persistent object in Source into the current class instance.

When Source is derived from TGridColumn, the following properties are copied in the method:

- Alignment
- ButtonStyle
- Color
- DropDownRows
- Font
- Layout
- MinSize
- MaxSize
- PickList
- ReadOnly
- SizePriority
- Title
- Width
- Visible

If Source is not derived from TGridColumn, the inherited Assign method is called.

TPersistent.Assign
Persistent object with properties copied in the method.
Gets the default value for the Alignment property.

GetDefaultAlignment is a TAlignment function used to get the default value for the Alignment property in the grid column.

GetDefaultAlignment uses the value in ButtonStyle to determine the alignment needed for the grid column instance. When ButtonStyle contains cbsCheckboxColumn or cbsButtonColumn, the alignment is set to taCenter. Otherwise, the alignment is set to taLeftJustify.

GetDefaultAlignment is called when reading the value for the Alignment property, and the value in the property member has not been assigned (contains Nil). It is also called when setting a new value in Alignment, and determines whether the property member needs to be re-allocated for the modified value.

TAlignment instance with the default alignment for the grid column.
Gets the default value for the Color property.

GetDefaultColor is a TColor function used to get the default value for the Color property in the grid column. The return value is set to the Color property in Grid, when it has been assigned. When Grid contains Nil, the value clWindow is used as the return value.

GetDefaultColor is called when reading the value for the Color property, and the property has not been assigned. It is also called when setting a new value in Color, and determines whether the property member is re-allocated for the new value.

Default value for the Color property in the grid column.
Default layout used for text in the grid column.

GetDefaultLayout is a TTextLayout function used to get the default value for the Layout property in the grid column. The return value is always tlCenter in TGridColumn.

GetDefaultLayout is called when reading the value for the Layout property, and an explicit value has not been assigned for the property. It is also called when setting a new value in Layout, and determines whether the property member is re-allocated for the new value.

Default value for the Layout property.
Gets the default value for the MaxSize property.

The return value is always 200 in TGridColumn.

GetDefaultMaxSize is called when read or writing the value for the MaxSize property, and an explicit value has not already been assigned for the member.

Default value for the MaxSize property.
Gets the default value for the MinSize property.
Default value for the MinSize property.
Gets the default value for the ReadOnly property.
Default value for the ReadOnly property.
Gets the default value for the SizePriority property.
Default value for the SizePriority property.
Gets the default value for the Visible property.
Default value for the Visible property.
Gets the default value for a checked cell in the grid column.
Default value for a checked cell in the grid column.
Gets the default value for an unchecked cell in the column.
Default value used for an unchecked cell in the grid column.
Gets the default value for the Width property.
Default value for the Width property.
Performs actions needed when a column in the grid is changed.

Calls Changed to update the current column instance in the Columns collection. The internal flag used to track changes to the column width is reset after updating the collection item.

Method used to indicate that all columns in the collection have been changed.
Creates a column title used for the grid column.
TGridColumnTitle instance created in the method.
Sets the value for the Index property.

SetIndex is an overridden method in TGridColumn used to set the value for the inherited Index property. When the property value is changed, and Grid is assigned, columns in the grid control are re-ordered to reflect their new value for the column (when needed). The inherited method is called to apply the new property value prior to exiting from the method.

TCollectionItem.Index
New value for the Index property.
Indicates if the default font is in use for the grid column.
Constructor for the class instance.

Create is the constructor for TGridColumn. Create calls the inherited Create method using ACollection as the owner for the collection item.

Create allocates resources needed for members in the class instance, and sets the default values for properties such as: Title, Font, IsDefaultFont, ButtonStyle and DropDownRows.

TCollectionItem.Create
Collection which owns the collection item.
Destructor for the class instance.

Destroy is the overridden destructor for the class instance. Destroy ensures that resources allocated for members in the class instance are freed (when needed), including:

- Alignment
- Color
- Visible
- ReadOnly
- Width
- Layout
- MaxSize
- SizePriority
- MinSize
- ValueChecked
- ValueUnchecked
- PickList
- Font
- Title

Destroy calls the inherited destructor prior to exiting from the method.

TCollectionItem.Destroy
Sets the Font to the value used in the grid control.

When Grid has been assigned, its Font is used in the column instance. The TFont value is assigned to the Font property, and IsDefaultFont is set to True.

FillDefaultFont is called from the FontChanged method in TGridColumns.

Corrects the design-time PPI for the column title.

FixDesignFontsPPI is a procedure used to correct the design-time Pixels Per Inch setting for the component. Pixels Per Inch for Fonts is not saved in LFM files, and the design-time setting may differ from the run-time setting on a target machine. This adversely affects font scaling.

FixDesignFontsPPI calls the DoFixDesignFontPPI method in the Grid control to adjust the font PPI to the value specified in ADesignTimePPI.

TControl.DoFixDesignFontPPI
Design-time display density applied in the method.
Scales fonts on the column and the grid control using a scaling factor.
True if the column is the default column in the grid.
The Grid to which this column belongs.
Default width for the column, or -1 when not assigned.

DefaultWidth is a read-only Integer property with the default width used for the column. The property value is read from the DefaultColWidth property in the Grid control (when assigned). If it is not assigned, the property value is -1.

Contains the explicit, non-default value assigned to the Width property.

StoredWidth is a read-only Integer property with an explicit value assigned to the Width property for the column. If an explicit value has not been assigned in Width, the property value is -1.

True when the width for the column has been changed.
Whether the column is justified, centered, etc.
The style used for a button displayed in the column.
Color used for the column.
The number of rows in the drop-down list used in the column.
Whether the column has been Expanded.
The Font for the column.
The Layout for text.
The minimum size for the column.
The maximum size for the column.
The list of items that can be selected as the value for the column.
True when the values in the column cannot be changed.
The auto-sizing priority for the column.
Contains a Pointer to an Integer type.

Tag is a PtrInt property which contains a numeric value. Its usage is implementation dependent.

Text displayed as the column title.
The Width of the column.
True if the column is visible (i.e. not hidden).
Gets the checked value for a cell in the column.
Gets the unchecked value for a cell in the column.
Value used for a checked cell in the column.
Value used for an unchecked cell in the column.
Stores data about rows and columns used in a TCustomGrid class instance.

TGridPropertyBackup is a record type used to store data about rows and columns, including fixed cells. Used internally in a TCustomGrid class instance.

Indicates if the grid contains valid row or column counts.
Number of fixed rows in the grid.
Number of fixed columns in the grid.
Number of rows in the grid.
Number of columns in the grid.
Collection used to store column definitions for a grid control.

TGridColumns is a TCollection descendant that implements a container for column definitions used in TCustomGrid and descendent classes. TGridColumns is the type used to implement the Columns in TCustomGrid.

TGridColumns is used to create, access, and maintain TGridColumn class instances representing the columns in a grid. Use the indexed Items to access a TGridColumn instance in the collection using its ordinal position.

Additional properties and methods are included in the collection that are relevant to their use with grid column definitions. A reference to the TCustomGrid which owns the collection is maintained to provide access to the properties, methods, and events in the grid.

Gets the value for the indexed Items property.
Collection the collection item at the specified position.
Ordinal position for the requested collection item.
Gets the value in the Enabled property.
Value for the property.
Sets the item at the specified position in the Items property.
Ordinal position for the collection item updated in the method.
Value stored at the specified position in the collection.
Gets the value for the VisibleCount property.
Value for the property.
Notifies the Grid using the collection when a column is updated.
TCollection
Collection item requiring the update notification.
Performs action needed when the title font is changed for items in the collection.

TitleFontChanged is a procedure used to perform actions needed when the title font for a grid has been changed. TitleFontChanged examines each of the column definitions in the collection, and updates the default font for the column when it has not been set to another value. TitleFontChanged is called during execution of the OnTitleFontChanged event handler in TCustomGrid.

Performs actions needed when the Font for the grid control is changed.

FontChanged is an overridden method used to perform actions needed when the Font for the grid control has been changed.

FontChanged ensures that the font used for the Canvas is updated to use the value in Font when csCustomPaint is included in the ControlState flags.

Otherwise, the inherited method is called to signal the change in the Font property. The FontChanged method in the Columns collection is also called (when enabled). The new Font is assigned to TitleFont and TitleFontIsDefault is reset to True.

TCustomControl.FontChanged TControl.ControlState TControl.Font
Removes the specified column number from the collection.
Ordinal position of the column to remove in the method.
Moves the column from the first index to the second.
Original position for the column moved in the method.
New position for the column moved in the method.
Exchanges the positions for the specified columns.
Position of a column exchanged in the method.
Position of the other column exchanged in the method.
Inserts a column at the specified index position.
Position in the collection where the column is inserted.
Constructor for the class instance.

Create is the constructor for the class instance, and calls the inherited method on entry using aItemClass as the class type for new items added to the collection. Create stores the value in AGrid to the Grid property.

TCollection.Create
Grid which owns the collection of column definitions.
Class reference used to create new items in the collection.
Creates a new ItemClass instance with the collection as its owner.

Add is an overridden method used to create a new collection item using the ItemClass class type for the collection. The new class instance has the collection as its owner. Add re-implements the method from the ancestor class.

Use Insert or InsertColumn to create a new collection item and store it at a specified position in the collection.

TCollectionItem TCollection.Add TCollection.Insert TCollection.ItemClass
TGridColumn instance added to the collection.
Clears all items in the collection.

Clear calls BeginUpdate to suppress notifications when items are removed from the collection. It also calls EndUpdate when all items have been removed in the method. Clear calls the inherited method to remove the items in the collection.

TCollection.Clear
Gets the grid column in the collection with the specified title.

Calls SameText to perform a case-insensitive comparison between the value in ATitle and the title in each of the collection items.

TGridColumn instance with the specified title, or Nil when not found.
Title for the column to retrieved from the collection.
The actual grid index for the visible columns in the collection.
Gets the ordinal position in the collection for the specified item.

IndexOf is an Integer function used to get the ordinal position in the collection for the TGridColumn instance specified in Column. The return value contains the ordinal position (in the range 0 to Count-1), or -1 when no items exist in the collection or when Column cannot be located in the container.

TCollection.Count
Ordinal position for the collection item, or -1 when not found.
Grid column to locate in the collection.
True if the column contains default values only.
True if the column uses a default title and contains no explicit property assignments.
True if the specified index value is valid for the collection.

HasIndex ensures that the value in Index is valid for the collection. The return value is True when Index is in the range 0..Count-1.

TCollection.Count
True when the value is in the range allowed for the collection.
Index value examined in the method.
The visible index value for the specified column in the collection.
Ordinal position for the column within the visible columns for the collection.
Ordinal position for the column examined in the method.
The Grid which owns the collection and columns.

Grid is a read-only TCustomGrid which provides access to the grid which owns the column collection. The value in Grid is set in the constructor to an argument passed to the method, and used as the value for the Owner property.

Grid can be used to access the properties, methods, and events in the grid class instance. It is used in the implementation of methods in the collection, such as InsertColumn and Update.

TCollection.Owner
Provides indexed access to column definitions in the collection.

Items is an indexed TGridColumn used to access column definitions in the collection by the ordinal position specified in the Index argument. Items is the default for the collection.

Use Add to create and store a new instance of TGridColumn in the collection.

Use InsertColumn to create and store a new collection item at a specific position in the collection.

Use RemoveColumn, Delete or Clear to remove one or all item(s) in the collection.

Use IndexOf to get the ordinal position in the collection for an existing TGridColumn class instance.

TCollection.Delete
Ordinal position for the column definition used as the value.
The number of visible columns in the collection.
Indicates if the column collection is enabled.

Enabled is a read-only Boolean property which indicates if columns in the collection can be used in the associated Grid control. Enabled is True when VisibleCount contains a value greater than 0 (zero).

Stores mouse coordinates in screen pixels.

TGridCoordinate is an alias for the TPoint type, and used to get mouse coordinates in TCustomGrid and descendent classes. The X and Y members contain pixel screen coordinates for a given cell.

Alias for the TRect type in RTL.

TGridRect is an alias for the TRect type in the FPC Run-time Library (RTL).

TRect
Array type used to store TGridRect instances.

TGridRectArray is an array type used to store TGridRect instances. It is used to track cell selection ranges in a grid control.

Stores size and movement data for columns or rows in a grid.

TSizingRec is a record type used to store size and positioning information for columns or rows in TCustomGrid and descendent classes. TSizingRec is the type used for an internal member in TCustomGrid used in method that perform column or row sizing operations.

Stores cached information about a grid control.

TGridDataCache is a record type used to store and cache information about a grid control, its layout, and activity. TGridDataCache is the type used to implement the GCache property in TCustomGrid.

Sum of the column widths for fixed cells in a grid.
Sum of the row heights for fixed cells in a grid.
Sum of the column widths for all cells in a grid.
Sum of the row heights for all cells in a grid.
Width of the grid control minus the width for the vertical scrollbar.
Height of the grid control minus the width of the horizontal scrollbar.
The difference between ClientWidth and FixedWidth.
The difference between ClientHeight and FixedHeight.
Difference between the scrollbar range and the grid page size.
Visible non-fixed cell coordinates rectangle.
Bottom/Right coordinates in (pixels) for the visible parts of a grid.
True when there are no fixed columns to display in a grid.
True when there are no fixed rows to display in the grid.
True when there are no fixed cells for columns or rows in a grid.
Cumulative preceeding width per grid column.
Cumulative preceeding height per grid row.
Offset in pixels for the Top/Left column in a grid.
Offset in pixels for the Top/Left row in a grid.
Cell coordinates for the last cell that can be used as the grid visual origin.
Max Top left offset for the last cell in the grid.
The current "hot" cell in the grid.
True if the current "hot" cell has already been painted.
GridZone for the last MouseMove.
Cell coordinates for the last mouse click event.
Mouse coordinates for the last mouse click event.
Cell coordinates for the cell drawn in the pushed state.
Mouse Coordinates for the cell drawn in the pushed state.
Indicates if the header cell is currently drawn in the pushed state.
Visible cells excluding partially visible cells.
Cell which contains the mouse pointer.
Previous MaxTopleft (before column sizing).
Enumerated type with cursors available in a grid.

TGridCursorState is the type used for the CursorState property in TCustomGrid.

Normal cursor shape/style.
Cursor displayed when changing the size of a column.
Cursor displayed when resizing the height of a row.
Cursor displayed when dragging a row or column.
Implements the base class for grid controls.

A grid is a collection of cells that are organized in columns and rows. Grids are suitable for showing data that using a tabular layout. For example: tables in a database, or formulae and data in a spreadsheet.

Key properties:

The ColCount and RowCount properties contain the column and row count of the grid.

The FixedCols and FixedRows properties specify the count of fixed columns or rows that are used for headings.

The column widths and row heights of the grid are accessible with the ColWidths and RowHeights properties.

The DefaultColWidth and DefaultRowHeight properties are used to specify default column widths or row heights respectively.

The colors of the cells and the grid elements are specified with the AlternateColor, BorderColor, FixedColor, FixedHotColor, FocusColor, GridLineColor and SelectedColor properties. The GridWidth and GridHeight properties contain the dimension of the entire grid.

The ScrollBars controls the creation of scrollbars for the grid.

The LeftCol, TopRow, VisibleColCount and VisibleRowCount properties contain information about the visible area of the grid.

The Options controls options for the grid.

Key methods and events:

If the user highlights a cell of the grid, the SelectCell method is called that triggers the OnSelectCell event. The position of the highlighted cell is stored within the Col and Row property.

The MouseToCell method calculates a grid cell from a given screen position.

Huge changes to the grid should be encapsulated in calls to BeginUpdate and EndUpdate to speed up the application.

Component developers must override the DrawCell method in customized grids.

Adjusts a row or column count.

AdjustCount is a procedure used to adjust the row or column count for the grid, and to update properties and cache information for the grid.

IsColumn indicates if the OldValue and NewValue arguments refer to the column or row count for the grid; when IsColumn is True, the values refer to the column count.

OldValue contains the previous row or column count in the grid.

NewValue contains the row or column count on exit from the method.

AdjustCount is called when the value in the RowCount or ColCount is changed. It calls the UpdateCachedSizes and SizeChanged methods. It may also call FixPos when NewValue causes the row or column to be out of range for the grid control.

True when the count values are for a columns instead of rows.
Count value before adjustment.
Count value after adjustment.
Caches information about visible parts of the grid (excluding fixed cells).
Removes the active range selection for the grid.

Ensures that a selection range is re-created for the current cell, or the current row when goRowSelect is included in the Options for the grid. The value in SelectActive is set to False.

Ensures that column and row numbers for fixed cells are valid.
Raises an EGridException if values in column or row numbers for fixed cells contain negative values, or are not in range for the grid control.
Column number examined in the method.
Row number examined in the method.
Fixed column number examined in the method.
Fixed row number examined in the method.
Ensures that a handle exists for the grid before updates to column or row counts.

Ensures that a handle has been allocated for the grid prior to actions that affect the row or column count.

New column count for the control.
New row count for the control.
Ensures a row or column index is not out of range.

CheckIndex is a procedure used to ensure that an index value is within the range of values allowed for a row or column.

IsColumn indicates whether a row or column index is being checked. When set to True, a column index is verified. When set to False, a row index is examined.

IsColumnIndexValid or IsRowIndexValid is called to validate the value in Index. An EGridException exception is raised when Index in not allowed for the corresponding dimension.

CheckIndex is called from methods like Sort, DoOPMoveColRow, and DoOPDeleteColRow.

Raises an EGridException exception with the message in rsGridIndexOutOfRange when Index is not valid for the row or column.
True when the Index is for a column; False when it is for a Row.
Column index examined in the method.
Determines if the top/left visible cell needs to change for the cached information.
True when the top left cell is changed.
Gets the value for the ColRow property.
Value for the property.
Sets the value for the ColRow property.
New value for the property.
Indicates if the specified cell is a non-fixed cell using a button-style column editor.
True when the column exists and uses a button-style editor.
TPoint instance with the column and row numbers for the cell.
Gets the value for the SelectedColumn property.
Value for the property.
Sets the value in the AlternateColor property.
New value for the property.
Sets the value in the AutoFillColumns property.
New value for the property.
Sets the value for the BorderColor property.
New value for the property.
Sets the value for the ColumnClickSorts property.
New value for the property.
Sets the value for the Columns property.
New value for the property.
Sets the value for the EditorOptions property.
New value for the property.
Sets the value for the EditorBorderStyle property.
New value for the property.
Sets the value for the AltColorStartNormal property.
New value for the property.
Sets the value for the Flat property.
New value for the property.
Sets the value for the FocusRectVisible property.
New value for the property.
Sets the value for the TitleImageList property.
New value for the property.
Sets the value for the TitleImageListWidth property.
New value for the property.
Sets the value for the TitleFont property.
New value for the property.
Sets the value for the TitleStyle property.
New value for the property.
Sets the value for the UseXorFeatures property.
New value for the property.
Performs actions needed when a column in the grid is resized.

doColSizing is a Boolean function used to perform actions needed when a column in the grid is resized. X and Y contain the mouse coordinates where the action was initiated. The return value contains True when the resizing operation is successfully completed.

No actions are performed in doColSizing if the GridState member contains any value other than gsColSizing. The GridFlags member is updated to include the value gfSizingStarted, and the ResizeColumn and HeaderSizing methods are called to reflect the altered column size.

True when column resizing is successfully completed.
Horizontal mouse coordinate where the action was started.
Vertical mouse coordinate where the action was started.
Performs actions needed when a grid row is resized.
Performs actions needed to move or drag a grid column.
Performs actions needed to move or drag a grid row.
Performs actions needed to render a cell using its "Pushed" appearance.
Performs actions needed when the origin or dimensions for the grid are changed.
True when the dimensions for the grid have been altered.
Draws a vertical line at the specified horizontal location using XOR pen mode.
Horizontal location where the vertical grid line is drawn.
Draws a horizontal line at the specified vertical location using XOR pen mode.
Vertical location where the horizontal grid line is drawn.
Gets the value for a cell editor.

EditorGetValue is a Boolean function used to get the value for a cell editor in the grid. EditorGetValue is used in the implementation of TCustomGrid methods like: EditorShowInCell, ResetEditor, MoveExtend, and DestroyHandle. It is used to get the cell value prior to editing, and to display the value from the cell editor when it is hidden.

Validate is a Boolean argument that indicates if the ValidateEntry method is called to validate the edited cell value. When it contains True, ValidateEntry is called prior to calling EditorDoSetValue and/or EditorHide.

The return value contains True when the edited cell value is valid. It also contains True if a cell editor has not been assigned or is not visible, or the method was called at design-time or during component destruction.

True when the cell is valid or has not been altered.
Indicates the cell value is validated using ValidateEntry.
Sets the position and size for an active cell editor in the grid.

EditorPos is a procedure used to set the position and size for an active cell editor in the grid. EditorPos posts messages to the Editor for the grid, and requires a valid handle for both the grid control and the editor control. No actions are performed in the method when a Handle has not been allocated for the grid or when Editor is unassigned (contains Nil).

A TGridMessage instance with the values in Grid, Col, and Row is dispatched to the Editor to set the Editor position. The bounds for the editor rectangle is calculated and adjusted when needed.

The Font for the grid control is assigned to the Canvas where the editor control is drawn.

A TGridMessage instance with the values in Grid, Col, Row, and the calculated bounds is dispatched to the Editor to set the Editor bounds.

EditorPos is called when visual properties are modified in the control and the editor control is visible. For example: SetRowHeight, SetDefRowHeight, AdjustEditorBounds, SetEditorBorderStyle, SetEditorValue, EditorWidthChanged, GridMouseWheel, WMHScroll, and WMVScroll.

TCustomControl.Canvas TControl.Font
Applies a UTF-8-encoded character value to the active cell editor.

Calls SelectEditor to ensure that the cell Editor is active and enabled for the cell at Col and Row. The Editor is displayed (when available) if the value in Ch is handled in the editor control, and is not marked as read-only. The character in Ch is posted to the widgetset class for the grid.

This method bypasses the KeyDown handler for the class instance, and as a result does not automatically reset RowAutoInsert when Ch contains the Backspace key (Ctrl+H). RowAutoInsert is manually set to False in the method when the Backspace character is detected.

UTF-8-encoded character applied in the method.
Sets the value for the EditorMode property.
New value for the property.
Changes the cell editor value and position at run-time.

Calls EditorPos to the set the position for the Editor control used in the active cell. Calls EditorDoSetValue to update the content in the Editor control.

No actions are performed in the method at design-time.

Indicates if a cell editor is always displayed for an active cell in the grid.

The return value is True when editing is allowed for the cell, it is not a fixed cell, and goAlwaysShowEditor is included in the Options property.

True when a cell editor is allowed and enabled in grid cells.
Ensures that column and row positions, and selection(s) are valid for the grid.
Ensures that scrollbars are updated to reflect the cached visible area in the grid.
Gets the value for LeftCol property.
Value for the property.
Gets the value for the ColCount property.
Value for the property.
Gets the value for the indexed ColWidths property.
Value for the property.
Column number to examine in the method.
Gets the value for the Columns property.
Value for the property.
Gets the value for the DefaultColWidth property.
Value for the property.
Gets the value for the DefaultRowHeight property.
Value for the property.
Gets the value for the EditorBorderStyle property.
Value for the property.
Gets the number of pixels needed for the grid border (when used).
Number of pixels needed for the grid border.
Gets position and layout information for an image used in a column header.
Column number examined in the method.
Position of the image used for the column.
Image layout used for the column.
Gets image information displayed in a column header for a sortable grid column.

GetSortTitleImageInfo is used in the implementation of the methods like TCustomGrid.DrawColumnTitleImage and TCustomStringGrid.AutoAdjustColumn.

Column index for the sort indicator.
List with images used for the indicator.
Image index used for the specified grid column.
Image width used for the indicator.
Indicates if native sort indicators are defined in the grid column.
Gets the value for the RowCount property.
Value for the property.
Gets the value for the indexed RowHeights property.
Height for the row in pixels.
Row number for the property value.
Gets the value for the indexed SelectedRange property.
Value for the property.
Ordinal position for the grid selection rectangle.
Gets the value for the SelectedRangeCount property.
Value for the property.
Gets the value for the Selection property.
Value for the property.
Gets a cursor for the specified grid cursor state.

GetSpecialCursor is used as the read access specifier for the ColRowDraggingCursor, ColRowSizingCursor, and RowSizingCursor properties.

TCursor representing the specified cursor state.
Grid cursor state retrieved in the method.
Gets the value for the TopRow property.
Value for the property.
Gets the value for the VisibleRowCount property.
Value for the property.
Gets a rectangle with the cell coordinates for the visible area in the grid.

Gets a TRect instance with the cell coordinates for the visible area in the grid control.

The visible grid area depends on the values in TopLeft, ClientWidth, ClientHeight, ColCount and RowCount. The method is called immediately after changing values in any of these properties. It provides the current values needed when the grid cache is updated in the CacheVisibleGrid method.

TRect with the cell coordinates for the visible area in the control.
Gets the value for the VisibleRowCount property.
Value for the property.
Performs actions needed to resize columns to fill the client area for the grid control.

InternalAutoFillColumns is a procedure used to resize one or more columns to fill the client area for the grid control. No actions are performed in the method if AutoFillColumns is set to False, or when the method has already been called but has not yet been completed.

InternalAutoFillColumns calls GetAutoFillColumnInfo to accumulate the fixed cell width, data width, and sizing priority for each of the Columns defined in the grid. At least one of the cells in the grid must have sizing priority; the last non-fixed column is expanded to fill the client area in the grid when no other column has sizing priority.

InternalAutoFillColumns is called from the UpdateCachedSizes method.

Indicates if borders are needed to render the grid control.
True when a border is drawn around the grid control.
Performs internal actions needed to set a column width to the specified value.
Column number affected in the method.
Width applied to the column.
Performs internal actions needed to update columns widths from the grid Columns.
Not used in the current implementation.
Indicates if AlternateColor has a value different than the Color for the grid control.
Used as the storage specifier for the AlternateColor property.
True when AlternateColor is different than Color.
Indicates if Columns has been enabled for the grid control.
Used as the storage specifier for the Columns property.
True when the Enabled in Columns is True.
Indicates if the pushed cell for the grid is visible.
Loads column settings from the specified XML configuration file.
XML configuration file with values loaded in the method.
Version number requested from the XML configuration.
Loads a bitmap with the specified name from the resource file for the control.
Assumes the resource in ResName can be loaded using TPortableNetworkGraphic, and assigned to the TBitmap return value.
TBitmap with the image loaded in the method.
Resource name loaded in the method.
XML configuration file with values loaded in the method.
Event handler signalled when the font used for fixed title cells has been changed.

OnTitleFontChanged is a procedure which implements the event handler signalled when the TitleFont for fixed cells has been changed. OnTitleFontChanged is assigned to the OnChange event handler in TitleFont in the constructor for the class instance.

OnTitleFontChanged sets the value in TitleFontIsDefault to False to reflect the change in the font setting. When Columns have been enabled (VisibleCount contains a non-zero value), the TitleFontChanged method in Columns is called. The ColumnsChanged method is called to force the grid to be updated. If Columns have not been enabled, the VisualChange method is called to update the grid control.

Object generating the event notification.
Reads values for the Columns collection using the specified TReader class instance.
TReader used to load values during LCL component streaming.
Reads the list of Integers in ColWidths using the specified TReader instance.
TReader used to load values during LCL component streaming.
Reads the list of Integers in RowHeights using the specified TReader instance.
TReader used to load values during LCL component streaming.
Resets cached grid information for the "pushed" cell.

ResetPushedCell refreshes cached information for the grid related to the current PushedCell. It invalidates the cell at the position in PushedCell when the cached values indicate it is "pushed". Resets coordinates in PushedCell when ResetColRow is set to True. Sets the ClickCellPushed member in the cached data to False prior to exit.

ResetPushedCell is called from methods like HeadersMouseMove and MouseUp. It is also called from the constructor for the TCustomGrid instance.

Restores the internal saved cursor for the grid, and resets CursorState to its default value.
Saves column configuration, layout, and appearance values to an XML configuration file.
XML configuration file where the values are written.
Scrolls the grid until the cell at the specified location is visible.
Scrolls the grid until the cell at the specified location is the new origin.
Sets the value in the Col property.
New value for the property.
Sets the value in the indexed ColWidths property.
Column number for the update width value.
New value for the property.
Sets the value for the ColRowDragIndicatorColor property.
New value for the property.
Sets the value for the DefColWidth property.
New value for the property.
Sets the value for the DefRowHeight property.
New value for the property.
Sets the value for the DefaultDrawing property.
New value for the property.
Sets the value for the Editor property.
New value for the property.
Sets the value for the FocusColor property.
New value for the property.
Sets the value for the GridLineColor property.
New value for the property.
Sets the value for the FixedGridLineColor property.
New value for the property.
Sets the value for the GridLineStyle property.
New value for the property.
Sets the value for the GridLineWidth property.
New value for the property.
Sets the value for the LeftCol property.
New value for the property.
Sets the value for the Options property.
New value for the property.
Sets the value for the Options2 property.
New value for the property.
Sets the value for the RangeSelectMode property.
New value for the property.
Sets the value for the Row property.
New value for the property.
Sets the value for the RowCount property.
New value for the property.
Sets the value in the indexed RowHeights property.
Row number affected in the method.
New value for the specified row number.
Sets the value for the ScrollBars property.
New value for the property.
Sets the value for the SelectActive property.
New value for the property.
Sets the value for the Selection property.
New value for the property.
Sets the value for the indexed cursor states in the grid control.

SetSpecialCursor is used as the write access specifier for the ColRowDraggingCursor, ColRowSizingCursor, and RowSizingCursor properties.

Cursor state located in the method.
New value for the cursor state.
Sets the value for the TopRow property.
New value for the property.
Updates the grid to begin a column sizing operation for the specified cell.
Changes the cursor shape to the specified value.
Cursor shape applied in the method.
Indicates if the existing cursor shape is stored for later reuse.
Performs actions needed when the size for columns or rows are changed.
Updates the visibility for horizontal and/or vertical scrollbars.
Updates cached information when visual aspects for columns or rows are changed.
Writes the Columns collection using the specified TWriter instance.

A Nil collection is written using Writer when Column contains the default column definitions (has not been modified at design-time or run-time).

Not used in the current implementation of TCustomGrid.DefineProperties.
TWriter instance used for the class.
Writes the list of Integers in ColWidths using the specified TWriter instance.
TWriter instance used to write the values.
Writes the list of Integers in RowHeights using the specified TWriter instance.
TWriter instance used to write the values.
Handles the Window Message used to erase the background for the control.

Always returns 1 as the Message result.

Lazarus message applied in the method.
Handles the Window Message for Tab and Arrow keys in dialogs and custom controls.
Examines the Options property for the presence of the goTabs enumeration value. When present, the DLGC_WANTTAB value is OR'd to the result value in Msg.
Lazarus message processed in the method.
Member with the current state for the grid (edited, updated, etc.).
Gets the positive or negative multiplier used to adjust scroll values for BiDi mode.
Adds the current selection range to the array of rectangles in Selections.

Called from the MouseDown method when Options includes the value which enables multi-select.

Adjusts the client rectangle and sets the grid flag to reflect the change.

AdjustClientRect is an overridden method used to adjust the client rectangle for the control, and set the grid flag to reflect the change. Calls the inherited method on entry. Updates the GridFlags property to included the value gfClientRectChange.

TWinControl.AdjustClientRect
Client rectangle adjusted in the method.
Updates the selected cell and sets the bounds for the optional cell Editor.

Calls SetColRow to update the values in the Col and Row properties. Values in NewCol and NewRow are stored in the corresponding property.

When EditorMode is set to True, the private EditorPos method is called to position the Editor to the new cell selection.

Column number for the current cell selection in the grid.
Row number for the current cell selection in the grid.
Signals the OnAfterSelection event handler.

AfterMoveSelection is a procedure used to signal the OnAfterSelection event handler when it has been assigned (does not contain Nil). Values in prevCol and prevRow are passed as arguments to the OnAfterSelection event handler.

AfterMoveSelection is called from the MoveExtend method when the move operation has been completed.

Column number for the selection before it was moved.
Row number for the selection before it was moved.
Stores properties from the current grid class instance to the specified target.

AssignTo is an overridden method used to store values from the current class instance to the persistent object specified in Dest. AssignTo is overridden to provide support for TCustomGrid properties in the object persistence mechanism.

When Dest is a TCustomGrid descendant, the following properties are copied from the current class instance to the target:

Structure

- Columns (When Columns has been Enabled)
- ColCount (When Columns has not been Enabled)
- RowCount
- FixedCols
- FixedRows
- DefaultRowHeight (when it contains a value other than the default)
- DefaultColWidth (when it contains a value other than the default)
- The internal Rows list
- The internal Cols list (when Columns has not been enabled)

Display Settings

- Options
- Color
- FixedColor
- AlternateColor
- Font
- TitleFont

Position and Selection

- TopRow
- LeftCol
- Col
- Row
- Current selection range for the grid

When Dest is not a TCustomGrid descendant, the inherited AssignTo method is called using Dest as an argument.

TControl.AssignTo
Grid instance where value are stored.
Adjusts column properties to accommodate the largest value in the specified column.

AutoAdjustColumn is called from the DblClick method when the values goColSizing and goDblClickAutoSize have been included in the Options property.

AutoAdjustColumn has an empty implementation in TCustomGrid, and must be overridden in a descendent class.

Column number adjusted in the method.
Performs actions needed before a selection is moved.

BeforeMoveSelection is called from the MoveExtend method whenever the current grid cursor location is about to change. The destination column and row are specified in the DCol and DRow parameters respectively.

The new location is known to be a valid selectable cell (see ), and is given in absolute cell coordinates. At this point the current grid location has not changed and can be retrieved with Col and Row properties.

The purpose of this method is to call the OnBeforeSelection event handler.

Starts an auto-drag operation in the grid control.

BeginAutoDrag is an overridden procedure used to start an auto-dragging operation. Auto-dragging is in effect when DragMode contains the value dmAutomatic.

BeginAutoDrag examines the Options property to determine if column sizing (goColSizing) or row sizing (goRowSizing) have been enabled for the grid control. In addition, the CursorState property must contain a value that represents the action (gcsColWidthChanging or gcsRowHeightChanging). If either condition is not met, BeginDrag is called using False as an argument.

Gets the rectangle for the box around the cell at the given coordinates.

Not used in the current implementation.

Not currently used in the grid implementation.

Updates cached grid information when a mouse click occurs in the grid control.
Horizontal screen coordinate for the mouse click.
Vertical screen coordinate for the mouse click.
Automatically calculates the size for the column at the specified position.

Sets the value for aPriority to 0 (zero).

Deprecated.
Calculates the bounds for a focus rectangle in the grid control.

When row selection is enabled in the grid Options, the Left and Right values in ARect are updated to use cached grid information in GCache. Calls FlipRect to account for Right-to-Left alignment when needed.

Adjust indicates whether values in ARect are adjusted for horizontal or vertical grid lines drawn in the control. No additional actions are performed when Adjust is set to False. The default value for the parameter is True.

When goHorzLine is included in Options, the Bottom value in ARect is decremented to accommodate the horizontal grid line.

When goVertLine is included in Options, the Left or Right value in ARect is adjusted to accommodate the vertical grid line. Left is incremented when UseRightToLeftAlignment is set to True. Right is decremented when UseRightToLeftAlignment is set to False.

CalcFocusRect is called from the DrawRow and DrawFocusRect methods.

TControl.UseRightToLeftAlignment
Updates cached grid information for the visible area and scrollbars in the control.
Updates the range, page, and thumb position for visible scrollbars.

CalcScrollbarsRange is a procedure used to update the range, page, and thumb position for visible scrollbars in the grid control. CalcScrollbarsRange accesses the cached grid data in GCache to calculate values needed in the method. The visibility for both horizontal and vertical scrollbars is determined, and the range, page and thumb position is applied in the UpdateHorzScrollBar and UpdateVertScrollbar methods.

CalcScrollbarsRange is used in the implementation of the ScrollBy and UpdateSizes methods in TCustomGrid.

Gets the preferred width and height for the control.

Always returns 0 (zero) in the PreferredWidth and PreferredHeight variable arguments.

TWinControl.CalculatePreferredSize
Indicates whether the cell editor can be displayed and focused in the current column.

CanEditShow is a Boolean function which Indicates whether the cell Editor can be displayed and focused in the current grid column. The return value is False at design-time. The return value is True if Options includes the value goEditing, and the column number in Col is valid and not in a fixed row.

When Columns have been Enabled in the grid control, the return value is set to False when the column is marked as ReadOnly in the column definition.

CanEditShow is called from the EditorShow method.

True at run-time when the column allows focus and editing.
Returns True if the grid is able to accept the given key.

Always returns True in TCustomGrid.

True if the grid is able to accept the given key.
Not used in the current implementation.
Not used in the current implementation.
Processes a mouse click in the cell at the given coordinates.

CellClick has an empty implementation in TCustomGrid.

Column number for the click event.
Row number for the click event.
Gets the last column number for the cell extent at the specified column and row.

CellExtent gets the extent rectangle for the cell at the coordinated in ACol and ARow. The rectangle bounds in R are updated by calling the CalcCellExtent method.

exCol is updated in the method to reflect the last visible column in the cached grid information for the cell extent. The ColRowToOffset method is iteratively called until the extent exceeds the cached right-most column for the visible area in the grid.

CellExtent is called from the DrawRow method when column spanning is enabled in the Options for the grid control.

The current implementation does not account for BIDI mode or Right-to-Left usage.
Column number for the cell extent.
Row number for the cell extent.
TRect with the bounds for the cell extent.
Last usable column number for the cell extent.
Checks column and row limits for the specified cell.

CheckLimits is a procedure used to constrain the specified cell coordinates to the valid values for grid control.

ACol and ARow contain the column and row numbers for a cell in the grid control. CheckLimits ensures that the values represent a valid, non-fixed cell in the grid control.

ACol must contain a value in the range 0..ColCount-1, and cannot be a fixed column in the grid. The value in FixedCols is assigned to ACol if it is less than the value in FixedCols. ColCount-1 is assigned to ACol when it is larger than the upper limit.

ARow must contain a value in the range 0..RowCount-1, and cannot be a fixed row in the grid. The value in FixedRows is assigned to ARow if it is less than the value in FixedRows. RowCount-1 is assigned to ARow when it is larger than the upper limit.

CheckLimitsWithError is used when an exception is required for invalid cell coordinates.

CheckLimits is used in the implementation of methods like MoveNextSelectable and TryMoveSelection.

Column number examined in the method.
Row number examined in the method.
Checks column and row limits for the specified cell, with error trapping.

CheckLimitsWithError is a procedure used to ensure that the specified cell coordinates are valid values for grid control.

ACol and ARow contain the column and row numbers for a cell in the grid control. CheckLimitsWithError ensures that the values represent a valid, non-fixed cell in the grid control. ACol must contain a value in the range 0..ColCount-1, and cannot be a fixed column in the grid. ARow must contain a value in the range 0..RowCount-1, and cannot be a fixed row in the grid.

CheckLimitsWithError calls IsColumnIndexValid and IsRowIndexValid to determine whether the corresponding values are valid. If either method returns False, an EGridException is raised.

CheckLimits is used when cell coordinates must be constrained to the values that are valid for the control.

CheckLimitsWithError is used in the implementation of methods like SetCol, SetRow, and SetQuickColRow when AllowOutboundEvents is not enabled.

Raises an EGridException exception with the message in rsGridIndexOutOfRange when a column or row number is out of range for the control.
Column number examined in the method.
Row number examined in the method.
Handles the CM_BIDIMODECHANGED control message for the grid control.

Calls VisualChange to update column sizes and redraw the control, and calls the inherited method to notify child controls of the new BidiMode value.

Handles the control message posted when the mouse enters a cell in the grid.
Message handled in the method.
Handles the control message posted when a mouse leaves a cell.
Message handled in the method.
Performs actions when a column or a row is deleted from the control.

ColRowDeleted has an empty implementation in TCustomGrid. It is overridden in descendent classes to remove the affected cells and perform notifications.

True to remove a column, False to remove a Row.
Ordinal position for the column or row removed in the method.
Performs a notification when column or row data is exchanged in the grid.

ColRowExchanged has an empty implementation in TCustomGrid. It is implemented in descendent classes like TCustomDrawGrid to update the content in the grid and signal the OnColRowExchanged event handler (when assigned).

Performs a notification when column or row data is inserted in the grid.
Performs a notification when column or row data is moved in the grid.
Converts a column or row index to starting and ending pixels coordinates.
True if a column or row exists for the specified index.
True when the index is for a column in the grid, False for a row.
Ordinal position for the column or row.
Position where the column or row starts (pixel).
Position where the column or row ends (pixel).
Gets the position of the specified column relative to the first column in the grid.

ColumnIndexFromGridColumn is an Integer function used to get the position of the specified column relative to the first column in the grid. The return value contains the difference between Column and FirstGridColumn when Columns have been enabled in the grid control. RealIndex is called to translate the position used in the return value. If Columns have not been enabled, the return value is -1.

ColumnIndexFromGridColumn is used in the implementation of TCustomGrid methods like:

- ColumnFromGridColumn
- DoOPExchangeColRow
- DoOPInsertColRow
- DoOPMoveColRow
- DoOPDeleteColRow

Relative position for the specified column.
Column number to locate in the grid.
Returns the actual grid column given its index.
Performs actions needed when one or more columns in the grid are changed.

ColumnsChanged is procedure used to perform actions needed when one or more Columns in the grid are changed. AColumn contains the column affected by the change, or signals a change to multiple columns when its value is unassigned (contains Nil).

When AColumn is Nil, the row or column count and/or fixed row or fixed column count has been changed. When AColumn contains a valid TGridColumn instance, the modified column is located in the Columns collection and the VisualChange method is called.

ColumnsChanged is called from methods like: SetFixedCols, SetRowCount, and OnTitleFontChanged. It is also called when the Update method in Columns is called for the TGridColumns collection.

Grid column instance for the notification, or Nil.
Performs actions needed when the widths for grid columns have been changed.

ColWidthsChanged has an empty implementation in TCustomGrid.

Allocates and configures resources for the Columns collection.

CreateColumns is a TGridColumns function used create a new TGridColumns instance for the grid control. TGridColumn is the class type used for items stored in the collection.

CreateColumns is called from the Create constructor, and the return value is assigned to the member used for the Columns property.

TGridColumns instance created in the method.
Checks the values for cached column sizes when have been reset in the grid.

CheckNewCachedSizes has an empty implementation in TCustomGrid.

Creates and configures the widgetset handle for the grid control.

CreateWnd is an overridden method in TCustomGrid. It calls the inherited method to allocate the Handle for the widgetset class.

CreateWnd ensures that internal flags used for horizontal and vertical scrollbar visibility are updated to reflect the states for the control Handle. The CheckPosition method is called to determine the cell selection in the grid. VisualChange is called to refresh the visible area and scrollbars in the control.

TWinControl.CreateWnd TWinControl.Handle
Creation parameters updated in the method.
Performs actions when a mouse click occurs in the grid control.

Click is an overridden method used to perform action needed when a mouse click occurs in the control. The grid control provides an internal flag to suppress mouse click handling when the event occurs in a "hot zone" (fixed header cells for columns or rows). Click checks the value in the internal flag, and calls the inherited method when the click occurs in the "normal" data cells for the grid.

Click is called from methods like SetCol, SetRow, and SetColRow to emulate a mouse click when values are assigned to the Col and/or Row properties.

TControl.Click
Performs actions needed to handle mouse double click events in the control.

DblClick is an overridden method used to perform actions needed when a mouse Double Click event occurs in the grid control.

SelectActive is set to False to ignore an active cell or range selection in the control. The internal TGridState member for the control is set to gsNormal to reflect the new state for the control.

DblClick uses values in the Options property to determine whether double click is enabled for column or row sizing operations in the control. Some of the Options values relevant to DblClick include:

goColSizing
  Column sizing in enabled for the control.
goRowSizing
  Row sizing is enabled for the control.
goDblClickAutoSize
  A mouse double click resizes the column automatically.

When the needed Options values are present, and match the current CursorState for the control, the corresponding action is performed. AutoAdjustColumn is called for a column resize action. RestoreCursor is called, and HeaderSized is called to signal completion of the column resize operation. Row resize actions for double click mouse events are not currently implemented.

If the values in Options or CursorState do not meet the required conditions, the inherited method is called.

TControl.DblClick
Indicates if the DefaultColWidth property is available in component streaming.
Indicates if the DefaultRowHeight property is available in component streaming.
Defines non-published properties included during LCL component streaming.

DefineProperties is an overridden method used to define non-published properties which are included during LCL component streaming. It sets the read and write routines in Filer used for the following grid properties:

- ColWidths
- RowHeights

TControl.DefineProperties
TFiler instance used to read and write the defined properties.
Applies an accelerator key for a column in the grid.

DialogChar is an overridden Boolean function used to apply Lazarus messages with accelerator keys for columns in the grid. Message contains the TLMKey instance with the message examined in the method. DialogChar examines each of the Columns defined for the grid to determine if the CharCode for the Message is an accelerator key appearing in the title for the column. When a match is found, the HeaderClick method is called to activate the column.

The return value contains the result from the inherited DialogChar method.

TWinControl.DialogChar
Lazarus messaged examined in the method.
Performs a comparison between the specified cells in the grid control.

DoCompareCells signals the OnCompareCells event handler (when assigned) to perform the comparison. The return value contains the relative sort order for the compared cells, and uses the following values:

-1
  The cell at ACol and ARow occurs comes before the cell at BCol and BRow.
0
  The specified cells have the same value.
1
  The cell at ACol and ARow occurs comes after the cell at BCol and BRow.

When OnCompareCells is not assigned, the return value is always 0.

Relative sort order for the compared cells.
Column number for the cell.
Row number for the cell.
Column number for the cell.
Row number for the cell.
Copies the selected data to the clipboard.
Cuts the data from its current site and places it in the clipboard.
Performs actions needed when the button for editor control is clicked.

DoEditButtonClick is a procedure used to perform actions requires when the button for a cell editor or button column is clicked.

ACol and ARow contain the Integer coordinates for the cell where the action occurred.

DoEditButtonClick signals the OnEditButtonClick and OnButtonClick event handlers when they have been assigned for the grid control.

DoEditButtonClick is used in the implementation of the EditButtonClicked method used in cell editor controls, and the MouseUp method.

Column number for the affected cell.
Row number for the affected cell.
Performs actions needed to hide the cell Editor in the grid control.

DoEditorHide is a procedure used to hide the cell Editor for the control.

When gfEditingDone is included in the GridFlags for the control, and CanFocus indicates that the control can be focused, it is used as the ActiveControl in the parent Form. The Visible property in Editor is set to False to hide the cell editor for the control.

DoEditorHide is called from the EditorHide method.

TCustomForm.ActiveControl TWinControl.CanFocus
Performs actions needed to show the cell Editor for the grid control.

Calls ScrollToCell to position the grid on the cell indicated by the Col and Row properties.

String- and Button-style editor controls are updated to use the alignment defined for the current column. If Columns has not been enabled, the default alignment for the cell is taLeftJustify. Calls EditSetValue to copy the cell content into the cell Editor.

The Editor.SetFocus method is called when the grid control currently has focus and the cell editor can receive focus. InvalidateCell is called to redraw the cell at the position in Col and Row.

DoEditorShow is called from the EditorShow method.

Signals the OnLoadColumn event handler for the grid control.
Object for the event notification.
Grid column definition for the event.
Ordinal position for the column.
XML configuration file with the design-time information for the columns in the grid.
Version number for the streaming format used in the configuration file.
XPath-like expression for the column information.
Signals the OnSaveColumn event handler for the grid control.
Applies mouse wheel options and handles a mouse wheel operation.
Performs actions to apply the auto-layout policy with the specified scaling.
Performs a delete operation for a column or a row.
Performs an exchange for the columns or rows with the specified indexes.
Performs an inserting for a column or a row at the specified position.
Performs a move operation for the column or row at the specified position.
Pastes data from the clipboard into the current cell.
Performs actions needed to prepare the canvas for a drawing operation.

Signals the OnPrepareCanvas event handler (when assigned) to prepare the Canvas for the cell using the specified state. Called from the PrepareCavas method. Allows the default actions performed in the caller to be overridden.

Performs actions needed when the grid control is resized.
Applies a UTF-8-encoded character to the active cell editor in the control.

DoUTF8KeyPress is an overridden method used to apply the UTF-8-encoded character in UTF8Key to the active cell Editor for the control. The return value is True if the character is successfully handled.

DoUTF8KeyPress calls the inherited method on entry to determine if the character is handled in the ancestor class. No additional actions are performed in the method when the character is handled in the ancestor.

Otherwise, EditingAllowed is called to determine if a cell editor can be displayed for the column number in Col. When allowed, the EditorShowChar method is called to apply the value in UTF8Key to the cell Editor. The value in UTF8Key is set to an empty string (''), and the return is set to True on successful completion of the operation.

TWinControl.DoUTF8KeyPress
True if the character was successfully applied in the method.
UTF-8 character value handled in the method.
Draws the border for the grid control.
TControl.ClientHeight TControl.ClientWidth
Draws all of the rows for the grid.

Draws both the fixed rows and any visible data rows using cached information in the grid control. Calls DrawRow to render each row by its row number in the control.

DrawAllRows is called from the Paint method.

Draws the fill rectangle on the specified canvas.

Shifts the specified rectangle by one pixel on the left- and right-hand edges when UseRightToLeftAlignment is set to True. Calls the FillRect method in the TCanvas instance to draw the adjusted rectangle.

DrawFillRect is called from the DrawCell method.

Canvas where the fill rectangle is drawn.
Rectangle with the bounds filled in the method.
Draws a cell using a given state at the specified grid location (Col, Row, rectangle).

Calls PrepareCanvas to initialize the Canvas for the control to the state in AState. Calls DrawFillRect to fill the rectangle in ARect using the background for the cell. Calls DrawCellGrid to render fixed or non-fixed cells using the state in AState, including horizontal and vertical grid lines when enabled.

DrawCell is called from the DrawRow method when it renders the visible cells in the grid row.

TCustomControl.Canvas
Column number for the cell.
Row number for the cell.
Rectangle with the dimensions for the cell.
State used to render the cell.
Draws cell grid lines for the control.

DrawCellGrid is a procedure used to draw cell grid lines for both a fixed and a non-fixed cell in the grid control.

DrawCellGrid ensures that the control Canvas (and its Pen) are updated to use the values needed to draw the fixed or non-fixed cell at the location specified in ACol and ARow.

For a fixed cell (when gdFixed is in AState), grid lines are drawn when gdoFixedVertLine or gdoFixedHorzLine is found in the Options property. The Pen in the control Canvas is updated to reflect a non-zero value in GridLineWidth.

When Flat is set to False, the value in AState is used to determine the color used for the Pen. Canvas drawing methods, like MoveTo and LineTo, are used to draw the cell grid lines at the coordinates in ARect. The value in UseRightToLeftAlignment determines how values in ARect are adjusted for the operation.

When Flat is set to True, the value in FixedGridLineColor is used as the color for the Pen.

For a non-fixed cell (gdFixed is not in AState), grid lines are drawn when gdoVertLine or gdoHorzLine is found in the Options property. The Pen in the control Canvas is updated to use the GridLineWidth, GridLineStyle, and GridLineColor for the control. Canvas drawing methods, like MoveTo and LineTo, are used to draw the cell grid lines at the coordinates in ARect. The value in UseRightToLeftAlignment determines how values in ARect are adjusted for the operation.

DrawCellGrid is called from the DrawCell method after preparing the Canvas and drawing the filled rectangle with the background for the cell.

TControl.UseRightToLeftAlignment
Column number for the cell.
Row number for the cell.
Rectangle with the screen coordinates for the cell.
State for the cell (normal, fixed, pushed, et. al.).
Draws the text for a non-fixed cell in the grid.

The implementation for DrawTextInCell is empty in TCustomGrid. It is overridden in descendent classes.

Draws a cell using the theme services for the specified grid drawing state.

DrawThemedCell is a procedure used to draw the cell at the specified coordinates using the theme services for the platform or widget set.

aCol contains the column number for the affected cell.

aRow contains the row number for the affected cell.

aRect contains the screen coordinates for the cell rendered in the method.

aState contains the grid drawing state applied to the cell. aState contains a value from the TGridDrawState enumeration that determines the theme service element details used for the drawing operation.

Grid Draw State | Theme Element | Description
gdPushed | thHeaderItemPressed | Draws the cell using the Pressed state
gdHot | thHeaderItemHot | Draws the cell using the Hotlighted state
Other states | thHeaderItemNormal | Draws the cell using the normal drawing state

Column number for the affected cell.
Row number for the affected cell.
Screen coordinates for the cell.
Grid drawing state for the cell.
Draws the specified text in the given text rectangle.

DrawCellText is a procedure used to draw the text specified in AText using the given text rectangle on the Canvas for the control. The Canvas also contains the alignment and layout used for the text drawn in the method.

ARect contains the Canvas coordinates for the text is drawn. DrawCellText adjusts the bounds in ARect to account for the cell padding used in the control (varCellPadding) as needed for the text aligment and layout. The TextRect method in the Canvas is called to render the text.

Values in the ACol, ARow, and AState parameters are not used in DrawCellText.

DrawCellText is used in the implementation of the DrawColumnText, DrawCellAutonumbering, and DrawTextInCell methods where AText contains the column title, row number, or content for a given cell.

Not used in the current implementation.
Not used in the current implementation.
Text rectangle for the text drawn on the control canvas.
Not used in the current implementation.
Text drawn in the method.
Draws a checkbox bitmap which represents the given state in a cell.

DrawGridCheckboxBitmaps is used to draw a bitmap used for a checkbox at the cell coordinates in ACol and aRow. AState contains the checkbox state for the cell, and determines the image displayed in the specified cell.

GetImageForCheckBox is called to get the image list, image index, and/or bitmap used in the cell. Use the OnUserCheckBoxImage or OnUserCheckboxBitmap event handler to get a custom image or bitmap displayed for the value in AState. If GetImageForCheckBox is unable to find either a bitmap or an image, ThemeServices is used to get the theme element details for the checkbox state.

The bitmap/image/theme element may be scaled if the control Font uses a display density (PPI) different than the value used for the Screen.

When Columns has been Enabled, the GetColumnAlignment and GetColumnLayout methods are used to determine the image alignment and layout used for the checkbox cell. If Columns has not been enabled, the image is centered horizontally in the cell using the vertical alignment defined for text on the Canvas.

DrawGridCheckboxBitmaps adjusts ARect to use the cell padding for the control (varCellPadding) along with the size, alignment and layout needed for the grid column.

The checkbox bitmap is drawn using the mechanism needed for the image source; ThemeService.DrawElement, Canvas.StretchDraw, or TScaledImageListResolution.StretchDraw.

DrawGridCheckboxBitmaps is called from the DrawCellCheckboxBitmaps method.

Column number for the checkbox cell.
Row number for the checkbox cell.
Rectangle with the bounds for the cell.
Checkbox state used to determine the bitmap drawn in the cell.
Draws a cell in a button-style column.

DrawButtonCell is a method used to draw a cell which appears in a button-style column. DrawButtonCell uses ThemeServices to get the theme element details used to render the button for the cell.

AState contains the drawing state for the button, and determines the theme element details used for the drawing state. The ThemeServices.DrawElement method is called to render the button on the control Canvas at the location specified in ARect.

DrawButtonCell is called from DefaultDrawCell when the column has a button-style definition.

Column number for the button cell.
Row number for the button cell.
Rectangle with the bounds where the button is drawn.
Drawing state for the button cell; pushed, hot, or normal.
Draws a column or row when dragging is in effect.
Draws the text and image for a grid column title at the specified cell coordinates.

DrawColumnText is a method used to draw the text and image for a grid column title at the cell coordinates specified in ACol and ARow. DrawColumnText calls DrawColumnTitleImage to draw the sort indicator for the column. DrawCellText is called to render the text for the cell using the specified drawing state.

DrawColumnText is called from the DefaultDrawCell method in descendent classes for cells which are fixed column titles.

Column number for the column title.
Row number for the column title.
Rectangle with the bounds for the column title.
Drawing state for the text in the cell.
Draws the image(s) used in the column title at the specified index in the grid.

DrawColumnTitleImage is a method used to draw the image(s) used in the column title at the index position in AColumnIndex. ARect contains the bounds for the cell where the image is drawn.

When AColumnIndex contains the same value as the SortColumn property, a sort indicator is drawn for the column. GetSortTitleImageInfo is called to determine whether theme services is used to drawn native sort buttons using theme element details. The image size may be scaled when the display density (PPI) for the control Font has a value other than 96.

DrawColumnTitleImage ensures that image padding (DEFIMAGEPADDING) is applied to the bounds in ARect. The top and bottom bounds are adjusted so that the image is vertically centered in the area in ARect.

DrawColumnTitleImage calls the DrawElement method in ThemeServices to draw the sort indicator.

When native sort indicators are not used for the column, an image scaled to the display density is retrieved from the image list. DrawColumnTitleImage ensures that image padding (DEFIMAGEPADDING) is applied to the bounds in ARect. The top and bottom bounds are adjusted so that the image is vertically centered in the area in ARect. The Draw method in the scaled image resolution is called to draw the image on the control Canvas.

TitleImageList is used to determine if an additional image is displayed for the column at AColumnIndex. When TitleImageList has been assigned, the GetTitleImageInfo method is called to get the image list and position used for the column. When an image is defined in Columns, an image scaled to the size size needed for the display densitity (PPI) is retrieved from TitleImageList. The bounds in ARect is adjusted to include padding around the image (DEFIMAGEPADDING) usiing the image layout for the column. The Draw method in the scaled image resolution is called to render the image to the control Canvas.

DrawColumnTitleImage is called from the DrawColumnText method.

Rectangle with the bounds for the column title.
Column Index for the title image drawn in the method.
Draws the edges (and filled background) of the client area for the control.
Draws the focus rectangle for the specified cell.

DrawFocusRect has an empty implementation in TCustomGrid. It is overridden in descendent classes.

Column number for the cell.
Row number for the cell.
TRect instance with the bounds for the cell.
Draws the columns for the specified row in the grid control.

DrawRow is a method used to draw the columns for the row number specified in ARow. DrawRow calls ColRowToOffSet to get the upper and lower bounds for the row, and ensures that the bounds are within the clipping area for the control Canvas.

No actions are performed in the method when the client area for the row does not fit within the clipping rectangle for the control Canvas.

DrawRow iterates over the columns in the visible area in the grid to determine if each cell fits vertically within the clipping rectangle for the control Canvas. If column spanning (goColSpanning) has been enabled in the Options for the grid, the cell extent is determined for each cell. DoDrawCell is called to render the cells.

DrawRow draws the focus rectangle for the row when row selection (goRowSelect) is enabled in the Options for the grid control. DrawFocusRect is called to render the focus rectangle.

DrawRow draws fixed cells used for title columns when the row is one of the fixed rows.

DrawRow is called from the DrawAllRows method.

Row number drawn in the method.
Signals the OnEditButtonClick or OnButtonClick event handler (when assigned).

When Sender is the TButtonCellEditor for the control, the DoEditButtonClick method is called using the Col and Row numbers from the TButtonCellEditor class instance. Otherwise, DoEditButtonClick is called using the values in the Col and Row properties.

Object for the event notification.
Gets the value for the cell Editor.

EditorDoGetValue creates a GM_GETVALUE TGridMessage with the Col, Row, and value for the cell. It is dispatched to the Editor for the control. SetEditText is called prior to exiting from the method; not used in TCustomGrid - but relevant in descendent classes with an event handler for the action.

Resets the value in the selected cell when a visible editor is cancelled or hidden.
Sets the mask and value for a visible cell editor in the grid control.
Returns True if the Editor is able to accept the specified UTF-8 key.
Determines if the current column number is defined as read-only.

Calls GetColumnReadonly using the value in Col as the column number.

When the Columns collection has been enabled, the ReadOnly property in the TGridColumn instance determines the return value. Otherwise, the value from GetDefaultColumnReadOnly is used as the return value (False in TCustomGrid).

Hides a visible cell editor in the grid control.

EditorHide ensures that an active, visible cell editor is locked / hidden / unlocked in the method. No actions are performed in the method when EditorLocked returns True, or the Editor is not visible.

EditorHide sets the value in EditorMode to False, and sets GridState to gsNormal.

No additional actions are performed when the Editor does not have a Parent (when the parent form is closing). If the Editor has an assigned Parent, the Editor is locked and DoEditorHide is called to hide the Editor. If the Editor was focused on entry, SetFocus is called to restore focus to the grid control. The editor is unlocked prior to exiting from the method.

Returns True if the Editor is locked, i.e. unable to accept input or make changes.
True when LockEditor has been called and UnLockEditor has not yet been called.
Indicates if the grid and specified column allow editing.

Returns True if both the grid and the specified column allow editing. The return value is True when all of the following conditions are satisfied:

- goEditing is included in the Options property
- ACol contains a valid column index
- RowCount has a value larger than the value in FixedRows
- The Columns collection has been Enabled (contains at least one visible column)
- A TGridColumn instance exists for the column index in ACol
- The TGridColumn instance is not marked as read-only

Returns True if both the grid and the current column allow editing.
Column number examined in the method.
Performs actions to select the entire content in the current cell.

EditorSelectAll is a method used to select the entire content in the current cell when the Editor is active and visible. EditorSelectAll creates, configures, and dispatches a TGridMessage using the GM_SELECTALL message constant to the Editor in the grid control.

No actions are performed in the method when Editor has not been assigned (contains Nil).

EditorSelectAll is called from the EditorShow method when its SelAll argument is set to True, and from the IMEStartComposition method.

Displays the Editor for the selected cell.

Displays and enables the cell Editor for the selected cell, and optionally selects all content in the cell.

No actions are performed in the method at design-time, or during LCL component streaming. The grid control must have an allocated Handle, and be Enabled and Visible (including the Parent). In addition, both the grid and the column must allow editing. Use Options to enable editing in grid cells. Use Columns to define TGridColumn instances with editable columns using the required button style for the column data.

No actions are performed in the method when Editor has not been assigned, or has already been displayed, or is currently locked by a call to LockEditor.

EditorShow sets the value in EditorMode to True, and saves the existing cell value on entry. EditorShowing is set to True to indicate that the Editor is visible, and calls doEditorShow to display the Editor control.

SelAll indicates whether all of the content in the cuirrent cell is selected in the Editor for the control. When set to True, the EditorSelectAll method is called to post the GM_SELECTALL message to the Editor control. The value in GridState is set to gsNormal prior to exiting from the method.

EditorShow is called when the value goAlwaysShowEditor is included in the Options for the grid control. It is also called from methods like:

- ResetEditor
- MouseDown
- MouseUp
- DoEnter
- KeyDown
- KeyPress
- MoveExtend
- MoveNextSelectable
- EditorShowInCell
- EditorShowChar
- EditorSetMode

True to select the entire content for the cell in the Editor.
Shows the cell content for the Editorin situ.

Not used in the current implementation.

Column number where the editor is displayed.
Row number where the editor is displayed.
Performs actions needed when the width for a cell Editor has been changed.

EditorWidthChanged performs actions needed to update the width for the cell Editor when a column width in the grid has been changed. EditorWidthChanged calls the EditorPos method to set the position, bounds, and font for the Editor.

EditorWidthChanged is called when a new value is assigned to the indexed ColWidths property, and when column widths are adjusted when AutoFillColumns is set to True.

Column number for the affected editor.
New width for the cell with the editor control.
Gets the position of the first column after any fixed columns in the grid.

FirstGridColumn is an Integer function used to get the ordinal position of the first column appearing after any fixed column in the grid control. The return value contains the value in the FixedCols property.

FirstGridColumn is used in the implementation of methods including:

- GetColWidths
- GetIsCellTitle
- ColumnIndexFromGridColumn
- GridColumnFromColumnIndex
- ColumnsChanged

Position of the first column after any fixed columns in the grid.
Determines if all columns or all rows in the grid are fixed.

FixedGrid is a Boolean function used to determine whether all columns in the grid are defined as fixed columns, or all rows are defined as fixed rows. The return value is True when FixedCols is equal to ColCount OR FixedRows is equal to RowCount.

FixedGrid is used in the implementation of methods like: SetFixedCols, SetFixedRows, MouseToGridZone, MouseDown, MouseMove, MouseUp, TryMoveSelect, EditorAlwaysShown, and FixPosition.

True when all of the row or all of the columns in the control are fixed.
Performs actions needed when the font for the control is changed.

FontChanged is an overridden method used to perform actions needed when the Font for the control has been changed.

FontChanged ensures that the internal default heights for rows and columns are reset to 0 (zero). This forces the default column and row heights to be recalculated when the DoAutoAdjustLayout method is called.

When csCustomPaint is included in ControlState, the Font is assigned to the Canvas for the control.

Otherwise, the FontChanged method is called for the ancestor class and the Columns collection (when Enabled). If the default title font is used for the control, the Font is assigned to TitleFont property.

FontChanged is assigned as the OnChange event handler for the Font property in the constructor for the class instance.

TControl.Font TControl.ControlState TCustomControl.FontChanged TFont
Object for the event notification.
Gets auto-fill information for the specified column.

GetAutoFillColumnInfo is a method used to get sizing information for an auto-fill column specified in Index. AMin, AMax, and APriority are variable arguments updated with the values for the requested column.

GetAutoFillColumnInfo calls ColumnFromGridColumn to get the TGridColumn instance in Columns with the requested values. If a column exists with the requested Index, its properties are stored in the variable parameters. When Index is a fixed column in the grid, the value in APriority is set to 0 (zero) which disables auto-sizing for the column. If Columns has not been Enabled for the control, or the column index is not valid, APriority is set to 1.

GetAutoFillColumnInfo is called when AutoFillColumns is set to True, and the column sizes are recalculated for the the grid control.

Position for the grid column examined in the method.
Minimum size for the column.
Maximum size for the column.
Sizing priority for the column.
Gets the hint for the specified cell using the Options enabled in the grid control.

GetCellHintText signals the OnGetCellHint event handler (when assigned) to get the hint text for the cell at the position in ACol and ARow. The return value contains the hint text returned from the event handler, or an empty string ('') when the event handler has not been assigned.

GetCellHintText is called from the ShowCellHintWindow method when Options contains the value goCellHints and CellHintPriority is not set to chpTruncOnly.

String with the hint text for the specified cell.
Column number for the cell.
Row number for the cell.
Gets the cell content at the specified column and row numbers.

Always returns an empty string ('') in TCustomGrid. Overridden in descendent classes.

Content for the specified cell.
Column number for the cell.
Row number for the cell.
Gets the horizontal Alignment for the specified column.

Calls ColumnFromGridColumn to get the TGridColumn instance in Columns for the column number in the Column parameter.

ForTitle indicates the alignment used as the return value for the specified column number. When set to True, the alignment for the Title in the TGridColumn instance is used as the return value. Otherwise, the alignment property in the TGridColumn instance is used as the return value.

Called from the PrepareCanvas and DrawGridCheckboxBitmaps methods.

TAlignment value for the column.
Column number examined in the grid.
True when the alignment in the column title is used.
Gets the Color used to render the background for the specified column number.

GetColumnColor ensures that the correct color value is used to render the background for the specified column number.

When the Columns collection has been enabled, the color is retrieved from the TGridColumn instance. The Color property in TGridColumn is used when ForTitle is set to False. Otherwise, the Color in the Title for the column instance is used.

If the Columns collection has not been enabled, the color is retrieved from the Color or FixedColor properties in the grid control. FixedColor is used when ForTitle is set to True.

GetColumnColor is called from the PrepareCanvas method.

Use properties like AlternateColor, FixedHotColor, FocusColor, and SelectedColor to control when the corresponding Options are enabled for the grid control.

Color the column.
Column number examined in the method.
True when the color for the title in the column is needed.
Gets the font used to render values for the specified column.
TFont instance used to render values for the column.
Column number examined in the method.
True when the font for the column title is needed.
Gets the vertical text Layout value for the specified column.
TTextLayout value for the column.
Column number examined in the method.
True when the text layout for the column title is needed.
Returns True if the column is marked as ReadOnly.
Returns True if the column is marked as ReadOnly.
Column number examined in the method.
Gets the text displayed as the column title for the specified column number.

GetColumnTitle is a String function used to get the text displayed as the column title for column number specified in Column. ColumnFromGridColumn is called to get the non-fixed TGridColumn instance at the specified position in the Columns collection.

If a column exists at the position in Column, the Caption stored in its Title property is used as the return value. If Column does not represent a valid non-fixed column position, or the Columns collection has not been enabled, the value from the GetDefaultColumnTitle method is used as the return value.

GetColumnTitle is called from the DrawColumnText method when the image and text for the column header is drawn.

Text displayed in the title for the column.
Column number for the title text.
Gets the width of the column at the specified column number.

GetColumnWidth calls ColumnFromGridColumn to get the TGridColumn instance for the column number in the Column parameter. If the grid column is assigned, its Width property is used as the return value for the method.

The grid column may be unassigned (contain Nil) if Column is not a valid column number for the control, or Columns has not been Enabled for the grid. In this situation, GetDefaultColumnWidth is called to get the return value for the method.

GetColumnWidth is never called in TCustomGrid or TCustomDrawGrid. It is called from the internal auto-sizing routine in the TCustomDBGrid descendant.
Width (in pixels) for the column.
Column number examined in the method.
Returns the relative cell coordinates for the next cell in the grid navigation order.

AAutoAdvance contains the navigation direction requested in the method. When it is set to aaNone, the values in ACol and ARow always contain 0 (zero) indicating no relative movement.

When Inverse is set to True, the cell navigation order in AAutoAdvance is reversed. When row selection is enabled in the grid Options (using goRowSelect), ACol is set to the first non-fixed column in the grid. Otherwise, it is set to the last column in the grid. Other auto-advance values are handled as follows:

- aaLeft is treated as if it were aaRight
- aaRightDown is treated as if it were aaLeftUp
- aaLeftDown is treated as if it were aaRightUp
- aaRightUp is treated as if it were aaLeftDown
- aaLeftUp is treated as if it were aaRightDown

The next cell for the navigation order is calculated and returned in the ACol and ARow arguments. The return value is True if the values in ACol and ARow were successfully selected as the current cell in the grid.

True if the calculated cell for the movement is selected in the grid control.
True is the navigation order is reversed.
Column number after the navigation request.
Column number after the navigation request.
Direction of movement for the request.
Gets the default horizontal alignment used for values in the grid control.

GetDefaultColumnAlignment is a TAlignment function which provides the default horizontal aligment for text in the columns for the grid control. It is used in the GetColumnAlignment method when Columns are not Enabled for the control. GetDefaultColumnAlignment returns the Alignment value from DefaultTextStyle as stored in the constructor for the class instance.

TAlignment
Default horizontal alignment for the specified column.
Column number is not used in the method
Gets the default width used for the specified column.

GetDefaultColumnWidth is an Integer function which provides the default width used for the specified Column in the grid control. GetDefaultColumnWidth is used in the GetColumnWidth method when Columns have not been enabled for the control. It returns the value stored in the DefaultColWidth property.

Use the indexed ColWidths property to set the width for an individual column when the Columns collection has not been enabled. Or, use Columns collection to maintain the column definitions including their width.

Gets the default vertical layout for text in the specified column.

GetDefaultColumnLayout gets the default vertical layout for text in the specified Column. The DefaultTextStyle property is used as the source for the text Layout, and contains the value assigned in the constructor for the class instance.

GetDefaultColumnLayout is called from GetColumnLayout when a TGridColumn instance cannot be located in Columns for the specified column number. This occurs when Column is invalid for the defined Columns in the control, or when Columns has not been Enabled (contains at least one visible column).

Change values in the DefaultTextStyle property to override the default values assigned in the Create method. Use the Columns collection to change the text layout used in a column when Columns are Enabled.

TTextLayout value for the specified column.
Column number examined in the method.
Gets the default setting for the ReadOnly flag in the specified column number.
Gets the default text used as the column title for the specified column number.

GetDefaultColumnTitle provides the text used for the specified column number when Columns have not been enabled for the grid control. GetDefaultColumnTitle always returns an empty strng ('') in TCustomGrid.

GetDefaultColumnTitle is called from the GetColumnTitle method.

Default text used as the column title for the specified column.
Column number for the default title text.
Gets the default cell editor for the specified column.

GetDefaultEditor is a TWinControl function used to get the default Editor control for the specified column number.

GetDefaultEditor calls EditingAllowed to determine if the column can be edited. When editing is permitted, the Columns collection is used to get the ButtonStyle stored in the TGridColumn instance. If the column uses the cbsAuto button style and has a valid non-empty PickList, the cbsPickList button style is used.

If Columns has not been enabled, the cbsAuto button style is always used for the Editor control.

GetDefaultEditor calls EditorByStyle to create the Editor with the button style needed for the control. The return value is Nil if the column does not allow editing, or the current cell is a fixed column or row header.

For an Editor using the cbsPickList button style, its items and drop-down row count are set using values from the column definition in Columns.

GetDefaultEditor is called from the SelectEditor method prior to selecting the cell and signalling the OnSelectEditor event handler (when assigned). Use the OnSelectEditor event handler to override the Editor style or its configuration.

Control used as the Editor for the specified column number.
Column number examined in the method.
Gets the default height for a row in the grid control.

GetDefaultRowHeight is an Integer function used to get the default height for a row in the grid control.

GetDefaultRowHeight uses a TCanvas instance to get the height for the text displayed in a row. If the control Canvas is unassigned, or does not have an allocated handle, a temporary TCanvas instance is created using the Font for the control. The TextHeight method in Canvas is called to get the return value for the method.

GetDefaultRowHeight is called from the GetDefRowHeight method used to get the value for the DefaultRowHeight property.

What are the 7 additional pixels added to the text height?

Default value used as the height for rows in the grid.
Gets the grid drawing state for the cell with the specified column and row numbers.

GetGridDrawState is a TGridDrawState function used to get the state flags for the cell specified in ACol and ARow. The return value can contain the following enumeration values:

gdFixed
  ARow is one of the FixedRows for the grid.
gdFocused
  ACol and ARow have the same values as the Col and Row properties.
gdSelected
  ACol and ARow have the same values as the Col and Row properties, or the cell is included in a selection range.
gdRowHighlight
  Row highlighting is enabled in Options, Row and aRow have the same value, and the cell is not a fixed cell.
gdPushed
  ACol and ARow match the cached PushedCell coordinates.
gdHot
  ACol and ARow match the cached HotCell coordinates, and the cell is not "pushed".

GetGridDrawState is called from the DrawRow and ShowCellHintWIndow methods.

TGridDrawState instance with the state flags for the specified cell.
Column number for the cell examined in the method.
Row number for the cell examined in the method.
Gets the bitmap used to draw Checkbox columns in the grid.

GetImageForCheckBox signals the OnUserCheckboxBitmap event handler (when assigned) to get a bitmap used for the checkbox state. If a valid TBitmap instance is not assigned in the event handler, the OnUserCheckBoxImage event handler is signalled (when assigned) to get the TImageList, TBitmap, and ImageIndex used for the purpose.

GetImageForCheckBox is used in the implementation of the DrawGridCheckboxBitmaps and DrawCellText methods in TCustomGrid.

Column number for the Checkbox cell.
Row number for the Checkbox cell.
Checkbox state for the cell.
Image list with images used for Checkbox drawing states.
Ordinal position of the image used for the corresponding Checkbox state.
Bitmap with the image drawn for the Checkbox state.
Gets the position for the specified scrollbar.

GetScrollBarPosition is an Integer function used to get the position for the scrollbar specified in Which. GetScrollBarPosition calls the GetScrollInfo routine in the LCL interface to get the TScrollInfo structure with the position for the scrollbar in Which.

The return value contain the position from the TScrollInfo structure. The return value is 0 (zero) if the Handle for the grid control has not been allocated.

GetScrollInfo TScrollInfo
Current position in the secified scrollbar.
Indicates the scrollbar (horizontal or vertical) examined in the method.
Gets the smooth scroll setting in the Options for the grid.
GetSmoothScroll determines whether the smooth scroll setting (goSmoothScroll) has been included in the Options for the grid control.

Needs an explanation of what "smooth scroll" really means.

True when Options contains the value goSmoothScroll.
Not used in the current implementation.
Gets the values for the scrollbar visibility flags in the control.

?

True if the horizontal scrollbar is visible.
True if the vertical scrollbar is visible.
Gets the range values for the scrollbars when visible.
Gets the effective selected state using the control Options and the grid draw state.
Grid draw state values examined in the method.
True when the state and Options values indicate a selected state.
Gets the edit mask for the specified cell.

Always returns an empty string ('') in TCustomGrid. It is overridden in descendent classes.

Edit mask for the specified cell.
Column number for the cell.
Row number for the cell.
Gets the text displayed in the Editor for the specified cell.

GetEditText always returns an empty string ('') in TCustomGrid. It is overridden in descendent classes like TCustomDrawGrid and TCustomStringGrid to signal an OnGetEditText event handler.

GetEditText is called from the EditorDoSetValue method when TGridMessages are dispatched to the Editor to set the edit mask and value used in the control.

Text displayed in the cell editor.
Column number for the editor text.
Row number for the editor text.
Gets the value for the FixedColor property.
Value for the property.
Gets the column number for the first visible non-fixed column in the grid.

GetFirstVisibleColumn is an Integer function used to get the column number for the first visible non-fixed column in the grid. A visible column is one which starts after the fixed columns specified in FixedCols and has a non-zero width for the column in ColWidths.

The return value contains the column number (zero-based) for the column matching the criteria. If a non-fixed column with a non-zero width is not found, the return value is set to ColCount.

GetFirstVisibleColumn is called from the KeyDown method when handling Tab key navigation for the grid control.

Column number for the first visible column.
Gets the row number for the first visible non-fixed row in the grid.
Row number for the first visible row.
Gets the column number for the last visible non-fixed column in the grid.
Position for the last visible column in the grid.
Gets the row number for the last visible non-fixed row in the grid.
Row number for the last visible non-fixed row.
Gets the value for the SelectedColor property.
Value for the properly.
Gets the prefix option for the title in the specified column number.

GetTitleShowPrefix determines whether the DT_NOPREFIX DrawText flag is included in the Canvas text style for the specified column. When GetTitleShowPrefix returns False, the DT_NOPREFIX flag in included in the text style.

GetTitleShowPrefix is called from the PrepareCanvas method when drawing a cell in the fixed rows for the grid.

True when the TGridColumn is configured to use prefixes.
Column number examined in the method.
Gets a TPoint instance with the top and left coordinates for the first visible, non-fixed row in the grid control.
TPoint instance with the coordinates for the row.
Gets the truncated version of the hint for the cell at the specified position.
Truncated text for the cell hint.
Column number for the hint text.
Row number for the hint text.
Returns the column number for the column given its index position.
Performs actions needed when the mouse wheel is scrolled in the grid.
Shift state modifier in effect for the action.
Relative change in the current position for the action.
Performs actions needed when a mouse click occurs in a header for a grid column.

HeaderClick ensures that the value in SortOrder is toggled when Index contains the SortColumn defined for the grid control. SortOrder is set to soAscending when Index contains a column number other than SortColumn. SortColumn is updated in the method to use the value in Index as the active sort column.

HeaderClick calls the Sort method to sort all non-fixed rows in the grid control using the content from the column number in Index.

No actions are perfomed in the method when ColumnClickSorts is set to False.

IsColumn indicates whether the header click applies to a column or a row. When set to True, the mouse click occurred in a fixed header for the column number in Index. This parameter implies that similar handling is provided in the method for a header click on a fixed header in a row. No actions are performed for a header click on a row.

HeaderClick is overridden in descendent classes like TCustomDrawGrid to perform additional actions.

True if the click occurred on a column header.
Column (or row) number for the header click.
Performs actions needed when a column or a row has been resized.

HeaderSized is used to perform actions needed when the header for a column or row has been resized in the grid control.

IsColumn indicates whether the sizing action applies to a column or a row. When set to True, the column header has been resized. When set to False, the row header was resized.

Index indicates the column or row number in the grid where the resizing action occurred.

HeaderSized has an empty implementation in TCustomGrid. It is overidden in descendent classes like TCustomDrawGrid to perform additional actions.

HeaderSized is called from methods like MouseUp (when column or row sizing is completed) and DblClick (when column sizing is enabled in the grid Options).

True if a column was resized, False if a Row was resize.
Column or row number for the resize operation.
Performs actions to resize a column or row to the specified size.

HeaderSizing has an empty implementation in TCustomGrid. It is overridden in descendent classes.

True when the resize action is for a column, or False for a row.
Column or row index resized in the method.
New size for the column or row.
Cancels the current hint display and restores the saved hint for the grid control.

HideCellHintWindow is a method used to cancel the current hint display, and to restore the saved Hint for the grid control. HideCellHintWindow calls the CancelHint method in the Application singleton to discard the current hint window.

Performs actions needed to set the column count in the grid control.

Called when a new value is assigned to the ColCount property (SetColCount).

New column count for the control
Indicates if the specified index position is valid for the columns in the grid.

Returns True when AIndex is a valid column index in the range 0..ColCount-1.

IsColumnIndexValid is used in several methods which access a column definition or data by its ordinal position in the grid control.

True when Index is in range for the column definitions in the grid.
Index position examined in the method.
Indicates if the specified index position is valid for the rows in the grid.

The return value is True when AIndex is in the range 0..RowCount-1.

True when Index is in range for the rows in the grid.
Index position examined in the method.
True when the column index is in the range FixedCols..ColCount-1.
True when the column index is in the range FixedCols..ColCount-1.
Column index position checked in the method.
Indicates if the specified row is a valid, non-fixed row in the grid control.
True when AIndex is a valid, non-fixed row in the grid control.
Row number to examine in the method.
Indicates if the cell at the specified position is a fixed column header.

Returns True when all of the following conditions are satisfied:

- FixedRows contains a positive non-zero value
- ARow contains zero (0) (first row in the grid)
- ACol contains a value >= FirstGridColumn

True if the cell is a fixed column header.
Column number for the cell.
Row number for the cell.
Gets the value for the indexed IsCellSelected property.

Compares the cell coordinates in ACol and ARow to the current range selection(s) in the grid control. The return value is True if the cell is in the current range selection for the control.

If RangeSelectMode is set to rsmMulti, all of the existing range selections are examined for the specified cell. The return is True when the cell is located in the array of rectangles used for multi-selections in the grid control.

Otherwise, the return value is set to False.

Boolean value for the indexed property.
Column number for the cell examined in the method.
Row number for the cell examined in the method.
Indicates if non-fixed cells in the specified row are empty.
True when all non-fixed cells in the specified row contain empty strings ('').
Row number to examine in the method.
Indicates if the specified mouse position is over a button cell editor.
Screen coordinates for the mouse pointer.
Screen coordinates for the mouse pointer.
Handles key down events for the grid control.

KeyDown is overridden in TCustomGrid to ensure that keys handled by the grid or its Editor are properly applied to the control. KeyDown calls the inherited method on entry to signal the OnKeyDown event handler (when assigned) and any key handlers for the control.

CanGridAcceptKey is called to determine whether Key and Shift are ignored in the control.

KeyDown handles the following key codes:

VK_TAB
  Performs cell navigation when goTabs in included in the Options for the grid. Ensures that goAutoAddRowsSkipContentCheck in Options is supported. When TabAdvance is set to aaNone, the key and modifier are forwarded to the Editor control.
VK_LEFT
  Moves to the previous cell when the Editor is not active.
VK_RIGHT
  Moves to the next cell when the Editor is not active.
VK_UP
  Moves the selection to the previous visible row.
VK_DOWN
  Moves the selection to the next visible row.
VK_PRIOR (Page Up)
  Moves upward in the grid by the number of visible rows.
VK_NEXT (Page Down)
  Moves downward in the grid by the number of visible rows.
VK_HOME
  Moves to the first non-fixed row in the grid. The current column is used. When goRelaxedRowSelect is included in Options, the selection is moved to the first non-fixed column in the current row.
VK_END
  Moves to the last non-fixed row in the grid. The current column is used. When goRelaxedRowSelect is included in Options, the selection is moved to the last non-fixed column in the current row.
VK_APPS (Menu Pop-up on PC keyboards)
  Displays the Pop-up menu for the cell Editor when editing is allowed in the column.
VK_F2
  Selects and displays the cell Editor when editing is allowed in the column.
VK_BACK (Backspace)
  Fowards the Backspace character (^H) to the cell Editor when editing is allowed in the column.
VK_C
  Performs a copy to clipboard operation when ssCtrl or ssMeta is in the Shift modifier.
VK_V
  Performs a paste from clipboard operation when ssCtrl or ssMeta is in the Shift modifier.
VK_X
  Performs a cut to clipboard operation when ssShift is in the Shift modifier.
VK_DELETE
  Clears the value in the cell Editor and redraws the current cell when editing is allowed for the column.
VK_ESCAPE
  Resets the value in the cell Editor, and hides the Editor control.

When Key is handled in the method, it is set to 0 (zero).

Called from EditorKeyDown when key down events are enabled in the EditorOptions for the control.

TWinControl.KeyDown
Key code examined in the method.
Shift / Ctrl / Alt modifier for the key code.
Applies the specified key press to the control.

KeyPress is a method used to apply the character in Key to the grid control. KeyPress is overridden to ensure that a key which originated from the grid control is applied properly to the cell Editor (when needed). It calls the inherited method on entry.

The following key press values in Key are handled in the method:

Enter (#13)
  Gets and displays the cell Editor when EditMode is False and the column allows editing.
Backspace (^H) and characters in the range #32..#255 (data)
  Applies the key press to the Editor.

When Key is handled in the method, it is set to #0 prior to exit.

TWinControl.KeyPress
Key press character examined in the method.
Loads values for the grid from the specified XML configuration file.
Configuration file loaded in the method.
Grid version number for the values processed in the method.
Loads design-time grid options for an LCL version from an XML configuration file.
XML configuration file instance examined in the method.
LCL version for the grid option data.
Performs actions when the component has been loaded using LCL component streaming.

Calls the inherited method on entry, and calls VisualChange to resize columns and redraw the grid control.

Locks the Editor so that it cannot accept input or changes.

Increments the value for the internal lock count used for the Editor.

Indicates if the specified mouse button is a mouse down event used in the control.

Called from the MouseDown method to ignore Right mouse clicks at design-time.

True if the specified mouse button is valid for the grid control.
TMouseButton value examined in the method.
Handles mouse down events for the grid control.

MouseDown is overridden in TCustomGrid to ensure that cached grid information in GCache is updated for mouse down events, and both GridState and GridFlags are updated for the control.

MouseDown calls the inherited method to handle focus changes for the control and drag operations. The OnMouseDown event handler is signalled (when assigned) by the ancestor.

No additional actions are performed in the method at design-time, or when the mouse Button is not allowed in the grid control.

MouseDown ensures that the grid control is focused and updates GCache with the coordinates for trhe mouse down event. The grid "hot" zone in the cached information determines the value assigned to GridState, GridFlags, CursorState and the actions perfomed for the mouse event.

gzFixedCells

Sets GridState to gsColSizing when both goColSizing and goFixedColSizing have been included in the Options and the cursor state is gcsColWidthChanging.

Otherwise, GridState is set to gsHeaderClicking. The cell is drawn in a "pushed" state when goHeaderPushedLook is included in Options and the grid zone is in HeaderPushZones.

gzFixedCols

GridState is set to gsColSizing when goColSizing has been included in the Options and the cursor state is gcsColWidthChanging.

Otherwise, GridState is set to gsColMoving. The cell is drawn in a "pushed" state when goHeaderPushedLook is included in Options and the grid zone is in HeaderPushZones.

gzFixedRows

GridState is set to gsRowMoving when goRowSizing is included in Options and CursorState is gcsRowHeightChanging.

Otherwise, GridState is set to gsRowMoving. The cell is drawn using the "pushed" state when goHeaderPushedLook is included in Options and the grid zone is in HeaderPushZones.

gzNormal

When the mouse down event is over a button-style cell, it is drawn in the "pushed" state. No additional actions are needed for the event.

Other cells use the values in Options and CursorState to determine whether the mouse event is for column sizing, selection, or enabling/disabling the cell editor. GridState is updated to the corresponding value.

TControl.MouseDown
Mouse button for the event.
Shift state for the event.
Horizontal coordinate for the mouse event.
Vertical coordinate for the mouse event.
Moves an extended selection.
Moves to the next cell in the auto-advance sequence.
Moves to the next selectable cell.
Signals the OnSelection event handler for a new mouse selection.
Moves to a column or row located at the specified offset.
Index and Rest arguments were changed to output parameters in LCL version 2.1 (revision 65087).
True if a column and row number was identified for the specified offset.
True if the offset is for a column, False for a row.
True for a physical offset, False for a logical offset.
Offset in pixels for the column or row.
Index position for the column or row in the specified offset.
Remaining pixels stating at the value in Index.
Draws the edges, borders, and rows in the grid control.

Paint is an overridden method in TCustomGrid used to update and draw the grid control.

Values in GridFlags and GCache are examined to determine if a visual change to the columns or the client area for the control is in progress. For either condition, the ResetSizes method is called to handle the visual change(s) and the flag values are removed from GridFlags.

Paint calls the inherited method to signal the OnPaint event handler in the ancestor class.

If there are no other active updates for the control, methods are called to draw the edges and all visible rows in the control. If a column move operation is in effect, the Canvas is updated to display a drag cursor with the color defined in the grid. Borders for the control are drawn prior to exiting from the method.

TCustomControl.Paint
Signals the OnPickListSelect event handler when a selection is made in a picklist.

Called from the Select method when the text for the cell value is stored.

Object for the event notification.
Prepares the canvas for drawing the cell at the specified location.

PrepareCanvas ensures that the Canvas for the control is properly configured to draw the cell at ACol and ARow using the drawing state specified in AState. Flags in AState and the values from the Options, Enabled, DefaultDrawing and EditorMode properties determine the Pen, Brush, Font, and TextStyle settings used in the control Canvas.

PrepareCanvas is called from ShowCellHintWIndow when truncated cell hints are enabled in the Options for the grid. It is also called from DrawCell before drawing the filled rectangle and grid lines for the cell.

Column number for the cell.
Row number for the cell.
Drawing state applied to the canvas for the specified cell.
Prepares the control to display hints for a cell.

PrepareCellHints has an empty implementation in TCustomGrid, and may be overridden or re-implemented in descendent classes (like TCustomDBGrid / TDBGrid).

PrepareCellHints is called from the ShowCellHintWIndow method.

TCustomDBGrid.PrepareCellHints
Column number for the cell.
Row number for the cell.
Restores the default width for columns in the grid.

ResetDefaultColWidths updates an internal member with the list of column widths currently in use for the grid. The width for each column is set to -1 to indicate that an explicit value has not been assigned for the column width.

ResetDefaultColWidths calls the VisualChange method after resetting the column widths to their default values. No actions are performed in the method when AutoFillColumns contains True.

Resets the value in the cell Editor, and optionally re-displays and selects it content.

ResetEditor is a procedure used to reset the value in the cell Editor to the stored content for the current cell in the grid control.

ResetEditor calls EditorGetValue to retrieve the value for the current cell and to perform validation using the OnValidateEntry event handler (when assigned). If the column allows editing and goAlwaysShowEditor has been included in the Options for the grid, the EditorShow method is called to re-display the cell Editor and re-select all of the cell content.

ResetEditor is called from the DoExit method when the grid control receives the CM_EXIT control message.

Resets the member used to track the last row or column movement.
Resets the offset, checking columns and rows if needed.
Resets the internal column sizes.

No actions are performed in the method when the internal list of column sizes has not been allocated, during component streaming, or when the handle has not been allocated for the grid control.

Calls UpdateCachedSizes to recalculate the cached grid information in GCache. Calls CacheVisibleGrid to cache the current visible grid (excluding fixed cells).

Resizes the specified column number to the given width.

ResizeColumn is a method used to set the width for the column number specified in ACol to to the value in AWidth.

ResizeColumn ensures that the value in AWidth is at least 0 (zero). A negative column size is invalid. The value in AWidth is stored to the ColWidths property at the index position in ACol.

Use ResizeRow or RowHeights to change the height for a specific row in the grid control.

Column number resized in the method.
New width for the column.
Resizes the specified row number to the given height.
Row number resized in the method.
New height for the row.
Performs actions needed when the values in RowHeights have been changed.
Saves design-time configuration, column, and row settings to an XML file.
TXMLConfig instance where the content is stored.
Saves grid options to the specified XML configuration file.

Stores TGridOption and TGridOption2 enumeration values found in the Options and Options2 properties to the XML configuration file specified in cfg. Used in the implementation of the SaveContent method.

Use LoadContent to load option settings into the current grid class instance.

XML configuration file where values are stored.
Sets the range for the specified scrollbar.
Sets the position for the specified scrollbar to the given value.

ScrollBarPosition is a method used to set position for the scrollbar specified in Which to the new Value.

Which contains either SB_Horz or SB_Vert, and identifies the scrollbar affected in the method.

Value contains the new position for the scrollbar.

ScrollBarPosition uses the SetScrollInfo routine to update the scrollbar position. It allocates the TScrollInfo structure and stores Value as the scrollbar position in the structure.

ScrollBarPosition calls ScrollBarIsVisible to determine if the scrollbar in Which is visible. The visibility is used when calling SetScrollInfo.

No actions are performed in the method if the Handle has not been allocated for the grid control.

Scrollbar updated in the method.
New position for the scrollbar.
Returns True if the specified scrollbar is visible.
Performs a page movement of the specified scrollbar.
ScrollBarShow method.

ScrollBarShow is a procedure used to control the visibility of scrollbars in the grid.

Which is an Integer argument that specifies the scrollbar(s) affected in the method, and can include the following constant values:

SB_HORZ
  Horizontal scrollbar
SB_VERT
  Vertical scrollbar
SB_BOTH
  Both horizontal and vertical scrollbars

aValue is a Boolean argument that indicates if the specified scrollbar(s) are visible or hidden. When aValue contains True, the corresponding scrollbar(s) are displayed. Otherwise, they are hidden.

No actions are performed in the method if a handle has not been allocated for the grid (HandleAllocated returns False). ScrollBarShow ensures that gfUpdatingScrollbar is included in the grid flags prior to calling the ShowScrollBar routine in the LCL interface. The flag value is removed immediately after updating the scrollbar display. Internal members used to track scrollbar visibility are set to the state requested in AValue.

TWinControl.HandleAllocated ShowScrollBar
Scrollbar(s) affected in the method.
True indicates the scrollbar(s) are visible.
Indicates whether an automatic scroll bar of the given type is used on the grid control.

Translates the value in Which to the automatic equivalent (ssAutoVertical, ssAutoHorizontal, ssAutoBoth), and checks the ScrollBars property for the value(s).

TScrollStyle
True if an automatic scroll bar is used for the specified type.
Scroll bar type (ssHorizontal or ssVertical) checked in the method.
Scrolls the non-fixed area for the control by the specified delta values.

Calls ScrollWindowEx to perform the scrolling operation for the non-fixed client area in the control. No scrolling is performed when both DeltaX and DeltaY contain 0 (zero).

Updates the visible grid area in the cached information for the control, and recalculates the scrollbar ranges.

TWinControl.ScrollBy
Gets the cell editor for the current cell, and sets its PopupMenu.

Calls GetDefaultEditor to retrieve the default Editor used for the column where the current cell is located (Col).

In situations where the current cell is not selectable in the grid, when FixedGrid is True as an example, the default cell Editor is set to Nil. The OnSelectEditor event handler is signalled (when assigned) to determine if a cell Editor (or none) is available for the editable column.

If an Editor has been assigned, but does not have a PopupMenu, the PopupMenu for the grid control is used in the Editor.

SelectEditor is called when goEditing is included in the Options for the grid control. It is also called when Options is configured to always display cell editors (goAlwaysShowEditor), and an editable non-fixed cell is selected in the MouseDown method. Similarly, it is called from MouseUp when a mouse click selects a new editable cell in the grid control.

Determines whether the specified cell can be selected in the grid control.

SelectCell is a Boolean function used to determine whether the cell specified in ACol and ARow can be selected in the grid control. The return value is True when both ColWidths and RowHeights have positive non-zero values for the column and row numbers where the cell is located.

SelectCell is used in the implementation of methods like TryMoveSelection, CheckPosition, SelectEditor, and GetDeltaMoveNext. It is overridden in TCustomDrawGrid to signal the OnSelectCell event handler (when assigned).

Component developers may use the SelectCell method to react to focus changes. The Result is true if the cell can be selected.

True when the cell can be selected in the grid control.
Column number for the cell.
Row number for the cell.
Sets the Canvas font to the specified value.

SetCanvasFont is used to assign the TFont instance in AFont to the Canvas for the grid control.

Different fonts can be used to render the title in fixed headers and the data in the cells. The font used determined (and assigned) when the PrepareCanvas method configures the Canvas to draw cells in the grid. SetCanvasFont ensures that new font is stored in an internal member when the font is assigned to the Canvas.

Font applied to the canvas for the grid.
Sets the value in the ColCount property.
New value for the property.
Sets the value in the Color property.
TControl.Color
New value for the property.
Makes the specified column and row the selected cell in the grid.
Column number for the selected cell.
Row number for the selected cell.
Changes the cursor shape in the grid to the specified value.

SetCursor is an overridden method in TCustomGrid. SetCursor calls the inherited method to perform the CM_CURSORCHANGED message for the control, and calls ChangeCursor to save the previous Cursor and apply the shape in AShape to the Cursor property.

Cursor shape used for the mouse pointer in the grid.
Sets the value used in the cell Editor to the specified text.

Sets the the text displayed in the Editor for the cell at the position specified in ACol and ARow to the given value.

SetEditText has an empty implementation in TCustomGrid. It is overridden in TCustomDrawGrid to signal the OnSetEditText event handler (when assigned).

SetEditText is used in KeyDown when the Escape key (VK_ESCAPE) is not handled by the grid control. It is called from the EditorGetValue method when a visible cell Editor is updated. It is called from EditorTextChanged method when the value in a cell Editor has been altered using the Change or Select methods in the editor control.

Column number for the editor value.
Row number for the editor value.
New value for the cell Editor.
Sets the value for the BorderStyle property.
New value for the property.
Sets the value for the FixedColor property.
New value for the property.
Sets the value for the FixedCols property.
New value for the property.
Sets the value for the FixedRows property.
New value for the property.
Sets the width for the specified column number in the internal list.
Column number for the specified width.
Width in pixels for the specified column.
Sets the value for the SelectedColor property.
New value for the property.
Gets and displays the cell hint(s) for the current cell in the grid.

ShowCellHintWindow is a procedure used to gets the value(s) and display cell hint(s) for the cell located at the screen position in APoint. Values in the Options and CellHintPriority properties determine the text available for use as cell hints.

GetCellHintText and GetTruncCellHintText are called to get the corresponding hint text for the options and hint priority. AddToHint is called to apply the derived text to the values displayed in the control using its Hint property. Application.ActivateHint is called to display the hint window.

No actions are performed in the method when ShowHints contains False, when the mouse pointer is not positioned over a grid cell, when EditorMode is True, or at design-time.

Screen coordinates for the mouse pointer.
Performs actions needed when the number or columns or rows has been changed.

SizeChanged has an empty implementation in TCustomGrid. It is overridden in TCustomDrawGrid to perform a notification when the column and/or row count has been changed for the control.

Previous number of columns.
Previous number of rows.
Sorts rows or columns in the grid.

Sort is a method used to sort items in the grid. When ColSorting is True, it sorts the items in a column. Otherwise, it sorts a row. The three index values specify the items to be sorted.

Indicates if the sort is performed for a column or a row.
Starts an operation to render a cell in its "pushed" state.

StartPushCell updates the GridState property to the value gsButtonColumnClicking, and calls the DoPushCell method to cache and redraw the clicked cell.

StartPushCell is called from the MouseDown method when a mouse click has occured over a cell using a button-style Editor in the non-fixed area for the grid control.

Signals the OnTopLeftChanged event handler (when assigned) at run-time.

TopLeftChanged occurs when the origin for the scrollable area in the control has been changed.

TopLeftChanged is called from methods like TrySmoothScrollBy, UpdateCachedSizes, and FixPosition. It is also called when the AutoFillColumns property is set to True.

Tries to move the selection by the specified offset; returns True if successful.
Decrements the lock count for the cell Editor following a call to LockEditor.

LockEditor and UnlockEditor are used to surround operations where a cell Editor is hidden or the focus is changed as a result of keyboard navigation or a mouse click event.

UnlockEditor is called from methods like: MouseDown and EditorHide.

Re-implemented in descendent classes.

UnprepareCellHints has an empty implementation in TCustomGrid, but it overridden in descendent classes (like TCustomDBGrid / TDBGrid).

UnprepareCellHints is called from the ShowCellHintWindow method.

Updates the horizontal scrollbar to use the specified range, page, and position.

UpdateHorzScrollBar calls ScrollBarShow to updated the scrollbar visibility when it differs from the value in aVisible. The ScrollBarRange is called to apply the values in ARange, APage, and APos to the horizontal scrollbar for the control. No actions are performed if the visibility has not been changed and the scrollbar is not visible.

UpdateHorzScrollBar is called from the CalcScrollbarsRange method when the visible area in the grid is scrolled.

True if the scrollbar is already visible.
Maximum position for the scrollbar.
Page size for a thumb tab in the scrollbar.
Position for the scrollbar.
Updates the selection range when the grid has changed.

UpdateSelectionRange is a method used to update the Selection property with the cell coordinates for the current cell or row in the grid control. UpdateSelectionRange creates a new TRect instance with the cell coordinates representing the current selection in the grid.

UpdateSelectionRange uses values in Options to determine whether the rectangle represents a single cell or the current Row. When goRowSelect has been included in Options, the rectangle contains the non-fixed column and last column numbers in the current Row. Otherwise, the rectangle uses the value in Col and Row to represent both the start and end cells for the Selection.

UpdateSelectionRange is called from the ClearSelections and FixPosition methods.

Updates the vertical scrollbar to use the specified visibility, range, and page values.
True if the scrollbar should be visible.
Updates the border style used for the control.

UpdateBorderStyle is a method used to apply a BorderStyle for the control that is valid for the value in the Flat property. When Flat is set to False, the value in BorderStyle is used. When Flat is True, the value bsNone is always used as the BorderStyle for the control.

UpdateBorderStyle calls the inherited SetBorderStyle method to apply the derived value to the BorderStyle property.

UpdateBorderStyle calls VisualChange to refresh the control after the change to the property, and validates the Top and Left for the visual area in the grid. These actions are not performed if the Handle has not been allocated for the control, or during LCL component streaming.

UpdateBorderStyle is called when the value for the Flat property has been changed.

Validates the value for the specified cell.

ValidateEntry is a Boolean function used to a validate the value for the cell at the specified Col and Row position.

ValidateEntry signals the OnValidateEntry event handler (when assigned) to perform validation for the cell. The return value is True when OnValidateEntry completes successfully, or when the event handler has not been assigned.

True when validation completes successfully.
Column number for the operation.
Row number for the operation.
Value on entry to the method.
Value on exit from the method.
Updates the grid after changes to the visual properties in the control.

VisualChange is a procedure used to update the grid when visual aspects of the control have been changed. VisualChange calls UpdateSizes to refresh the size of cells in the grid, and calls Invalidate to force the control to be redrawn.

No actions are performed in the method when BeginUpdate has been called to buffer updates to the grid. VisualChange will resume updates when EndUpdate has been called to disable update buffering.

Handles a WM_SIZE window message for the control.

Ignores the message when updating scrollbars (gfUpdatingScrollbar in GridFlags). Otherwise, the inherited method is called to handle the window size message.

TWinControl.WMSize
Message handled in the method.
Handle the system message for horizontal scrolling.
Handles the system message for vertical scrolling.
Allows a mouse click on an out-of-bounds cell; moves cursor to nearest valid cell.

Normally, when a user clicks on a point over the empty space after cells (for example if grid has three rows but user clicks on imaginary fourth row) the current focused cell will move to the nearest cell to clicked point. We call this an outbound event.

The default value or the property is True, as this has been the grid's behavior since the beginning.

This was added to mimic Delphi behavior where outbound events are not available; to enable Delphi compatibility, set AllowOutboundEvents to False.

Color used for the background in alternate rows in the grid.
The color to be used for the background on alternate rows of the grid. Having alternate rows in different colors can make the grid easier to read
Direction used when automatically moving the selection to the next selectable cell.

AutoAdvance is a TAutoAdvance property which indicates the direction of movement applied when the Enter key is pressed to finish editing in an active cell Editor.

The default value for the property is aaRight, and indicates the cell selection advances to the right until it reaches the last column in the grid control. Use aaNone to disable the auto-advance feature.

For more information about acceptable values and their usage, please refer to TAutoAdvance.

AutoAdvance is used in methods like MoveNextAuto and CheckPosition.

Use TabAdvance to control the direction of movement used when the Tab key is pressed.

Indicates if edit mode is automatically entered when a cell is selected.

AutoEdit is a Boolean property which indicates if edit mode is automatically entered when a cell is selected in the grid control. The default value for the property is True.

When AutoEdit is set to True, the cell Editor is automatically displayed when a non-fixed cell is entered using keyboard navigtation or a mouse click. When AutoEdit is set to False, the cell Editor is not displayed until toggled. Use the F2 or Enter key to activate a cell Editor. Use a second mouse click in the active cell to display the cell Editor.

AutoEdit does not allow a cell to be edited if the column definition in the Columns collection is defined as ReadOnly.

Use the Options property to enable or disable editing in the grid control using the value goEditing. Use the value goAlwaysShowEditor to always display the cell Editor.

Indicates whether columns are automatically resized to fill the visible area in the grid.

AutoFillColumns is a Boolean property which enables or disables automatic sizing for columns on the grid control. The default value for the property is False, and indicates that automatic column sizing is not enabled.

Changing AutoFillColumns to True causes the column sizes to be recalculated (and cached) based on default values , or using properties assigned to the TGridColumn instances when the Columns collection has been Enabled. The resizing algorithm works as follows:

- Fixed Columns are not resized.
- When Columns has not been Enabled, or the column position is not found in Columns, a default sizing priority of 1 is used along with the minimum and maximum sizes defined in the DEFMINSIZE and DEFMAXSIZE constants.
- When Columns is Enabled, and a column exists at a given position, values from the TGridColumn instance are used including: SizePriority, MinSize, and MaxSize.
- A column with a SizePriority of 0 is not resized.
- A column with a non-zero value in SizePriority is adjusted using the average available width with respect to the MinSize and MaxSize for all of the defined columns.
- If Columns is not Enabled or populated, or all columns have a SizePriority of 0, the last column in the grid is resized to the available width.

Note that TGridColumn instances in Columns are initially created with SizePriority set to 1. For TDbGrid, which automatically populates Columns, this means the user will not be able to resize these columns using the mouse (since they are auto-sized).

Use ColWidths to set the width for a specified column when the Columns collection has not been enabled or populated.

Drawing style used for the borders on the control.

Only a restricted range of values are available in TCustomGrid: a single border or none.

TWinControl.BorderStyle
The color used for the border on the control.
Identifies how text is combined to form the Hint property.

CellHintPriority is a TCellHintPriority that identifies how text is combined to form the Hint property. The default value for the is chpAllNoDefault. See for a description of the enumeration values and their meanings.

CellHintPriority is used in the implementation of the ShowCellHintWindow, MouseMove, and GetTruncCellHintText methods.

Column index for the selected grid cell.

Col is an Integer which holds the column index for the current cell or grid cursor. The current grid column can be changed programmatically by setting a new value in this property.

Setting a new value for the property causes the limits for the column index to be checked when AllowOutboundEvents is set to False. An exception is raised in the CheckLimitsWithError method when the property value is not a valid column index for the grid control.

MoveExtend is called to move the selection to the cell at the coordinates in Row and Col. The cell editor is also retrieved (when available) and is displayed.

MoveExtend is called to move the selection to the cell at the coordinates in Row and Col. The cell editor is also retrieved (when available) and is displayed.

Number of columns in the grid.

ColCount is an Integer that represents the number of columns in the grid, including fixed and normal columns. Changing the value in ColCount after Columns have been created causes an EGridException to be raised. Use the Columns collection to add or delete columns defined in the grid.

Use FixedCols for the number of fixed columns in the grid.

Use VisibleColCount for the number of non-fixed columns in the grid.

Use RowCount, FixedRows, and VisibleRowCount to access the row-oriented equivalents.

Raises an EGridException when the value is changed and Columns already exist in the grid.
Provides access to current column and row numbers as a TPoint instance.

ColRow is a TPoint property used to provide access to the current values at the position specified in Col and Row. The X member in TPoint is used for the value in the Col property. The Y member in TPoint is used for the value in the Row property.

Setting the value for the causes the CheckLimitsWithError method to be called for the X and Y values when AllowOutboundEvents is False. The SetColRow method is called to update the values in the Col and Row properties.

Cursor shape displayed when a column is dragged.
Color used to render the drag cursor when a column or row is dragged in the grid.
Cursor shape displayed when a column is resized.
Indicates if clicking a column header changes its sort order.

ColumnClickSorts is a Boolean used to indicate if clicking a column header changes its sort order. The default value for the is False.

ColumnClickSorts is used in the HeaderClick method to determine if the value in the SortOrder is toggled for a click in the header cell for SortColumn.

Definitions for the columns in the grid.

Columns is a TGridColumns used to represent column definitions for the grid control. Columns contains the TGridColumn instances which define the attributes for the column such as its Font, Color, Alignment, Layout, Editor style, auto-sizing priority, et. al. Properties and methods in Columns can be used at run-time to access and maintain the column definitions for the grid.

See TGridColumn for more information about the items stored in the collection.

Columns should not be confused with the COLUMNS construct frequently used in SQL programming, which refer to Fields of data. The contents of Fields can be displayed as Columns in a Grid, but they must be seen as separate and distinct. It is irrelevant to refer to the color, font or width of a data field from a database, but these are all very relevant in specifying the appearance of a column in a grid.

Provides indexed access to the Width of the column in the grid.

The column is specified with the aCol parameter. The aCol parameter must fall within the valid index range of 0 to ColCount-1.

The property value is the width of the specified column in pixels.

The initial width for a newly created column is specified with the DefaultColWidth property.

If the Options property includes the value goColSizing, the column width may also be changed by the user at run-time.

Default width used for newly created grid columns.

If new columns of the grid are created by changing the ColCount property, the width of these new columns will be set to the value of the DefaultColWidth property.

Use 0 for an auto-sized column width.

Use GetRealDefaultColWidth for the real value.

Default row height for newly created grid rows.

If new rows of the grid are created by changing the RowCount property, the height of these new rows will be set to the value of the DefaultRowHeight property.

Use 0 for auto-sized row heights.

Use GetRealDefaultRowHeight for the real value.

Indicates if the default drawing mechanism is used to draw the background for cells.

DefaultDrawing is a Boolean property which indicates if the default drawing mechanism is used to draw the background for cells. The default value for the property is True.

Normally, the grid prepares its canvas using the properties needed for the kind cell type that is being painted. DefaultDrawing indicates that the grid control handles drawing the background for the cell (including a visible cell Editor) using the relevant properties.

Use the OnDrawCell event handler to handle drawing the value for the cell. Set DefaultDrawing to False when the OnDrawCell event handler is responsible for both the background and content in the cell.

Changing the value for the property causes the Invalidate method to be called to redraw the control.

DefaultDrawing is used in the PrepareCanvas method to configure the control Canvas for a drawing operation.

Default style used to display text; includes alignment, layout, and wrapping.
Color used to draw text in the grid when Enabled is set to False.
The amount (DeltaX) by which an object should be dragged.
The editor used to modify the value in the current cell.

Editor is a TWinControl descendant which contains the control used to edit the value in the current cell for the grid control.

There are several editor styles available for columns in the grid control: String, Button, Composite, and Pick List. Button editors display a button that can be clicked to perform actions which determine the value for the cell. A composite editor uses an editor for the string value and a button for additional actions. A pick list editor allows selection of oneof the predetermined values for the cell. The String editor is essentially a TEdit control, and is the default editor style used in the grid control.

The Editor style is determined either by examing values in the column definition stored in the Columns property, or using the OnSelectEditor event handler. OnSelectEditor is signalled when Columns has not been Enabled in the grid.

Editor display behavior is controlled by properties like Options and AutoEdit.

Options can be used to enabled / disabled cell editor features using the following:

goEditing
  Cell editing is allowed for the grid control. Omit to disable cell editing.
goAlwaysShowEditor
  The cell editor for the current cell is always displayed. Omit to disable. The cell editor can be toggled using F2, Enter, or a mouse click in the current cell.

The AutoEdit property determines whether a cell is automatically placed in edit mode as soon as it is selected. This is basically the same as including goAlwaysShowEditor in the Options property.

The border style for the Editor control.

EditorBorderStyle is a name property which contains the border style used for the Editor in the grid control. The value for the property depends on the editor style used for the cell in the grid.

When TStringCellEditor, TCompositeCellEditor, or TPickListCellEditor are used for the cell, the property value is read from the BorderStyle in the editor control. For all other editors (TButtonCellEditor), the value bsSingle is returned as the property value.

Setting a new value for the property causes the BorderStyle for the Editor to be updated, and the EditorPos method is called to recalculate the editor bounds and position.

True when the Editor is ready to modify the value for the current cell.

EditorMode is a Boolean property which indicates whether the cell Editor has been enabled for the grid control. Set EditorMode to True to display the cell Editor for the control. Set it to False to hide the cell Editor.

The value in EditorMode is updated when handling key presses and mouse clicks, scrolling the visible area for the control, or changing the configration of the grid.

Indicates if the last key event was triggered by the cell Editor for the grid control.

EditorKey is a Boolean property which indicates if the last key event was generated by the cell Editor for the grid control. The property value is updated in the OnKeyDown, OnKeyPress, and OnKeyUp event handlers used in the Editor control. Its value is used in method like KeyDown, KeyPress, and KeyUp to determine whether a given key needs to be applied / handled for the grid control.

The option flags sent to the Editor control in the grid.

EO_HOOKKEYDOWN enables the OnKeyDown event handler in the editor control. EO_HOOKKEYPRESS enables the OnKeyPress event handler in the editor control. EO_HOOKKEYUP enables the OnKeyUp event handler in the editor control.

True when the cell Editor for the grid control has been displayed.

EditorShowing is a Boolean property which indicates if the cell Editor for the control has been displayed. The property value is updated in methods like EditorShow and EditorHide when the visibility for the Editor control is changed.

The property value is used in several methods which handle key events, mouse clicks, and focus changes in the control.

Indicates if extended column sizing is enabled in the grid.
Indicates if extended row sizing is enabled for rows in the grid.

ExtendedRowSizing is a Boolean property which indicates if extended row sizing is enabled for the grid control.

ExtendedRowSizing is not maintained in any methods in the class implementation. It is used in DoRowSizing only.
Indicates whether a selection can extend beyond the visible boundary for he grid.
Indicates if "Fast Editing" is enabled in the grid.

FastEditing is a Boolean property which indicates if cell editing initialized by a KeyDown message instead of a navigation key is used in the grid control. The value in FastEditing is used when a TPickListCellEditor handles KeyDown messages.

The default value for the property is True as assigned in the Create constructor.

Indicates if alternate row coloring starts with the normal row color.

AltColorStartNormal - using a second color to display alternate rows, but starting the first row with the normal color.

Using a different color for the background of alternate rows often makes the data in a grid much easier to read.

The number of fixed columns in the grid.

Contains the fixed column count for the grid. A fixed row with fixed columns is normally used to display the headings (titles), images, and sort indicators for the columns in the grid control. The fixed row containing the fixed columns is not scrolled along with the visible area for grid.

Setting a new value for the property causes several actions to be performed for the grid control.

- The values in FixedCols and FixedRows are verified by calling CheckFixedCount, which can raise an exception if an error condition is detected.
- EditorMode is set to False to hide a visible cell Editor for the control.
- When Columns has been Enabled, UpdateSelectionRange is called to refresh the selection range for the control. ColumnsChanged is called to apply the visual change in the control. If Columns has not been Enabled, MoveNextSelectable and UpdateSelectionRange are called to refresh the grid control.

Use FixedRows to get or set the number of fixed rows displayed for the grid control.

Number of the fixed rows in the grid.

Contains the fixed row count for the grid control. A fixed row with fixed columns is normally used to display the headings (titles), images, and sort indicators for the columns in the grid control. The fixed row containing the fixed columns is not scrolled along with the visible area for grid.

Setting a new value for the property causes several actions to be performed for the grid control.

- The values in FixedCols and FixedRows are verified by calling CheckFixedCount, which can raise an exception if an error condition is detected.
- EditorMode is set to False to hide a visible cell Editor for the control.
- MoveNextSelectable is called to find the first selectable cell in the current column. UpdateSelectionRange is called to refresh the cell selected in the grid control.

Use FixedCols to get or set the number of fixed columns displayed for the grid control.

The color used for the fixed cells in the grid.

FixedColor is a TColor property with the color used to paint the background for fixed cells in the grid control. The default value for the property is clBtnFace. Changing the value in FixedColor causes the Invalidate method to be called to redraw the control.

Use Color to specify the background color for non-fixed cells in the grid control. Use AlternateColor to specify the background color used for alternate rows in the grid control.

Use the Color property in Font to specify the color used for text drawn in the cells for the grid. Use DisabledFontColor to specify the color used for text when the control is disabled.

Other colors can be supplied using properties including: BorderColor, GridLineColor, FixedGridLineColor FixedHotColor, FocusColor, and SelectedColor.

Color used to draw lines around fixed grid cells.

The default value for the is cl3DDKShadow as assigned in the constructor. Changing the value in FixedGridLineColor causes the grid to be redrawn. The color is not used when GridLineWidth contains the value 0 (zero).

FixedGridLineColor is used in the implementation of the DrawCellGrid method.

The color used for selected, hot-lighted, etc. fixed cells in the grid.
FixedHotColor
Indicates if cells are displayed using a Flat appearance.
The color used for a cell when it has focus.
Indicates if the focus rectangle is visible for the control.
Contains cached data about the visual layout and state for the grid control.
Contains grid-specific state flags active for the control.

GridFlags is a TGridFlags property which contains values that indicate the state or status for the grid control or its editor. It is a set type and may contain zero (0) or more values from the TGridFlagsOption enumeration.

Values are included in or excluded from the set as needed during execution of methods in the grid control. See TGridFlagsOption for more information about the values in the enumeration and their meanings.

Total height for all of the rows in the grid control.

GridHeight is a read-only Integer property which contains the calculated height for all of the rows in the grid control. Its value is provided using the cached values stored in GCache when row or column sizes are calculated for the control.

Color used for the grid lines on the control.

GridLineColor is a TColor property with the color used to draw the grid lines between rows and columns on the control. The default value for the property is clSilver. Changing the value for the property causes the grid control to be redrawn.

GridLineColor is used in the DrawCellGrid method to draw the lines around non-fixed cells when GridLineWidth has a non-zero value.

Use FixedGridLineColor to set the color used to draw grid lines around fixed rows and columns on the control.

Style used to draw the grid lines on the control.

GridLineStyle is a TPenStyle property with the pen drawing style used to draw grid lines on the control. The default value for the property is psSolid. Changing the value for the property causes the grid control to be redrawn.

GridLineStyle, GridLineWidth, GridLineColor, and FixedGridLineColor are used in the DrawCellGrid method when GridLineWidth is set to a positive non-zero value.

TCanvas.Pen TPen.Style TPenStyle
Width (thickness) for grid lines drawn on the control.

GridLineWidth is an Integer property which contains the thickness for the grid lines drawn on the control.

The default value for the property is 1, and causes a single pixel to be used when drawing grid lines. Changing the value for the property causes the grid control to be redrawn.

GridLineWidth is used in the DrawCellGrid method when grid lines are drawn for both fixed and non-fixed cells. Set GridLineWidth to 0 to suppress drawing of grid lines on the control.

Total width for all columns in the Grid including non-visible columns.

GridWidth is a read-only Integer property which contains the calculated width for all of the columns in the grid control, including columns with the visible property set to False. Its value is provided using the cached values stored in GCache when row or column sizes are calculated for the control.

'Hot' zones for cell headers that can be selected, clicked, or ignored.
"Hot" zones for cell headers that have been selected or "pushed" in the grid.
Ordinal position for the image used for columns sorted in ascending order.
Ordinal position of the image used for columns sorted in descending order.
Controls the behavior for Tab navigation in the grid control.

TabAdvance is a TAutoAdvance used to determine the behavior for Tab navigation is used in the grid control. The default value for the is aaRightDown. See TAutoAdvance for the values and their usage.

TabAdvance is used in the implementation of the KeyDown method in TCustomGrid.

The list with images displayed in column titles.

TitleImageList is a TImageList property which contains the images displayed in the title area for columns in the grid. It can include images used for the non-native column sort indicators.

Setting a new value for the property causes the VisualChange method to be called to update the column sizes and redraw the control.

TitleImageList is used to get an image resolution using the width specified in TitleImageListWidth. The images are used when rendering the TGridColumn instances in the Columns collection.

Stores the default width for images used in the title area for fixed cells.

TitleImageListWidth is an Integer which stores the default width for images used in the title area for fixed cells. The default value for the is 0. Changing the value in TitleImageListWidth causes the VisualChange method to be called to update the grid control.

The value in TitleImageListWidth is used in methods which draw fixed cells in the grid, such as:

- DrawColumnTitleImage
- AutoAdjustColumn
- GetSortTitleImageInfo

Cell editor for the grid control.

InplaceEditor is a read-only TWinControl property that represents the cell Editor for the control. Read access is redirected to the member variable used for the Editor property. It is provided for Delphi code compatibility. Use the Editor property instead.

Provides indexed access to the selected state for a cell by its column and row number.

IsCellSelected is an indexed Boolean property which provides access to the selected state for a cell using its column and row number. ACol and ARow contain the column and row number for the cell.

Compares the cell coordinates in ACol and ARow to the current Selection in the grid control. The return value is True if the cell is in the cell range in Selection.

If RangeSelectMode is set to rsmMulti, all of the existing range selections are examined for the specified cell. The property value is True when the cell is located in the array of rectangles used for multi-selections in the grid control.

Otherwise, the property value is set to False.

True when the cell at the specified column and row is selected.
Column number for the cell examined in the method.
Row number for the cell examined in the method.
Column number for the first visible column on the left edge of the grid.
Sets the mouse wheel behavior for the grid control.

MouseWheelOption is a TMouseWheelOption used to set the mouse wheel behavior for the grid control. The default value for the is mwCursor, and indicates that mouse wheel movements change the cursor position on the screen. Use mwGrid to cause mouse wheel movements to change the active selection in the grid control.

Contains the set of optional features and/or behaviors enabled for the grid.

Options is a TGridOptions used to store the options enabled for the grid control. Values from the TGridOptions enumeration are included in the set type to enable the features or behaviors. For a list of available options and their usage, see.

The default value for the Options is the DefaultGridOptions set.

Use Options2 to set scrolling behaviors enabled for the grid control.

Contains additional options enabled for the grid control.
Controls the range selection mode used for the grid.

RangeSelectMode is a TRangeSelectMode property that controls the range selection mode used for the grid. The default value for the is rsmSingle, and allows selection of a single cell in a range. Use rsmMulti to select multiple cells in a range selection.

Changing the value in RangeSelectMode causes the ClearSelections method be called to remove existing selection(s) in the grid control.

RangeSelectMode is used in the implementation of methods like:

- AddSelectedRange
- GetIsCellSelected
- MouseDown
- InvalidateCell

Row number for the selected grid cell.

Row is an Integer property which contains the row index for the currently selected cell in the grid control. The value in Row is zero-based, and cannot exceed the value RowCount-1.

Setting a new value for the property causes the values in Col and Row to be validated against the ColCount and RowCount for the grid. Error checking is used, and an exception may be raised if the new property value is not in the limits for the control. The selected cell in the control is changed to the new values in the Col and Row properties.

Use Col to determine the column number for the currently selected cell in the grid control.

Number of rows in the grid.

RowCount is an Integer property which contains the number of rows in the grid control, including fixed and normal rows.

Changing the value in RowCount causes a visible Editor in the control to be hidden, and EditorMode is set to False. When the Columns collection is Enabled, the ColumnsChanged method is called. Setting RowCount to 0 (zero) causes the ClearRows method to be called.

Use ColCount to access the number of columns for the grid control when Columns has not been enabled.

Use Col and Row for the current cell selected in the control.

Cursor shape displayed when the row height is changed.
Provides indexed access to the height for each row in the grid.

The row is specified with the aRow parameter. The aRow parameter must fall within the valid index range of 0 to RowCount-1.

The return value of the is the height of this row, measured in pixels.

The initial height of a newly created row is specified with the DefaultRowHeight property. After that the user may redefine this value. If the Options includes the appropriate value, the row height may also be changed by the user at run-time.

Row number affected in the method.
Options which control the information saved for the grid.

These options are used when saving grid information, and includes design information, column attributes, cell content and positions. SaveOptions determines the data available when loading grid information.

Indicates if a Selection is active in the grid control.

SelectActive is a Boolean property which indicates if a Selection range is active in the grid control. It is set to True when a cell or range of cells is selected using the keyboard or mouse navigation, or by assigning a value to the Selection property. It is set to False in methods like CancelSelection, DoExit, and DoMouseWheel.

Color used for selected cells in the grid.

SelectedColor is a TColor property which contains the color used for the background in selected cell(s). SelectedColor is used in PrepareCanvas to set the brush color for the control Canvas when IsSelected is True. The default value for the property is clHighlight as assigned in the constructor for the class instance.

Changing the value in SelectedColor causes the Invalidate method to be called to redraw the control.

The column instance for the currently selected cell in the grid control.

SelectedColumn is a read-only TGridColumn property which contains the column instance for the current column. Col contains the column number for the selected cell in the grid control, and is used to located the column instance by calling ColumnFromGridColumn. The property may contain Nil if Columns has not been enabled in the control, or when a valid column definition is not found for the current column number.

Rectangle with the current cell selections in the grid control.

Selection is a TGridRect property with the column and row numbers for the current cell selection in the grid control. The Left and Right members in the property value are column numbers for the cells in the selection. The Top and Bottom members in the property value are row numbers for the cells in the selection.

Selection is used when goRangeSelect has been included in the Options for the grid.

When a new grid rectangle is assigned for the property, the member values in the rectangle are normalized to ensure they are in the acceptable range of values for the grid control. If all four members have negative values, the current Selection is cleared by calling ClearSelection.

Column or row numbers in the rectangle are adjusted to exclude FixedCols and FixedRows.When goSelectionActive has been included in the grid Options, the current selection is extended to include the new selection range. The Invalidate method is called to redraw the grid control with the new Selection value.

A value assigned to Selection is ignored when goRangeSelect has not been included in the Options for the grid.

Scrollbars displayed for the grid control.

ScrollBars is a TScrollStyle property which indicates the scrollbars displayed for the grid control. The default value for the property is ssAutoBoth and causes vertical and horizontal scrollbars to be displayed when needed.

See TScrollStyle for more information about values in the enumeration and their meanings.

TScrollStyle
Indicates if strict sorting is used.
The font used for text in a column title.

TitleFont is a TFont property with the font used for the text in a fixed column title. By default, TitleFont uses the same Font assigned to the grid control.

The OnTitleFontChanged event handler is used as the OnChange event handler for TitleFont, and ensures that updates to TitleFont are also applied to TGridColumn instances in the Columns collection (when enabled). In addition, the font in TitleFont is ignored when Columns has been Enabled; the Font assigned to the Title property for the TGridColumn instance is used instead.

GetColumnFont is called from PrepareCanvas to determine whether TitleFont or a font defined in the Columns collection is used to render the text in fixed cells.

Assigning a new value to TitleFont causes the VisualChange method to be called to recalculate column sizes in the grid control.

Font sizes (in both Font, TitleFont, and TGridColumn instances) may be scaled at run-time to provide support for high density displays. See ScaleFontsPPI for more information.

The drawing style used for the fixed column titles.

TitleStyle is a TTitleStyle property which contains the drawing style used when rendering the fixed cells with the column titles. Changing the value in TitleStyle cause the Invalidate method to be called to redraw the grid control.

TitleStyle is used in the DrawCellGrid and DefaultDrawCell methods when Flat is set to False, and controls the 3D appearance of the fixed cell.

tsLazarus
  Uses the default appearance common to the supported platforms in Lazarus.
tsNative
  Uses the drawing style for the current widgetset or theme.
tsStandard
  Uses a more contrasted look similar to Delphi grids.

Use TitleFont (or the definitions in the Columns collection) to control the font used in fixed cells.

The first visible row in the grid.
When True, the dotted focus rectangle is painted using an XOR raster operation.

This controls how the dotted focus rectangle appears in the grid. When True, the rectangle is painted using an XOR raster operation. This allows the focus rectangle to be seen regardless of the cell background color. When False, the user can control the color of the dotted focus rectangle using the FocusColor property.

It also controls the look of column/row resizing operations. When True, a line shows visually the size that the the column or row will have if the user ends the operation. When False, the column or row resizing takes effect as the user drags the mouse.

Controls validation when the text for the selected cell is changed.

ValidateOnSetSelection is a Boolean property used to control validation performed when the text for the selected cell is changed in the grid. The default value for ValidateOnSetSelection is False, as assigned in the constructor for the class.

ValidateOnSetSelection is used in the SelectionSetText method to determine if the ValidateEntry method is called to validate the content in the cell.

The number of visible columns in the grid control.

VisibleColCount is a read-only Integer property with the number of columns displayed in the visible area for the control. The property value is derived using the cached VisibleGrid information in the GCache property. It is not included in the LCL streaming mechanism, and is an artifact from older LCL versions.

The number of visible rows in the grid control.

VisibleRowCount is a read-only Integer property with the number of rows displayed in the visible area for the control.

Event handler signalled after a new Selection is made in the grid.

OnAfterSelection is a TOnSelectEvent property that is the event handler signalled when the Selection for the control has been moved.

An application can implement and assign an object procedure using the event signature to perform any action needed for the notification. The arguments passed to the event handler include the column and row numbers prior to moving the Selection .

Event handler signalled before changing the Selection in the grid control.

OnBeforeSelection is a TOnSelectEvent property with the event handler signalled prior to changing the Selection for the grid control. OnBeforeSelection can be used to perform actions needed before the Selection is moved and an Editor is displayed for the newly selected cell.

OnBeforeSelection is triggered (when assigned) from the MoveExtend method, and occurs when a new column or row is selected in the grid using keyboard navigation, using the mouse, or by assigning values to the Col or Row properties. It is also triggered when an explicit value is assigned to the Selection property.

Use OnAfterSelection to performs actions needed after the Selection has been changed and the Editor has been displayed.

Event handler signalled when the value for a Checkbox cell is toggled.

OnCheckboxToggled is a TToggledCheckboxEvent property with the event handler signalled when the value for a check box-style cell is toggled. OnCheckboxToggled is triggered (when assigned) after the cell value has been changed and stored. OnCheckboxToggled is used descendent classes which implement a Toggle method, like TCustomDrawGrid.

Event handler signalled to compare the content in grid cells.

OnCompareCells is a TOnCompareCells property with the event handler signalled to compare two cell values in the grid control. OnCompareCells is signalled (when assigned) by the DoCompareCells method, and occurs when column or row values are examined in the Sort method. The Result parameter contains the relative sort order for the compared cell values.

Event handler signalled to prepare the Canvas for drawing.

OnPrepareCanvas is a TOnPrepareCanvasEvent property with the event handler signalled to configure the control Canvas to draw a cell using a specific state. OnPrepareCanvas is signalled (when assigned) from the PrepareCanvas method. It allows the Pen, Brush, Font, and Color defaults assigned in PrepareCanvas to be overridden for a specified column, row, or TGridDrawState value.

Event handler signalled to draw a cell in the grid control.

OnDrawCell is a TOnDrawCell property with the event handler signalled to render a cell in the grid control. Parameters passed to the event handler identify the column and row numbers for the cell, and the drawing state.

OnDrawCell can be used along with the default drawing mechanism for the grid control. Set the DefaultDrawing property to True to allow the grid to render the cell background, state, and focus. Use OnDrawCell to handle the text which appears in the specified cell.

OnDrawCell can be used to render all aspects of a cell by setting DefaultDrawing to False. In this situation, the event handler must handle rendering the background, state, focus, and text for the cell.

OnDrawCell is signalled (when assigned) from the DrawCell method at run-time. It is not signalled at design-time. OnDrawCell occurs after the canvas has been configured using PrepareCanvas, and after DefaultDrawCell when DefaultDrawing is True.

Event handler signalled when the button in an Editor is clicked.
Event handler signalled when a button in a column header is clicked.
Event handler signalled when an item is selected from a pick list.
Event handler signalled when an area is selected in the grid control.

The Col and Row parameters contain the column and the row of the highlighted cell.

Application developers can use the OnSelection and OnBeforeSelection events to react to focus changes. Component developers should use the ??? method instead.

Event handler signalled to select a cell Editor for the current cell.
Event handler signalled when the top left cell is changed.
Event handler signalled to get the user-defined bitmap used for a checkbox cell.
Event handler signalled to get the user-defined image used for a checkbox cell.
Event handler signalled to perform validation for a cell value.

OnValidateEntry is a TValidateEntryEvent which implements the event handler signalled to perform validation for cells in the ValidateEntry method.

Flips coordinates in the cell rectangle when BiDi mode or RTL alignment is used.
Flips cell coordinates in the specified point when BiDi mode or RTL alignment is used.
Flips the horizontal position in the client when BiDi mode or RTL alignment is used.
Gets the hint text for a cell.

OnGetCellHint is a TGetCellHintEvent with the event handler signalled to get the hint text for a cell in the grid control. OnGetCellHint is signalled when goCellHints or goTruncCellHints enumeration values are included in the Options property.

OnGetCellHint is signalled (when assigned) from the GetCellHintText and GetTruncCellHintText methods called when ShowCellHintWindow applies the CellHintPriority for the grid control.

Event handler signalled when a column is saved in the SaveColumns method.
Event handler signalled when a column is loaded in the LoadColumns method.
Constructor for the class instance.

Create is the constructor for TCustomGrid. Create calls the inherited Create method, allocates the lists with columns and rows, initializes many visual properties and options, creates the various cell editors, and loads any bitmaps required for the control.

The inherited method calls SetBounds and VisualChange, so the grid needs to be fully instantiated it is called.
TCustomControl.Create
Destructor for the class instance.

Destroy is the destructor for TCustomGrid. Destroy frees various resources including editors, columns, rows, and fonts. It calls the inherited Destroy method.

TCustomControl.Destroy
Adjusts the cell rectangle to account for grid lines drawn around a cell.
Cell rectangle adjusted in the method.
Automatically adjusts columns sizes to the width of their content.
Begins an update to the grid control.

BeginUpdate is a procedure used to start an update to the layout or content in a grid control. BeginUpdate increments an internal member used to prevent nested calls to the method. The protection remains in effect until the EndUpdate method is called. BeginUpdate is used in the implementation of methods that alter the physical appearance of the grid.

The coordinates for the specified cell (ACol, ARow) as a standard rectangle (TRect).
TRect instance with the coordinates for the cell.
Column number for the cell.
Row number for the cell.
Determines the grid zone for the specified cell.

CellToGridZone is a TGridZone function used to get the grid zone where the specified cell is located. It is similar in nature to the MouseToGridZone method, but uses grid coordinates instead of mouse coordinates. The return value is one of the TGridZone enumeration values.

gzInvalid
  Returned when ACol or ARow contain a negative number.
gzFixedCells
  Returned when both ACol and ARow are in the FixedCols and FixedRows for the grid.
gzFixedCol
  Returned when ACol is one of the FixedCols for the grid.
gzFixedRow
  Returned when ARow is one of the FixedRows for the grid.
gzNormal
  Default value returned for a cell that is neither a fixed column nor a fixed row.

CellToGridZone is used in the implementation of methods like MouseUp, CacheMouseDown, Clean, and LoadContent.

TGridZone enumeration value for the cell.
Column number examined in the method.
Row number examined in the method.
Determines if the cell can be selected, or gets a suitable position using auto-advance.
Clears the values in the FixedCols and Cols properties.
True if the columns are cleared in the method.
Clears the cached fixed rows and row count values for the grid control.

ClearRows is a Boolean function used to all rows in the grid control. This includes the fixed row for the control. The return value is True if rows are successfully cleared in the method. It is False if the grid is already empty.

Sets EditorMode to False if a cell editor is visible on the grid control. Sets values in the FixedRows and and RowCount properties to 0 (zero).

It does not change values in the FixedCols or ColCount properties.

True if the rows are cleared in the method.
Clear all cells in the grid.

Resets the column and row counts to 0 (zero). The content in the Grid is emptied.

Compatibility: This applies to Lazarus grids only; under Delphi/Kylix a grid can't be completely emptied.

Clears the current range selection(s) and redraws the grid control.
Select a cell editor control with the specified style.
Cell editor for the specified style.
Editor style selected in the method.
Implements the OnKeyDown event handler for the cell editor.
Object for the event notification.
Key examined in the method.
Shift / Ctrl / Alt modifier for the Key.
Implements the OnKeyPress event handler for the cell editor.
Object for the event notification.
Key press examined in the method.
Implements the UTF-8 key press handler for the editor in the grid control.

EditorUTF8KeyPress is assigned as the OnUTF8KeyPress event handler for the Editor in the grid control. It calls the inherited UTF8KeyPress method, indicating that the value in UTF8Key is targeted at the Editor control for the grid.

Control for the event notification.
UTF-8-encoded code point handled in the method.
Implements the OnKeyUp event handler for the cell editor.
Object for the event notification.
Key examined in the method.
Shift / Ctrl / Alt modifier for the Key.
Updates the grid control when the value in a cell Editor is changed.
Column number for the modified cell.
Row number for the modified cell.
New value for the cell.
Finishes an update to the grid control.
True when the grid control needs to be redrawn in the method.
Clear the background for the grid control.
Device context for the drawing operation.
Adjusts fonts in the control to the specified design-time PixelsPerInch.

FixDesignFontsPPI is an overridden procedure used to adjust the assigned font size for grid columns and their titles to the specified design-time Pixels Per Inch (PPI). This is needed because the display density (PPI) used for fonts is not stored in Form resource (.LFM) files. When the design-time PPI is different than the run-time setting, font scaling issues can occur.

FixDesignFontsPPI restores the design-time font PPI so it can be used in the LCL Scaling mechanism. FixDesignFontsPPI calls the inherited method on entry, and sets the value for the PixelsPerInch property in TitleFont when needed. Column definitions stored in the Columns property are also adjusted (when needed) by calling the FixDesignFontsPPI method for each of the TGridColumn instances in the container.

FixDesignFontsPPI is called when scaling is enabled, and the Form which hosts the control calls its Loaded method during LCL streaming.

Design-time PixelsPerInch needed for fonts in the control.
Indicates if the grid is focused or has an active focused cell Editor.
True when the grid or the cell Editor has focus.
Indicates if multi-select range selection mode is enabled and in use for the grid.

HasMultiSelection is a Boolean function used to determine if multi-select range selection mode is enabled and in use for the grid. The return value is True when Options includes the value goRangeSelect, RangeSelectMode contains rsmMulti, and Selections contains selection cell rectangles.

True when multi-select range selection mode is enabled and in use for the grid.
Hides the arrow drawn as the sort indicator for a column.

HideSortArrow is a procedure used to hide the arrow drawn for the sort indicator defined in SortColumn. HideSortArrow sets the value in SortColumn to -1 to indicate that the sort column is not defined, and calls InvalidateGrid to redraw the contents in the grid control.

Invalidates all cells in the specified column, and causes them to be redrawn.
Column number for the cells invalidated in the method.
Invalidate all subsequent cells starting at the specified column number.
Initial column number updated in the method.
Renders a cell invalid, and redraws the cell if required.
Column number for the cell.
Row number for the cell.
Invalidates the client area for the grid control.

Calls the Invalidate method when no other updates are active for the control.

Invalidates a focused or highlighted cell or row.

InvalidateFocused uses cached grid data in GCache to determine whether the grid control has valid columns and rows. No actions are performed in the method when columns and rows are not present in the cached grid information.

The values in Options are used to determine whether row select or row highlighting are enabled for the control. If either is present in Options, the InvalidateRow method is called for the current Row number. If neither option is used, the InvalidateCell method is called for the current cell in Col and Row.

InvalidateFocused is called from methods that respond to focus changes involving the grid control, including: WMKillFocus, WMSetFocus, DoEnter, and DoExit.

Invalidates a cell range in the grid invalid, and causes it to be redrawn.
TRect with the range of cells affected in the method.
Invalidates the drawing rectangle for the specified row number.
Row number affected in the method.
Determines whether the specified cell is visible.

IsCellVisible is a Boolean function which indicates whether the cell specified by ACol and ARow is in the visible area for the grid control. IsCellVisible uses the internal cached grid information to determine if the cell is within the cached visible coordinates for the control.

IsCellVisible is used in methods like DrawRow, DoEnter, and InvalidateCell.

Use IsFixedCellVisible to determine whether a specific fixed cell is within the visible area for the control.

True if the cell is in the visible area for the grid control.
Column number for the cell.
Row number for the cell.
Determines if the specified cell is a visible fixed cell in the grid.
True if the specified cell is both fixed and visible in the control.
Column number for the cell.
Row number for the cell.
Loads the grid data from a file with the specified name.
Please note that the SaveOptions determine the information available to be loaded.
File name with the content loaded in the method.
Loads the content for the grid from the specified stream.
TStream instance with values loaded in the method.
Finds the mouse coordinates relative to the grid origin.
Converts mouse coordinates to the grid coordinates for a cell in the grid.
ACol and ARow arguments were changed to output parameters in LCL version 2.1 (revision 65087).
TPoint instance with the grid coordinates for the cell.
TPoint instance with the mouse coordinates converted in the method.
Horizontal coordinate for the mouse.
Vertical coordinate for the mouse.
Column number for the mouse position.
Row number for the mouse position.
Converts mouse coordinates to the position of a logical cell in the grid.
Converts mouse position and cell coordinates to a grid zone.
Saves the data in the grid to a file with the specified name.

Please note that the SaveOptions property determines the information stored in the method.

File name where the grid information is stored.
Saves grid information to the specified stream.

SaveToStream is a virtual procedure used to store information for the grid control in the TStream instance specified in AStream. SaveToStream creates a TXMLConfig class instance that is used to capture the layout, cell display settings, grid options, and range selections for the control.

SaveToStream calls the SaveContent method to generate the XML content for the grid control. The XML content is written to AStream using the WriteToStream method in TXMLConfig.

Use LoadFromStream to read the grid information stored in the stream.

TXMLConfig.WriteToStream
TStream instance where grid information is stored.
Resizes fonts using a target PPI and a scaling factor.

ScaleFontsPPI is an overridden procedure used to resize fonts in the control to the specified display density (Pixels per Inch) using the scaling factor in AProportion. This occurs when the run-time PPI setting for a font differs from the design-time value stored in the component resource.

ScaleFontsPPI is overridden to apply the scaling factor to the Font and TitleFont for the control, and any fonts assignments in the Columns collection. The inherited DoScaleFontsPPI method is called to apply the scaling factor to the TFont instance passed as an argument.

TControl.ScaleFontsPPI
New PPI setting for the scaled font sizes.
Scaling factor applied to the font sizes.
Gives focus to the grid control.

SetFocus is an overridden procedure used to make the grid control the currently focused control. SetFocus ensures that pending Tab key navigation for an active cell editor is handled properly. If an Editor is both available and visible, it calls its SetFocus method. Otherwise, the grid control becomes the focused control.

Current cursor state for the grid control.

CursorState is a read-only TGridCursorState property which contains the current cursor state for the grid control. The value in CursorState is updated when methods are called which perform resizing or moving/dragging for columns and rows.

Use the ColRowDraggingCursor, ColSizingCursor, or RowSizingCursor properties to read or write the cursor shapes used for the corresponding actions.

Use RestoreCursor to set the cursor state to its default value (gcsDefault).

Provides indexed access to TGridRect values in the currently selected range.

SelectedRange is a read-only indexed TGridRect property used to get the cell rectangles in Selections for the grid control. SelectedRange is applicable when multi-select range mode has been enabled in the RangeSelectMode property. Otherwise, the current cell selection at Col and Row is returned as the selected range value.

Use SelectedRangeCount to get the number TGridRect instances in SelectedRange.

Use AddSelectedRange to add the current cell selection to the multi-select range in Selections.

Use ClearSelections to remove the cell rectangles stored in Selections.

Number of cell rectangles in the selected range for the grid.
Controls the order used for the sort column (ascending or descending).

SortOrder is a TSortOrder property which indicates the sort order used for the column specified in SortColumn. It is used in the DoCompareCells method to determine the order for values during the comparison.

SortOrder is used in the HeaderClick method to set or invert the ordering when column header for is clicked. It is also used to determine the image displayed in the column heading for the sort column.

The default value for the property is soAscending.

Column number used to sort the rows in the grid.

SortColumn is a read-only Integer that contains the column position used to sort content rows in the grid. SortColumn is used in the HeaderClick method to determine if the click occurred on the fixed header cell represented by the property. It is also used in the DrawColumnTitleImage method if the header cell needs to render an image representing the current sort order.

Allows the user to navigate to this control, by pressing the Tab key.

The default value for TabStop is True in TCustomGrid.

TWinControl.TabStop
Handles IME Composition start messages.
Defined for Windows platforms only.
Handles IME Composition messages.
Defined for Windows platforms only.
Handles the WM_IME_ENDCOMPOSITION message.

Handles the Input Method Editor API WM_IME_ENDCOMPOSITION message.

Dispatches the message specified in Msg in the current visible and active Editor for the control. Defined for the Windows platform only.

Message handled in the method.
Specifies an event handler used to get edit values or masks in a grid.
TGetEditEvent
is an object procedure type used for event handlers which get edit values or masks in a grid control. TGetEditEvent is the type used for the OnGetEditMask and OnGetEditText event handlers in TCustomDrawGrid.
Object for the event notification.
Column number for the notification.
Row number for the notification.
Value returned from the event handler.
Specifies an event handler used to set the value for edit text in a grid.

TSetEditEvent is an object procedure type used to implement event handlers which set the edit value for a cell in a grid control. TSetEditEvent is the type used for the OnSetEditText property in TCustomDrawGrid.

Object for the event notification.
Column number for the notification.
Row number for the notification.
Value applied to the specified cell in the event handler.
Specifies an event handler signalled to get the state for a Checkbox cell in a grid.
Object for the event notification.
Column number for the cell.
Row number for the cell.
Checkbox state retrieved for the cell.
Specifies an event handler signalled to set the state for a Checkbox cell in a grid.

TSetCheckboxStateEvent is an object procedure type which specifies an event handler signalled to set the state for a Checkbox cell in a grid control. TSetCheckboxStateEvent is the type used to implement the OnSetCheckboxState property in TCustomDrawGrid.

See TGetCheckboxStateEvent for the event handler signalled to get the value for a checkbox cell in a grid control.

Object for the event notification.
Column number for the modified cell.
Row number for the modified cell.
New checkbox state for the cell.
The base class for a custom-drawn grid control.

TCustomDrawGrid is a TCustomGrid descendant used as the base class for custom-drawn grids including TDrawGrid and TStringGrid. Applications should not create instance of TCustomDrawGrid; use one of the descendent classes like TDrawGrid or TStringGrid.

TCustomDrawGrid provides overridden methods needed to work with cells using the TVirtualGrid class instance in the Grid property. It displays information as a matrix of rows and columns, and is oriented towards rendering both graphical information and textual content.

The OnDrawCell event handler is provided to render the cell content in the grid, and can be used to render images or directly access the Canvas for the control. Default cell drawing logic is also implemented using the properties and methods from the ancestor class, and may be accessed from within the OnDrawCell event handler.

Determines if the cell is valid and enabled, and uses the CheckBox button style.
True when the specified cell is valid, enabled, and uses the CheckBox button style.
Column number for the cell.
Row number for the cell.
Draws a cell value using the bitmaps for the CheckBox button style.
Column number for the cell.
Row number for the cell.
Rectangle with the bounds for the cell.
Posts a grid message to get the value from the Editor control in a cell.
Value from the Editor control.
Column number for the cell.
Row number for the cell.
Contains the virtual grid for the control.
Performs actions to handle a mouse click in the specified cell.

CellClick is an overridden method used to handle a mouse click in the cell specified by the values in ACol and ARow. Button indicates the mouse button pressed for the click notification.

CellClick ensures that a left mouse button click causes the cell value in a column using the CheckBox button style to be toggled. When Button contains mbLeft, the column is examined to determine if it uses the CheckBox button style. When both conditions are met, the ToggleCheckbox method is called to update the cell value and display the correct bitmap for the CheckBox state.

CellClick does not occur for a cell that is a fixed header for the column or the row.

CellClick is called from the MouseUp method when a mouse click occurs in a cell that has already been selected, or when AutoEdit has been enabled in the grid Options.

Column number for the cell.
Row number for the cell.
Mouse button for the click notification.
Performs actions when a column or a row is deleted from the control.

ColRowDeleted is an overridden method used to remove the specified column or row, and perform a notification for the change.

IsColumn indicates whether a column or a row is affected in the method. When set to True, a column is removed. Othewise, a row is removed.

Index contains the column or row number removed in the method.

ColRowDeleted calls the DeleteColRow method in Grid to remove the pointers in the virtual grid for the column or row. NotifyColRowChange is called to perform a notification for the action by signalling the OnColRowDeleted event handler (when assigned).

ColRowDeleted in called from the DoOPDeleteColRow method (in the ancestor class) after removing the column or row in Index from the internal list of column widths, and updating the cached grid information in GCache.

Creates and returns a virtual grid for the control.
Draws a cell with auto-numbering.

DrawCellAutonumbering is a method used to draw the text in AValue for the auto-numbered cell at the position in ACol and aRow. DrawCellAutonumbering calls DrawCellText to render the text using the parameter values.

DrawCellAutonumbering is called from the DefaultDrawCell method using the relative non-fixed row number as the text for the cell.

Column number for the cell.
Row number for the cell.
Rectangle with the bounds for the cell.
Text drawn in the cell.
Draws the focus rectangle for the control.

DrawFocusRect is an overridden method used to draw the focus rectangle for the specified cell when the grid control or its cell Editor is focused. No actions are performed in the method if DefaultDrawing is set to False, or the grid is not Focused. In addition, the focus rectangle cannot be displayed if goAlwaysShowEditor has been enabled in Options and the Editor is either unassigned (Nil) or not focused.

DrawFocusRect calls CalcFocusRect to apply the cached visual information in GCache for the focused cell or row. This includes adjustments for grid lines when enabled for the control.

When UseXORFeatures is True, the Pen mode in the Canvas is updated to used the XOR drawing operator and the color needed for the control. The Canvas state is restored prior to exiting from the method.

DrawRubberRect is called to draw the rubber band rectangle with the appropriate borders using the FocusColor in the control.

DrawFocusRect is called from the DrawRow method.

Column number for the cell with the focus rectangle.
Row number for the cell with the focus rectangle.
TRect instance with the bounds for the cell with the focus rectangle.
Gets the value for the specified cell.
Value for the cell.
Column number for the cell value.
Row number for the cell value.
Gets the check box state for the cell at the specified coordinates.

Signals the OnGetCheckboxState event handler (when assigned) to get the value in AState. Called from ToggleCheckbox and the private DrawCellCheckboxBitmaps method.

Column number for the cell.
Row number for the cell.
Check box state for the cell.
Gets the text displayed in the Editor for the specified cell.

GetEditText is an overridden method used to get the text displayed in the Editor for the specified cell. GetEditText signals the OnGetEditText event handler (when assigned) to get the text displayed in the Editor. The return value can be an empty string ('') when:

- OnGetEditText is not assigned.
- The cell at ACol and ARow is empty.
- Or, a value in ACol or ARow is not valid for the grid.

GetEditText is called from the EditorDoSetValue method when TGridMessages are dispatched to the Editor to set the edit mask and value used in the control.

Text used as the value in the Editor control.
Column number for the cell.
Row number for the cell.
Performs actions when the mouse wheel is scrolled in the grid control.

GridMouseWheel is an overridden method in TCustomDrawGrid used to perform actions when the mouse wheel is scrolled while the grid control has focus. Mouse wheel behavior is determined by the MouseWheelOption property.

When set to mwCursor, the mouse wheel controls the selected row or column in the grid. It increases or decreases the selected row number in the grid by default. Press Ctrl + Mouse Wheel to change the selected column number in the grid.

When set to mwGrid, the mouse wheel scrolls the visible non-fixed columns and rows in the grid control. It scrolls the visible rows up or down by default. Press Ctrl + MouseWheel to scroll the visible columns in the grid control. Mouse wheel movement has no affect when the number of visible columns or rows is not larger than the non-fixed display area for the grid control.

Shift state modifier in effect for the action.
Relative change in the current mouse wheel position for the action.
Performs actions when a mouse click occurs in a header for a grid column.

HeaderClick is an overridden method ensures that the SortOrder for the grid is toggled when Index contains the SortColumn defined for the grid control. HeaderClick calls the inherited method in TCustomGrid to Sort the non-fixed rows in the grid control.

HeaderClick signals the OnHeaderClick event handler (when assigned) to performed any actions needed after the data has been sorted in the method.

True when a column has been clicked instead of a row.
Column or row number for the click notification.
Performs actions needed when a column or a row has been resized.

HeaderSized is used to perform actions needed when the header for a column or row has been resized in the grid control.

IsColumn indicates whether the sizing action applies to a column or a row. When set to True, the column header has been resized. When set to False, the row header was resized.

Index indicates the column or row number in the grid where the resizing action occurred.

Calls the inherited method on entry. Signals the OnHeaderSized event handler (when assigned).

HeaderSized is called from methods like MouseUp (when column or row sizing is completed) and DblClick (when column sizing is enabled in the grid Options).

True if a column was resized, False if a Row was resize.
Column or row number for the resize operation.
Performs actions when resizing a column or row to the specified size.

HeaderSizing is an overridden method used to perform actions when a column or a row is being resized using the mouse. HeaderSizing calls the inherited method on entry, and signals the OnHeaderSizing event handler when assigned.

HeaderSizing is called from the DoColSizing and DoRowSizing methods when GridState has the value gsColSizing or gsRowSizing.

True when the resize action is for a column, or False for a row.
Column or row index resized in the method.
New size for the column or row.
Handles key down events for the grid control.

KeyDown is an overridden method in TCustomDrawGrid, and calls the inherited method on entry. KeyDown ensures that the Space (VK_SPACE) key code is properly applied to the control for a cell using the CheckBox button style.

VK_SPACE (Space)
  Calls the ToggleCheckbox method to toggle the checked state for the cell at Col and Row. Key is set to 0 (zero) to indicate that is has been handled in the method.

Called from EditorKeyDown when key down events are enabled in the EditorOptions for the control.

Key code examined in the method.
Shift / Alt / Ctrl modifier for the key code.
Performs a notification when a column or row has been changed.

NotifyColRowChange is a method used to signal an event handler when a column or a row in the grid has been changed.

WasInsert determines the event handler signalled in the method. When WasInsert is set to True, the OnColRowInserted event handler is signalled (when assigned). When set to False, the OnColRowDeleted event handler is signalled (when assigned).

FromIndex and ToIndex indicate the column(s) or row(s) affected by the change. FromIndex has the column or row number where the action was performed. When a column or row was inserted, ToIndex has the same value as FromIndex. For changes to ColCout or RowCount, FromIndex and ToIndex contain the column or row count prior to and following the change.

NotifyColRowChange is called from methods like ColRowInserted, ColRowDeleted, and SizeChanged.

True if an insert triggered the notification.
True if a column was affected by the change.
Column or row number affected by the change.
Column or row number affected by the change.
Determines whether the specified cell can be selected in the grid control.

SelectCell is an overridden Boolean function used to determine whether the cell specified in ACol and ARow can be selected in the grid control. It is used to respond to focus changes for the control.

SelectCell calls the inherited method on entry to get the return value for the method. The return value is True when both ColWidths and RowHeights have positive non-zero values for the column and row numbers where the cell is located.

SelectCell signals the OnSelectCell event handler (when assigned). The event handler can be used to override the return value based on the column and / or row number.

SelectCell is used in the implementation of methods like TryMoveSelection, CheckPosition, SelectEditor, and GetDeltaMoveNext.

True when the specified cell can be selected in the grid.
Column number for the cell.
Row number for the cell.
Sets the value for the Color property.

Calls Invalidate to force the grid control to be redrawn.

New value for the property.
Sets the value for a CheckBox in the specified cell to a given state.

SetCheckboxState is a method used to set the checked, unchecked, or grayed state for a CheckBox in the cell specified by ACol and ARow. AState contains the state value applied to the cell.

SetCheckboxState signals the OnSetCheckboxState event handler (when assigned) to perform the actions needed to change the value in the cell. If DefaultDrawing is enabled for the control, the InvalidateCell method is called to force the cell to be redrawn.

No actions are performed in the method when OnSetCheckboxState has not been assigned.

SetCheckboxState is called from the ToggleCheckbox method to apply the new state value for the CheckBox.

Column number for the cell with the CheckBox.
Row number for the cell with the CheckBox.
State value for the CheckBox.
Sets the value used in the cell Editor to the specified text.

SetEditText is an overridden method used to set the the text displayed in the Editor for the cell specified in ACol and ARow.

SetEditText signals the OnSetEditText event handler (when assigned) to get the Value provided to the cell Editor. The inherited method is called to apply the cell value to the editor control.

SetEditText is used in KeyDown when the Escape key (VK_ESCAPE) is not handled by the grid control. It is called from the EditorGetValue method when a visible cell Editor is updated. It is called from EditorTextChanged method when the value in a cell Editor has been altered using the Change or Select methods in the editor control.

Column number for the cell.
Row number for the cell.
New value for the cell Editor.
Performs actions needed when the number or columns or rows has been changed.

SizeChanged is an overridden method in TCustomDrawGrid used to perform actions needed when the number or columns or rows has been changed for the grid control. SizeChanged ensures that the changed values are recorded in the internal virtual grid for the control, and performs a notification for the change.

When OldColCount differs from the value in ColCount, the current ColCount is stored in the virtual grid. NotifyColRowChange is called to generate an insert or a delete notification for the change in ColCount.

When OldRowCount differs from the value in RowCount, the current RowCount is stored in the virtual grid. NotifyColRowChange is called to generate an insert or a delete notification for the change in RowCount.

SizeChanged is called from the AdjustCount and Clear methods.

Previous number of columns.
Previous number of rows.
Toggles the state for a checkbox cell between the checked and unchecked values.

ToggleCheckbox is a method used to toggle the state for a checkbox located in the cell at Col and Row in the grid control.

No actions are performed in the method when Col is not an editable column in the grid. This can occur when goEditing has not been included in the Options for the control. It can also occur if the column definition in Columns has its ReadOnly property set to True.

ToggleCheckbox determines the TCheckboxState value for the cell. The default state is cbGrayed. GetCheckboxState is called to get the current state using the OnGetCheckboxState event handler (when assigned). The value is toggled (cbChecked becomes cbUnchecked, and vice versa). SetCheckboxState is called to apply the toggled value using the OnSetCheckboxState event handler (when assigned), and to redraw the cell.

The OnCheckboxToggled event handler is signalled (when assigned) prior to exiting from the method.

ToggleCheckbox is called from the CellClick method when a left mouse button click occurs in the cell. It is also called from the KeyDown method when the Space (VK_SPACE) key is applied for the cell.

Event handler signalled to get the state for a checkbox cell.

OnGetCheckboxState is a TGetCheckboxStateEvent property with the event handler signalled to get the state for a checkbox cell. The ACol and ARow parameters contain the position for the cell. Value contains the TCheckBoxState value for the cell as assigned in the event handler.

OnGetCheckboxState provides the only mechanism to get the state value for a Checkbox cell in TCustomDrawGrid / TDrawGrid. This differs from TCustomStringGrid / TStringGrid, where the TGridColumn instance in Columns can is used (when enabled) to get the checked or unchecked value and determine the state for the cell. This approach can be implemented in the event handler; it is not provided by default.

OnGetCheckboxState is signalled (when assigned) from the GetCheckBoxState method.

Use OnSetCheckboxState to set the state for the CheckBox cell.

Event handler signalled to set the state for a checkbox cell.

OnSetCheckboxState is a TSetCheckboxStateEvent property with the event handler signalled to set the state for a checkbox cell. The ACol and ARow parameters contain the position for the cell. Value contains the TCheckBoxState value stored in the cell.

OnSetCheckboxState provides the only mechanism to set the state value for a Checkbox cell in TCustomDrawGrid / TDrawGrid. This differs from TCustomStringGrid / TStringGrid, where the TGridColumn instance in Columns can is used (when enabled) to get the checked or unchecked value and determine the state value stored in the cell. This approach can be implemented in the event handler; it is not provided by default.

OnSetCheckboxState is signalled (when assigned) from the SetCheckBoxState method.

Use OnGetCheckboxState to get the state for the CheckBox cell.

Constructor for the class instance.

Create is the overridden constructor for TCustomDrawGrid. Creates the virtual grid used in the control, and calls the inherited constructor prior to exiting from the method.

Owner of the grid control.
Destructor for the class instance.

Destroy is the overridden destructor for the class instance. Destroy frees resources allocated to the member used for the internal virtual grid in the control. Destroy calls the inherited destructor prior to exiting from the method.

Deletes a column or a row at the specified position.

DeleteColRow is a method used to delete the column or row at the specified position.

IsColumn determines whether a column or a row is affected in the operation. When set to True, a column is deleted. Otherwise, a row is deleted.

Index contains the column or row number deleted in the method. An exception will be raised if Index contains an invalid value for the ColCount or RowCount in the grid control.

DeleteColRow calls DoOPDeleteColRow with the parameter values to perform the delete operation.

DeleteColRow is used in the implementation of the DeleteCol and DeleteRow methods.

Use InsertColRow to insert a column or row at a given position in the grid. Use MoveColRow to move a column or row to a new position in the grid. Use ExchangeColRow to swap column or row values at the specified positions in the grid.

True to delete a column in the method, False for a row.
Column or row number deleted in the method.
Deletes the column at the specified position.

Calls DeleteColRow to delete the column number specified in Index.

Position for the column removed in the method.
Deletes the row at the specified position.

Calls DeleteColRow to delete the row number specified in Index.

Position for the row removed in the method.
Exchanges column or row values at the specified positions.
True when the index positions refer to columns.
Position for the first column in the exchange.
Position for the second column in the exchange.
Inserts a column or a row at the specified position.
True when a column should be inserted in the method.
Position where the column or row is inserted in the grid.
Moves a column or a row from a specified position to a new position in the grid.

Implemented using the DoOPMoveColRow method.

Values in FromIndex and ToIndex must be valid column or row numbers for the control. An EGridException is raised if either value is not valid.

No actions are performed in the method if FromIndex and ToIndex have the same value.

No actions are performed in the method if IsColumn is True and columns are locked using the GridFlags. This occurs when a column index is being updated in the control.

Calls ColRowMoved to perform a notification when the column or row has been moved.

Calls VisualChange if the Columns collection has not been enabled in the control, or when IsColumn is False.

Updates the bounds for the cell editor when it is located in a column or row affected in the method.

Updates the value in SortColumn if it is affected in the method.

True when a column is moved in the method.
Position for the column or row moved in the moved.
New position where the column or row is stored.
Sorts the data in a column or row using the specified positions.
True when values in a column are sorted, False to sort values in a row.
Column or row number sorted in the method.
Starting position sorted in the column or row.
Ending position sorted in the column or row.
The default method used to draw the cell at the given position using a specific state.

DefaultDrawCell is a method which provides the default drawing routine for the cell at the position specified in ACol and ARow. The bounds for the cell are provided in the ARect parameter. AState contains the drawing state for the cell.

DefaultDrawCell handles the following drawing tasks when needed for the specified cell:

- Draws fixed cells using the TitleStyle for the control. Calls DrawThemedCell when TitleStyle is set to tsNative. Otherwise, DrawFillRect is used.
- Draws the bitmap needed for a cell using the CheckBox button style. Calls DrawCellCheckboxBitmaps to render the bitmap for the checkbox control.
- Draws a cell using the Button style. Calls DrawButtonCell to render the button in the required state.
- Draws auto-numbered fixed row headers when enabled in the Options for the control. Calls DrawCellAutonumbering to render the relative non-fixed row number.
- Draws the text displayed in the cell. Calls DrawColumnText when the cell is a fixed column header. Otherwise, the DrawTextInCell method is used.

DefaultDrawCell is called from the DrawCell method. It is used when the DefaultDrawing property is set to True, and occurs prior to signalling the OnDrawCell event handler (when assigned). It is always called when OnDrawCell has not been assigned.

Column number for the cell.
Row number for the cell.
Rectangle with the bounds for the cell.
Drawing state for the cell.
Event handler signalled when a grid column or row is deleted.
Event handler signalled when a column or row has been exchanged with another.
Event handler signalled when a column or row is inserted into the grid.
Event handler signalled when a column or row in the grid is moved.
Event handler signalled to compare the content in cells
Event handler signalled to get the edit mask used for a grid cell.
Event handler signalled to get the value for a cell editor in the grid.
Event handler signalled when the fixed header for a column or row is clicked.
Event handler signalled when a column or row header has been re-sized.
Event handler signalled when a column or row header sizing action is performed.
Event handler signalled when a grid cell is selected.

OnSelectCell is a TOnSelectCellEvent property with the event handler signalled when a cell is selected in the grid control. OnSelectCell is signalled from the SelectCell method. It occurs when a change in the current cell selection has been or is about to be performed, or when a cell editor is selected for the grid control. The CanSelect argument allows the event handler to control whether the cell at ACol and ARow can be selected.

Event handler signalled when the text in the cell Editor is assigned.

OnSetEditText is a TSetEditEvent property with the event handler signalled when the text in the cell Editor is assigned. OnSetEditText is signalled from the SetEditText method immediately before calling the inherited SetEditText method. The Sender argument is the current grid instance for the notification.

Implements a custom-drawn grid control.

TDrawGrid is a TCustomDrawGrid descendant which implements a custom-drawn grid control. The control represents it information as a matrix of rows and columns, and is oriented towards rendering both graphical information and textual content.

The OnDrawCell event handler is used to render the cell content in the grid, and can be used to render images or directly access the Canvas for the control. Default cell drawing logic is also implemented using the properties and methods from the ancestor class.

TDrawGrid sets the visibility for properties introduced in the TCustomDrawGrid ancestor, and does not provide any new functionality.

Uses the Color from the Parent control, when enabled.

ParentColor determines if the control should use the Color from the Parent control, when enabled. The default value for the property is False in TDrawGrid.

When this property is True, all changes to the Color of the parent will also be applied to the Color of the control, ensuring that they both contain same value. If the Color of the control is changed by the application, then ParentColor will be automatically set to False.

Using ParentColor when the Color value is clDefault can cause problems in resolving the actual color value. To obtain the Color property of a control while taking into account clDefault and ParentColor, use the GetColorResolvingParent method. This method might return a non-RGB color, but will never return clDefault. To obtain a purely RGB result use the GetRGBColorResolvingParent method.

TControl.ParentColor TControl.Color TControl.GetColorResolvingParent TControl.GetRGBColorResolvingParent
Represents strings used as the cell values in TCustomStringGrid / TStringGrid.

TStringGridStrings is a TStrings descendant that represents the strings used to populate the cells in a TStringGrid instance.

Converts an index position to line and column numbers for the Cells in a grid.
Gets the string at the specified index position.
TStrings.Strings
String value at the specified position.
Ordinal position for the string.
Gets the value for the Count property.
TStrings.Count
Value for the Count property.
Gets the value for the indexed Objects property.
TStrings.Objects
Value for the property.
Ordinal position for the property value.
Sets the value for the indexed Strings property.
TStrings.Strings
Ordinal position for the property value.
New value for the indexed property.
Sets the value for the indexed Objects property.
TStrings.Objects
Ordinal position for the indexed property value.
New value for the indexed property.
Constructor for the class instance.

Create is the constructor for the class instance, and calls the inherited constructor on entry. Create stores parameter values to the members used for the associated grid and the map used in the class instance.

Grid for the string values.
Map with the owner for the class instance.
True when the values represent a column for the associated grid; False for a row.
Column or row number in the grid for the data values.
Destructor for the class instance.
TStrings.Destroy
Adds the specified string to the class instance.
TStrings.Add TStrings.Strings TStrings.Values
Ordinal position in the class instance where the value was stored.
String value added in the method.
Stores property values from Source into the current class instance.
TStrings.Assign
Persistent object with the property values copied in the method.
Removes all values for the column or row represented by the class instance.
TStrings.Clear
Deletes a value stored in the class instance.

Delete is overridden to prevent removing entries in the Strings property. It always raises an EGridException exception.

Raises an EGridException exception with the message 'Cannot delete value.'
TStrings.Delete
Ordinal position for the value to be removed; not used in the method.
Inserts a value in the class instance.
Raises an EGridException exception with the message 'Cannot insert value.'
TStrings.Insert
The base class for TStringGrid.

TCustomStringGrid is a TCustomDrawGrid descendant which implements the base class for TStringGrid.

TCustomStringGrid provides the familar tabular format used in grid controls, and is designed for use with string content stored in its cells. Internally, columns and rows in the class are mapped to TStringGridStrings instances used to store the values in the grid control. TCustomStringGrid also allows a TObject instance to be stored for each cell in the grid using the Objects property.

Gets the values in the specified column number as a TStrings instance.

GetCols is the read access specifier for the indexed Cols property.

TStrings with row values for the specified column number.
Column number retrieved in the method.
Gets the value for the indexed Objects property.
Value for the indexed property.
Column number for the object.
Row number for the object.
Gets the value for the indexed Rows property.
Value for the property.
Ordinal position for the requested row.
Frees the TStringGridStrings instances in the specified Map.
TMap instance examined and updated in the method.

?

TStrings instance with the values for the specified column or row.
True when columns are returned, False for rows.
Column or row number for values retrieved in the method.
Map instance used in the method.
Reads string values for the Cells property using a TReader instance.
TReader instance used to read values during LCL streaming.
Sets the value for the indexed Cols property.
Ordinal position for the affected column
New value for the indexed property.
Sets the value for the indexed Objects property.
Ordinal position for the column.
Ordinal position for the row.
New value for the indexed property.
Sets the value for the indexed Rows property.
Ordinal position for the row affected.
New value for the indexed property.
Writes the string values in the Cells property using the specified TWriter instance.
Copies the content from cell(s) in the specified selection rectangle to the clipboard.
Only visible cells in the selection rectangle are included in the copied values. Others are quietly discarded. HTML TABLE syntax is used to store the cell values copied in the method. LineEnd and HTML reserved characters are translated into HTML-safe tags or HTML character entities.
Cell selection rectangle with values copied in the method.
Assigns values from the current class instance to the target class instance.
Adjusts the column size for the font, text and images used in the specified column.

Adjusts the column specified in ACol to use the width needed for the font and image(s) for the column. No actions are performed in the method when ACol is not a valid column index.

AutoAdjustColumn calculates the width need for the image (if any) used in the column header, and adds the padding specified in the DEFIMAGEPADDING constant. If a sort indicator is used, the same actions are performed for the sort image. The image widths may be scaled to the current display density if the PPI for the control Font differs from the value in TitleImageList.

AutoAdjustColumn visits the rows in the grid to calculate the maximum width required for the text in each. A temporary Canvas instance is used to calculate the width for the text. When Columns has been enabled, fonts assigned to the TGridColumn instance are used. When Columns has not been enabled, TitleFont is used for fixed rows or columns. Otherwise, the Font for the grid is used.

For multi-line columns, the DrawText routine is called to calculate the text rectangle. For single-line columns, the TextExtent method in the canvas is used. Cell padding is added to the calculated column width using the value in varCellPadding. The derived column width is stored in the ColWidths property for the column specified in ACol.

AutoAdjustColumn is called from the DblClick method when column auto-sizing and double click auto-sizing have been enabled in the Options for the grid. It is also called from the AutoAdjustColumns, AutoSizeColumns, and AutoSizeColumn methods.

Column number for values examined in the method.
Deprecated in the ancestor class.
CalcCellExtent is marked as deprecated in the ancestor class.
TCustomGrid.CalcCellExtent
Defines non-published properties included in LCL component streaming.

DefineProperties is an overridden method used to define non-published properties which are read and written using LCL component streaming. In TCustomStringGrid, it adds read and write routines for the Cells property to the TFiler instance.

TFIler instance used to read or write values for the class type.
Defines the reader and writer for the Cells property in a TFiler instance.

Called from the DefineProperties method.

TFiler instance updated in the method.
Performs a comparison between the specified cells in the grid control.

DoCompareCells is an overridden method used to compare cell values in the Sort method. It calls the inherited method when the OnCompareCells event handler has been assigned. The return value from the event handler contains the relative sort order for the compared cells, and uses the following values:

-1
  The cell at ACol and ARow occurs comes before the cell at BCol and BRow.
0
  The specified cells have the same value.
1
  The cell at ACol and ARow occurs comes after the cell at BCol and BRow.

When OnCompareCells is not assigned, the UTF8CompareLatinTextFast routine is called to perform the cell comparison and provide the return value for the method. When SortOrder is set to soDescending, the return value is negated.

UTF8CompareLatinTextFast
Relative sort order for the compared cell values.
Column number for the first cell value in the comparison.
Row number for the first cell value in the comparison.
Column number for the second cell value in the comparison.
Row number for the second cell value in the comparison.
Performs actions needed when cell values are copied or pasted using the clipboard.

Signals the OnCellProcess event handler when assigned.

Column number for the cell.
Row number for the cell.
Process performed in the method.
Contains the value after performing the specified process.
Draws the text and image for a grid column title at the specified cell coordinates.

DrawColumnText is an overridden method used to draw the text and image for a grid column title at the cell coordinates specified in ACol and ARow. When Columns has been enabled, the inherited method is called to draw the image, sort indicator, and text when needed. When Columns has not been enabled, the DrawColumnTitleImage and DrawCellText methods are called to draw the sort indicator and text for the column.

DrawColumnText is called from the DefaultDrawCell method for cells which contain fixed column titles.

Column number for the cell.
Row number for the cell.
Rectangle with the bounds for the cell.
Drawing state for the cell.
Draws the text for the specified cell in a given drawing state.

DrawTextInCell is a method used to draw the text for the cell specified in ACol and ARow. It calls the DrawCellText method using the specified arguments.

DrawTextInCell is called from the DefaultDrawCell method.

Column number for the cell.
Row number for the cell.
Rectangle with the bounds for the cell.
Drawing state for the cell.
Performs auto-numbering for a cell in the grid.

Renders the row number for non-fixed rows in the grid control. Calls the inherited DrawCellAutoNumbering method when the cell at ACol and ARow contains an empty string ('').

Called from the DefaultDrawCell method when goFixedRowNumbering is included in Options.

Column number for the cell.
Row number for the cell.
Rectangle where the cell is drawn.
Text to display as the auto-numbering value.
Gets the value for the indexed Cells property.
Value for the indexed property.
Column number for the cell.
Row number for the cell.
Gets the state for a cell displayed as a Checkbox.
Column number for the cell.
Row number for the cell.
Checkbox state derived for the specified cell.
Gets the text displayed in the Editor for the specified cell.

GetEditText is an overridden method used to get the text displayed in the Editor for the cell with the specified column and row numbers. GetEditText re-implements the method defined in the ancestor class.

The return value contains the string stored in Cells at the specified column and row numbers.

GetEditText signals the OnGetEditText event handler (when assigned) to validate or modify the return value for the method.

Textual content for the cell at the specified column and row number.
Column number for the cell value.
Row number for the cell value.
Loads configuration settings from the specified XML configuration file.

Loads values for the Cells property when enabled in the configuration file.

Performs actions when LCL component streaming has been completed.

Calls the inherited method on entry, and sets the value for the Modified property to False.

Saves configuration settings from SaveOptions and optionally values from Cells in the specified XML configuration file.
Stores the specified Tab-separated values to the Selection in the grid.
Sets the value for the current Selection to the specified HTML content.

Extracts text for rows and columns in the grid from the HTML-tagged content in TheHTML. Recognizes and converts the following HTML tags:

- BR
- TR
- TD

Converts HTML numeric character entities to their UTF-8-encoded character equivalent. Unrecognized character entities are converted to a Question Mark character (?).

Calls DoCellProcess to paste the values extracted from the HTML content. The value in TheText is used when TheHTML does not contain valid HTML that can be handled in the method. Cells affected in the method are assigned as the current Selection in the grid control prior to exit.

Called from the DoPasteFromClipboard method when the clipboard supports the HTML format.

HTML stored in the current selection.
Textual representation for the HTML content.
Sets the value for the indexed Cells property.
Column number for the affected cell.
Row number for the affected cell.
New value for the indexed property.
Sets the checked state for a Checkbox in the specified cell.
Column number for the cell.
Row number for the cell.
Checked state for the cell.
Locks, updates, and unlocks the editor and cell text at the specified coordinates.
Column number for the modified cell.
Row number or the modified cell.
New value for the modified cell.
Indicates if the content in the grid cells has been changed.

The value in Modified is set to False when Loaded using the LCL streaming mechanism. The value in Modified is changed to True when the Cells property is updated in the SetCells method.

Event handler signalled when copying or pasting content for Cells in the grid.

Allows the textual value for the clipboard operation (not the HTML interchange data) to be changed before it is applied. Signalled from the DoCellProcess method when assigned.

Constructor for the class instance.

Create -is the constructor for TCustomStringGrid. It calls the inherited Create method, and sets default styles, layout and alignment used in the class instance.

Owner of the class instance.
Destructor for the class instance.

Destroy is the destructor for TCustomStringGrid. It frees maps of columns and rows, and calls the inherited Destroy method.

Automatically adjusts the width of a column to accommodate the widest text value.

AutoSizeColumn sets the column width to the length of the widest text found in the column specified by ACol.

Tip: Use goDblClickAutoSize in Options to allow columns to be automatically resized when doubleClicking the column border.

Column number resized in the method.
Resizes all columns to fit in the longest text in each.

Automatically resizes all columns by adjusting them to fit in the longest text in each column. This is a quick way to perform the AutoSizeColumn method for every column in the grid.

Removes cell content using the specified options.

Cleans all cells in the grid subject to the given CleanOptions, optionally specifying a range of cells or a rectangular region. See for more information.

The cleaning operation does not change the number of rows and columns. It replaces the content for the affected cells with empty strings ('').

Some examples:

- Clean all cells: grid.Clean([]); (the same as grid.clean)
- Clean all non-fixed cells: grid.Clean([gzNormal]);
- Clean all cells except grid column headers: Grid.Clean([gzNormal, gzFixedRows]);

Set with the grid zones affected in the method.
Rectangle with the bounds for the affected cells.
Starting column number for the operation.
Starting row number for the operation.
Ending column number for the operation.
Ending row number for the operation.
Copies the selection cell range to the clipboard.

CopyToClipboard will copy a range of cells into the clipboard; the cells values are TAB separated. The range is defined based on optional AUseSelection parameter (which is False by default) and indicates the range is set to the whole grid, including fixed cols/rows. If AUseSelection is True, the range of cells is set to the current .

Inserts a row at the specified row position with the specified cell values.

InsertRowWithValues is a method used to insert a row at the position in Index with the cell content in Values.

InsertRowWithValues examines Values to determine whether the grid has a column for each of the string values. When Values has more entries than columns available in ColCount, new columns are added to the grid. When Columns has been Enabled, the Add method in Columns is called to create any missing column definitions. The title for a column added to the collection is set to an empty string (''). When Columns has not been enabled, the value in ColCount is set to the length of the Values array.

InsertRowWithValues calls InsertColRow to increment the row count for the grid, and assigns each String in Values to the corresponding Cells in the grid control.

Use DeleteRow to remove a row at a specific row number in the grid.

Row where the values are inserted.
Array with string values inserted in the method.
Loads the content for the grid from the delimited values in AStream.
Stream with the content loaded in the method.
Delimiter between cell data in the stream; default is Comma (',').
Indicates if Column captions are loaded from values in the stream.
Initial line number in the stream included in the grid content; default is 0.
Indicates if empty lines in the stream are ignored in the method.
Loads the grid from a file with delimited values for the columns and rows.

Creates a temporary TFileStream instance that is used to load values from the file in AFilename by calling the LoadFromCSVStream method.

File name with the content loaded in the method.
Delimiter between cell values in the file; default is Comma (',').
Indicates if column captions are loaded from values in the file.
Initial line number from the file loaded in the method.
Indicates if empty lines in the file are ignored in the method.
Saves content in the grid as delimited values in the specified stream instance.
Stream where grid content is stored.
Delimiter between cell values; default is Comma (',').
Indicates that column captions are stored as the first row of CSV data.
Indicates if only visible columns are included in the CSV output.
Saves grid content as delimited values in the specified file name.
File name (with optional path) where CSV data is stored.
Delimiter used between cell values in CSV output; default is Comma (',').
Indicates if column captions are written as the first row of CSV data in the file.
Indicates if only visible columns are included in the CSV output.
Provides indexed access to a cell value by its column and row number.

Cells is an indexed String property used to read or write the content for a cell in the grid. The ACol and ARow indexes are used the access a value stored at the requested column and row position.

Reading the value causes the pointer to the cell in Celda to return its Text value.

Setting the value causes the pointer to the cell in Celda to be updated for the specified coordinates. An active cell editor will be cancelled if it is not locked, and the value in Modified is reset to False.

Use Objects to read or write an associated TObject instance for a given cell.

Column number for the cell value.
Row number for the cell value.
Provides indexed access to the list of values for the specified column number.

Cols is an indexed TStrings property which provides access to the list of values for the column number specified in Index. Calls MapGetColsRows to retrieve the TStrings instance used as the value for the property.

Column number for the values.
Provides indexed access to a TObject instance associated with the cell.

Objects is an indexed TObject property which is used to associate an object instance with the cell specified in the ACol and ARow index values. The property value can be any TObject descendant. The application must allocate and free the object instance, and must ensure it is cast to the correct type when retrieved.

While values in Cells and Objects are related, they are handled independently. The value in Objects is not changed when a new value is assigned to Cells.

Values stored in Objects are set to Nil when the Clean method is callled to remove content in the grid. The application is responsible for allocating and freeing resources in Objects.

Values for the Objects property are not included in the grid data read and written during LCL component streaming. They are not handled by the LoadContent and SaveContent either. The property values are available at run-time only.

Column number for the cell with the object instance.
Row number for the cell with the object instance.
Provides indexed access to the list of values for the specified row number.

Rows is an indexed TStrings property which provides access to the list with the String values for the row number specified in Index. Calls MapGetColsRows to retrieve the TStrings instance used as the value for the property.

Row number for the values.
Implements a specialized grid for displaying textual content.

TStringGrid is a TCustomStringGrid descendant which implements a specialized grid for displaying textual content in a matrix of columns and rows.

TStringGrid is designed for use with string content stored in its cells. Internally, columns and rows in the class are mapped to TStringGridStrings instances used to store the values in the grid control. TStringGrid also allows a TObject instance to be stored for each cell in the grid using the Objects property.

TStringGrid sets the visibility for properties defined in the ancestor class. It has an overridden WSRegisterClass method to register properties (from older LCL versions) which are no longer used in LCL component streaming.

Uses the Color from the Parent control, when enabled.

ParentColor determines if the control should use the Color from the Parent control, when enabled. The default value for the property is False in TStringGrid.

When this property is True, all changes to the Color of the parent will also be applied to the Color of the control, ensuring that they both contain same value. If the Color of the control is changed by the application, then ParentColor will be automatically set to False.

Using ParentColor when the Color value is clDefault can cause problems in resolving the actual color value. To obtain the Color property of a control while taking into account clDefault and ParentColor, use the GetColorResolvingParent method. This method might return a non-RGB color, but will never return clDefault. To obtain a purely RGB result use the GetRGBColorResolvingParent method.

TControl.ParentColor TControl.Color TControl.GetColorResolvingParent TControl.GetRGBColorResolvingParent
Deprecated. Use OnButtonClick instead.

Deprecated. Use OnButtonClick instead.

Draws a rubber banding rectangle.

Draws a dotted rubber banding rectangle around the provided cell rectangle.

DrawBits contains a Byte value that indicates the rectangle sides drawn in the routine. By default, all sides for the rectangle are drawn. Use the following byte values or-ed together in DrawBits to specify the sides drawn:

BF_LEFT
  Draws the left side of the rectangle.
BF_RIGHT
  Draws the right side of the rectangle.
BF_TOP
  Draws the top of the rectangle.
BF_BOTTOM
  Draws the bottom of the rectangle.

Canvas where the rubber band rectangle is drawn.
Coordinates for the rubber band rectangle.
Color for the rubber band rectangle.
Sides drawn for the rubber band rectangle.
Ensures that a valid handle for a device context exists for the canvas.
The canvas instance with a valid handle.
Canvas examined in the routine.
Ensures a canvas handle for a device context is freed.
Canvas examined in the routine.
Registers components in the Lazarus IDE.

Register is the procedure used to register components for use in the Lazarus IDE. Register calls the RegisterComponents routine to add the TStringGrid and TDrawGrid components to the Additional tab in the Lazarus IDE.

How to use Grids including StringGrids, DrawGrids and DbGrids.

Customizing Grids

Grids are components derived from the TCustomControl class and do not have a native widget associated with them. So they are not restricted by the look of the current interface theme. This can be both an advantage and a disadvantage: usually programmers want to create a uniform-look application. Lazarus grids are flexible enough to allow programmers to make them look similar to other native controls; alternatively they can customize the grid to obtain almost the same look in any platform or widget interface (with the exception of scrollbars, whose look is still determined by the current theme).

Some properties can affect the way the grid looks by acting when the cell is about to be painted in PrepareCanvas/OnPrepareCanvas by changing default canvas properties like brush color or font. Following is a list of such properties:

Properties and Events for Customizing Grids
| Property | Meaning
AlternateColor | The user can change the background color that appears on alternate rows. This is to allow easy reading of grid rows data.
Color | Sets the primary color used to draw non fixed cells' background.
FixedColor | The color used to draw fixed cells' background.
Flat | Eliminates the 3d look of fixed cells.
TitleFont | Font used to draw the text in fixed cells.

TitleStyle

Changes the 3D look of fixed cells. There are 3 settings:

tsLazarus
  The default look
tsNative
  Tries to use an appearance that is in concordance with the current widgetset theme
tsStandard
  A more contrasted look, like Delphi grids

AltColorStartNormal | If true, alternate color is always in the second row after fixed rows; the first row after fixed rows will always be the default color. If false, default color is set to the first row as if there were no fixed rows.
BorderColor | Sets the grid's border color used when Flat=True and BorderStyle=bsSingle;
EditorBorderStyle | If set to bsNone under Windows the cell editors will not have the border, like in Delphi; set to bsSingle by default because the border can be theme specific in some widgetsets and to allow a uniform look.
FocusColor | The color used to draw the current focused cell if UseXORFeatures is not set; by default this is clRed.
FocusRectVisible | Turns on/off the drawing of focused cell.
GridLineColor | Color of grid lines in non fixed area.
GridLineStyle | Pen style used to draw lines in non fixed area, possible choices are: psSolid, psDash, psDot, psDashDot, psDashDotDot, psinsideFrame, psPattern, psClear; default is psSolid.
SelectedColor | Color used to draw cell background on selected cells.
UseXORFeatures | If set, focus rect is drawn using XOR mode so it should make visible the focus rect in combination with any cell color background. It also affects the way that moving columns look.

DefaultDrawing

Normally the grid prepares its grid canvas using properties according to the kind of cell that is being painted. If the user has written an OnDrawCell event handler, DefaultDrawing (if set) also paints the cell background; if the user is taking full responsibility for drawing the cell it is better to turn off this so painting is not duplicated. In a StringGrid, if DefaultDrawing is set it draws the text in each cell.

AutoAdvance | Where the cell cursor will go when pressing enter or tab/shift tab, or after editing.
ExtendedColSizing | If true, the user can resize columns, not just at the headers, but anywhere along the column's height.

Other Properties that Affect Grid Appearance:

Options

This is a set of zero or more choices, with some elements that enable diverse functionality but others that are related directly with grid's look. Options can be set at design-time or run-time.

goFixedVertLine, goFixedHorzLine
  Draws a vertical or horizontal line respectively, delimiting cells or columns in the fixed area; active by default.
goVertLine, goHorzLine
  The same as previous, but for the normal browseable area. A grid can be made to simulate a listbox by unsetting both of these options.
goDrawFocusSelected
  If this option is enabled, a selection background is painted in the focused cell in addition to the focused dotted rectangle. Please note: this doesn't work when the goRowSelect option is set; in such case the row is always painted as if goDrawFocusSelected is set.
goRowSelect
  Selects the full row instead of individual cells.
goFixedRowNumbering
  If set, grid will do numbering of rows in first fixed column.
goHeaderHotTracking
  If set, the grid will try to show a different look when the mouse cursor is over any fixed cell. In order for this to work, desired cell zone needs to be enabled with the HeaderHotZones. Try combining this option with TitleStyle= tsNative to get themed hot tracking look.
goHeaderPushedLook
  If set, this option enables a pushed look when clicking any fixed cell. The zone of "pushable" cells is enabled using HeaderPushedZones property.

Description of the Grid Drawing Process

Like other custom controls, the grid is drawn using the paint method. In general terms the grid is drawn by painting all rows, and each row by painting its individual cells. The process is as follows:

- First, the visible cells area is determined: each row is tested to see if it intersects the canvas clipping region; if it's OK, then the visible area is painted by drawing columns of each row.
- The column and row values are used to identify the cell that is about to be painted and again each column is tested for intersection with the clipping region; if everything is OK, some additional properties like the cell's rectangular extent and visual state are passed as arguments to the DrawCell method.

- As the drawing process is running, the visual state of each cell is adjusted according to grid options and position within grid. The visual state is retained in a variable of type TGridDrawState which is a set with following elements:

  gdSelected | The cell will have a selected look.
  gdFocused | The cell will have a focused look.
  gdFixed | Cell have to be painted with fixed cell look.
  gdHot | the mouse is over this cell, so paint it with hot tracking look
  gdPushed | the cell is being clicked, paint it with pushed look

- DrawCell - The DrawCell method is virtual and may be overridden in descendent grids to do custom drawing. The information passed to DrawCell helps to identify which particular cell is being painted, the physical area occupied on the screen and its visible status. See DrawCell reference for details. For each cell the following occurs:

  - PrepareCanvas - If the DefaultDrawing is set, the grid canvas is setup with default properties for brush and font based on current visual state. For several design and run-time properties, the text alignment is set to match programmer selection in custom columns if they exists. If DefaultDrawing is false, brush color is set to clWindow and Font color to clWindowText, the text alignment is set with grids defaultTextStyle value.
  - OnPrepareCanvas - If the programmer wrote an event handler for the OnPrepareCanvas event, it is called at this point. This event can be used for doing simple customization like changing a cell's background color, font's properties like color, font face and style, Text layout like different combinations of left, center, top, bottom, right alignment, etc. Any change made to the canvas for a particular cell in this event would be lost, because the next cell drawing will reset canvas again to a default state. So it's safe doing changes only for a particular cell or cells and forget about it for the rest. Using this event sometimes helps to avoid using the OnDrawCell grid event, where users would be forced to duplicate the grid's drawing code.
  - OnDrawCell - Next, if no handler for the OnDrawCell event was specified, the grid calls the DefaultDrawCell method which simply paints the cell background using the current canvas brush color and style. If the OnDrawCell handler exists, the grid first paints the cell background, but only if the DefaultDrawing was set; then it calls the OnDrawCell event to do custom cell painting. Usually programmers want to do custom drawing only for particular cells, but standard drawing for others: in this case, they can restrict custom operation to certain cell or cells by looking into ACol, ARow and AState arguments, and for other cells simply call the DefaultDrawCell method and let the grid to take care of it.
  - Text - At this point, if the DefaultDrawing is true, the cell's text content is painted (only for TStringGrid).
  - Grid lines - The last step for each cell is to paint the grid lines: if grid options goVertLine, goHorzLine, goFixedVertLine and goFixedHorzLine are specified the cell grid is drawn at this point. Grids with only rows or only cols can be obtained by changing these options. If the programmer elected to have a "themed" look it is done at this point also (see TitleStyle).
  - FocusRect - When all columns of the current row have been painted it is time to draw the focus rectangle for the current selected cell or for the whole row if the goRowSelect option is set.

Grid Cell Selection

The location of a grid's current (focused) cell (or row) can be changed using keyboard, mouse or through code. In order to change cell focus successfully to another position, we must test the target position to see if it is allowed to receive cell focus. When using the keyboard, AutoAdvance performs part of the process by finding what should be the next focused cell. When using mouse clicks or moving by code, focus will not move from the current cell unless the target cell is permitted to receive focus.

The grid calls SelectCell to see if a cell is focusable: if this function returns true, then the target cell identified with arguments aCol and aRow is focusable (the current implementation of TCustomGrid simply returns true). TCustomDrawGrid and hence TDrawGrid and TStringGrid override this method and check first if a cell is any wider than 0; normally you don't want a 0 width cell selected so a cell with this characteristics is skipped automatically in the process of finding a suitable cell. The overridden method SelectCell also calls the user configurable event OnSelectCell: this event receives the cell coordinates as arguments and always returns a default result of True.

Once a cell is known to be focusable and we are sure a movement will take place, the method BeforeMoveSelection is called; this in turns triggers the OnBeforeSelection event. This method's arguments are the coordinates for the new focused cell; at this point any visible editor is hidden too. The "before" word means that selection is not yet changed and current focused coordinates can be accessed with grid.Col and grid.Row properties.

After that, the internal focused cell coordinates are changed and MoveSelection is called; this method's purpose (if set) is to trigger the OnSelection event (this is a notification that the focused cell has changed and the new cell coordinates are available through grid.row and grid.col properties).

Note that is not good to use the OnSelectCell event to detect cell focus changes, as this event will be triggered several times even for the same cell in the process of finding a suitable cell. Is better to use OnBeforeSelection or OnSelection events for this purpose.

Using Cell Editors

Users can specify what editor will be used for a cell using one of two methods.

1. Using a custom column and selecting the ButtonStyle of the column. In this method the user can select the style of the editor that will be shown. Available values are: cbsAuto, cbsEllipsis, cbsNone, cbsPickList, cbsCheckboxColumn.

2. Using the OnSelectEditor Grid Event

   Here the user specifies in the Editor parameter which editor to use for a cell identified by aCol, ARow in a TCustomDrawGrid derived grid or TColumn in TCustomDBGrid. The public EditorByStyle() function takes as parameter one of the following values: cbsAuto, cbsEllipsis, cbsNone, cbsPickList, cbsCheckboxColumn.

   This method takes precedence over the first one using custom columns. A Custom cell editor can be specified here, with values specific to the cell, row or column.

Description of Editor Styles

The following is a description of the editor styles. They are enumerated values of type TColumnButtonStyle and so they are prefixed by 'cbs'. This type was used to remain compatible with Delphi's DBGrid.

- cbsAuto - This is the default editor style for TCustomGrid derived grids. The TStringCellEditor derived from TCustomMaskEdit is specialized to edit single line strings and is used by default in TStringGrid and TDrawGrid. When using Custom Columns, if the programmer filled the Column's PickList property, this behaves as if cbsPickList editor style was set. For a TCustomDBGrid that has a field of type Boolean, it behaves as if cbsCheckBoxColumn editor style was specified. This is the recommended value for custom cell editors.

- cbsEllipsis - This editor style is the most generic one. A button with ellipsis (...) appears in the editing cell and the programmer can use the OnEditButtonClick grid event to take any programmed action when the user presses the button. For example a calendar dialog could pop up to allow the user to select a specific date, a file open dialog could appear to find files, or a calculator could appear so the user could enter the numeric result of calculations, etc.

  - OnEditButtonClick is just a notification, to find out in which cell a button has been clicked by taking a look at the grid.Row and grid.Col properties.
  - A DBGrid has specific properties to retrieve the active column or field and because this event occurs in the active record, it could update the information in the active field.
  - This editor style is implemented using TButtonCellEditor, a direct descendant of TButton.
- cbsNone - This editor style instructs the grid not to use any editor for a specific column; it behaves as if the cell were read-only.

- cbsPickList - Used to present the user with a list of values that can be entered. This editor style is implemented using TPickListCellEditor, a component derived from TCustomComboBox. The list of values that are shown is filled in one of two ways depending on the method used to select the editor style.

  When using custom columns, programmers can enter a list of values using the PickList property for the column.

- cbsCheckboxColumn - This editor style is at the moment only available in TDBGrid. If a field's contents associated with the column are restricted to a pair of values, for example, yes-no, true-false, on-off, 1-0, etc then cbsCheckboxColumn is used to modify the appearance of a column by using a checkbox representation that the user can toggle by using a mouse click or pressing the SPACE key.

  - If a ButtonStyle for a column is set to cbsAuto and DBGrid detects that the field associated with the column is a Boolean field, then the grid uses this editor style automatically. This automatic selection can be disabled or enabled using DBGrid's OptionsExtra property; setting dgeCheckboxColumn element to false disables this feature.
  - The values that are used to recognize the checked or unchecked states are set in a column's properties ValueChecked and ValueUnchecked.
  - At any moment, the field value can be in one of three states: Unchecked, Checked or Grayed.

ToDo: OnDrawCell example. Editing a pick list example.