Sign in Join
FPDoc Onlineexperiment

TCustomGrid class

In unit Grids

Implements the base class for grid controls.

Declaration

pascal
TCustomGrid = class(TCustomControl)

Inheritance

  1. TCustomGrid
  2. TCustomControl
  3. TWinControl
  4. TControl
  5. TLCLComponent
  6. TComponent
  7. TPersistent
  8. TObject

Descends from it: TCustomDBGrid TCustomDrawGrid

Description

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 used for the cells and other grid elements are specified in the following properties:

The GridWidth and GridHeight properties contain the dimension of the entire grid.

The ScrollBars controls the creation of scroll bars for the grid.

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

The Options and Options2 control the options enabled for the grid.

Please note that most of these properties are declared as protected members. They are not accessible, by default, at design-time using the Object Inspector in the Lazarus IDE. They can, however, be elevated to public or published visibility in descendent classes.

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 OnClick event is signalled when a mouse down event is handled for the control, and when cell navigation is performed using cursor keys on the keyboard. It is signalled when for fixed cells on the grid when the row or column features are enabled in Options2.

The MouseToCell method gets the column and row number for a grid cell at a given position on the screen. MouseToGridZone gets the grid area where the mouse down event occurred. CellToGridZone gets the grid area for the specified column and row number.

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 grid controls.

Grid cell selection

The location of the 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 keyboard, the property 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 the SelectCell function 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 to check first if cell is any wider than 0; normally you don't want a 0 width cell selected so a cell with these characteristics is skipped automatically in the process of finding a suitable cell. The other thing the overridden method SelectCell does is to call the user configurable event OnSelectCell: this event receives the cell coordinates as arguments and always returns a default result value of true.

Once a cell is known to be focusable and we are sure a movement will take place, first 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 then MoveSelection method is called; this method's purpose is to trigger the OnSelection event if set (this is a notification that the focused cell has, by this time, already changed and cell coordinates are now available through grid.row and grid.col properties).

Note that is not good to use 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.

Multi-selection

The Lazarus grids are able to extend the selection to multiple cells. The Option goRangeSelect must be active for this purpose: Now you can drag the mouse over a rectangle on the grid to select all the cells included or intersected by this rectangle. Or you can click on the cell in one corner, hold SHIFT down and either click on the opposite corner of the selection, or press the arrow keys to extend the selection in the corresponding direction.

In the default setting of the RangeSelectMode property, rsmSingle, only a single cell or cell range (rectangle of cells) can be selected, as described. The rsmMulti mode, however, allows selection of multiple and even discontiguous cells or ranges. After selecting the first cell/range as already described, hold the CTRL key down and click on the next cell or drag over the next range to be selected. Instead of dragging you can also select an additional range by pressing SHIFT (in addition to CTRL) and clicking on the opposite corner of the range or pressing the arrow keys.

The selected cells are highlighted by a different color. Note, however, that the currently focused cell has the default background color of the grid unless you set the Option goDrawFocusSelected.

Clicking somewhere on an unselected cell unselects the selected cell(s)/range( s).

If you need to access selections by code you can do this by using these TCustomGrid properties:

SelectedRange[AIndex: Integer]: TGridRect:
Returns the column/row coordinates of the corner cells of the selected range at the specified index (type TGridRect = TRect). A single selected cell is considered to be a block with equal Left and Right column and equal Top and Bottom row coordinates.
SelectedRangeCount: Integer:
The number of selected blocks.

Note that these are read-only properties, you can add and change selections only by user interaction. But you can call ClearSelections to unselect everything.

Your selection handling code must be prepared that a selected cell could be found in another selected block again. Normally this situation is prohibited in the user interface, but there are scenarios where a selection could be extended into another range so that the overlapping cells are "selected twice".

Additional information about grid usage is available on the Lazarus wiki in the following pages:

See also

Properties

AllowOutboundEventsprotectedAllows a mouse click on unused space in the control, and moves the cursor to the nearest valid cell.
AlternateColorprotectedColor used for the background in alternate rows in the grid.
AutoAdvanceprotectedDirection used when automatically moving the selection to the next selectable cell.
AutoEditprotectedIndicates if edit mode is automatically entered when a cell is selected.
AutoFillColumnsprotectedIndicates whether columns are automatically resized to fill the visible area in the grid.
BorderStyleprotectedDrawing style used for the borders on the control.
BorderColorprotectedThe color used for the border on the control.
CellHintPriorityprotectedIdentifies how text is combined to form the Hint property.
ColprotectedColumn index for the selected grid cell.
ColCountprotectedNumber of columns in the grid.
ColRowprotectedProvides access to current column and row numbers as a TPoint instance.
ColRowDraggingCursorprotectedCursor shape displayed when a column or row is dragged in the grid control.
ColRowDragIndicatorColorprotectedColor used to render the drag cursor when a column or row is dragged in the grid.
ColSizingCursorprotectedCursor shape displayed when a column is resized.
ColumnClickSortsprotectedIndicates if clicking a column header changes its sort order.
ColumnsprotectedDefinitions for the columns displayed the grid.
ColWidthsprotectedProvides indexed access to the Width for a column in the grid.
DefaultColWidthprotectedDefault width used for grid columns.
DefaultRowHeightprotectedDefault row height for newly created grid rows.
DefaultDrawingprotectedIndicates if the default drawing mechanism is used to draw the background and text for cells.
DefaultTextStyleprotectedDefault style used to display text including alignment, layout, wrapping, et. al.
DisabledFontColorprotectedColor used to draw text in the grid when Enabled is set to False.
DragDxprotectedThe amount (DeltaX) by which an object should be dragged.
EditorprotectedThe editor control used to modify the value in the current cell.
EditorBorderStyleprotectedThe border style for the Editor control.
EditorModeprotectedTrue when the Editor is ready to modify the value for the current cell.
EditorKeyprotectedIndicates if the last key event was triggered by the cell Editor for the grid control.
EditorOptionsprotectedThe option flags sent to the Editor control in the grid.
EditorShowingprotectedTrue when the cell Editor for the grid control has been displayed.
ExtendedColSizingprotectedIndicates if extended column sizing is enabled in the grid.
ExtendedRowSizingprotectedIndicates if extended row sizing is enabled for rows in the grid.
ExtendedSelectprotectedControls whether extending the current cell selection(s) on the control is enabled.
FastEditingprotectedIndicates if "Fast Editing" is enabled in the grid.
AltColorStartNormalprotectedIndicates if alternate row coloring starts with the normal row color.
FixedColsprotectedThe number of fixed columns in the grid.
FixedRowsprotectedNumber of the fixed rows in the grid.
FixedColorprotectedThe color used for the fixed cells in the grid.
FixedGridLineColorprotectedColor used to draw the separator lines for fixed grid cells.
FixedHotColorprotectedThe color used for hot-lighted fixed cells in the grid.
FlatprotectedIndicates if cells are displayed using a Flat appearance.
FocusColorprotectedThe color used to draw the focus rectangle when a cell has focus.
FocusRectVisibleprotectedIndicates if the focus rectangle is displayed for the control.
GCacheprotectedContains cached data about the visual layout and state for the grid control.
GridFlagsprotectedContains grid-specific state flags active for the control.
GridHeightprotectedTotal height for all of the rows in the grid control.
GridLineColorprotectedColor used for the grid lines on the control.
GridLineStyleprotectedStyle used to draw the grid lines on the control.
GridLineWidthprotectedWidth (thickness) for grid lines drawn on the control.
GridWidthprotectedTotal width for all columns in the Grid including non-visible columns.
HeaderHotZonesprotectedContains the grid zones which are hot-lighted (hovered) on the control.
HeaderPushZonesprotectedContains the grid zones which are drawn in a "pushed" state on the control.
ImageIndexSortAscprotectedOrdinal position for the image used when a column is sorted in ascending order.
ImageIndexSortDescprotectedOrdinal position for the image used when a column is sorted in descending order.
TabAdvanceprotectedControls the behavior for Tab navigation in the grid control.
TitleImageListprotectedThe list with images displayed in column titles.
TitleImageListWidthprotectedStores the default width for images used in the title area for fixed cells.
InplaceEditorprotectedCell editor for the grid control.
IsCellSelectedprotectedProvides indexed access to the selected state for a cell by its column and row number.
LeftColprotectedColumn number for the first visible column on the left edge of the grid.
MouseWheelOptionprotectedSets the mouse wheel behavior for the grid control.
OptionsprotectedContains the set of optional features and/or behaviors enabled for the grid control.
Options2protectedContains additional options for scrolling and editor behavior enabled in the grid control.
RangeSelectModeprotectedControls the range selection mode used for the grid.
RowprotectedRow number for the selected grid cell.
RowCountprotectedNumber of rows in the grid.
RowSizingCursorprotectedCursor shape displayed when the row height is resized.
RowHeightsprotectedProvides indexed access to the height for each row in the grid.
SaveOptionsprotectedOptions which control the information saved and loaded for the grid control.
SelectActiveprotectedIndicates if a Selection is active in the grid control.
SelectedColorprotectedColor used for selected cells in the grid.
FadeUnfocusedSelectionprotectedIndicates if a special color is used for selected cells when the control loses focus.
SelectedColumnprotectedThe column instance for the currently selected cell in the grid control.
SelectionprotectedRectangle with the current cell selections in the grid control.
ScrollBarsprotectedScrollbars displayed for the grid control.
StrictSortprotectedIndicates if strict sorting is used.
TitleFontprotectedThe font used for text in a column title.
TitleStyleprotectedThe drawing style used for the fixed column titles.
TopRowprotectedThe first visible row in the grid.
UseXORFeaturesprotectedWhen True, the dotted focus rectangle is painted using an XOR raster operation.
ValidateOnSetSelectionprotectedControls validation when the text for the selected cell is changed.
VisibleColCountprotectedThe number of visible columns in the grid control.
VisibleRowCountprotectedThe number of visible rows in the grid control.
CursorStatepublicCurrent cursor state for the grid control.
SelectedRangepublicProvides indexed access to TGridRect values in the currently selected range.
SelectedRangeCountpublicNumber of cell rectangles in the selected range for the grid.
SortOrderpublicControls the order used for the sort column (ascending or descending).
SortColumnpublicColumn number used to sort the rows in the grid.
TabStoppublicIndicates if keyboard navigation to/from the control is enabled using the Tab or Shift+Tab keys.

Methods

RTLSignprotectedGets the positive or negative multiplier used to adjust scroll values for BiDi mode.
WSRegisterClassprotectedRegisters this component class with the current WidgetSet.
AddSelectedRangeprotectedAdds the current range selection to the array of selection rectangles for the control.
AdjustClientRectprotectedAdjusts the client rectangle and sets a grid flag to reflect the change.
AdjustEditorBoundsprotectedUpdates the selected cell and sets the bounds for the optional cell Editor.
AfterMoveSelectionprotectedSignals the OnAfterSelection event handler.
AssignToprotectedStores properties from the current grid class instance to the specified target.
AutoAdjustColumnprotectedAdjusts column properties to accommodate the largest value in the specified column.
BeforeMoveSelectionprotectedPerforms actions needed before a selection is moved.
BeginAutoDragprotectedStarts an auto-drag operation in the grid control.
BoxRectprotectedGets the rectangle for the box around the cell at the given coordinates.
CacheMouseDownprotectedUpdates cached grid information when a mouse click occurs in the grid control.
CalcAutoSizeColumnprotectedCalculates the size for an auto-sized column at the specified position.
CalcCellExtentprotectedDeprecated.
CalcFocusRectprotectedCalculates the bounds for a focus rectangle in the grid control.
CalcMaxTopLeftprotectedUpdates cached grid information for the visible area and scroll bars in the control.
CalcScrollbarsRangeprotectedUpdates the range, page, and thumb position for visible scroll bars.
CalculatePreferredSizeprotectedGets the preferred width and height for the control.
CanEditShowprotectedIndicates whether the cell editor can be displayed and focused in the current column.
CanGridAcceptKeyprotectedReturns True if the grid is able to accept the given key.
CellClickprotectedProcesses a mouse click in the cell at the given coordinates.
CellExtentprotectedGets the last column number for the cell extent at the specified column and row.
CheckLimitsprotectedChecks column and row limits for the specified cell.
CheckLimitsWithErrorprotectedChecks column and row limits for the specified cell, with error trapping.
CMBiDiModeChangedprotectedHandles the CM_BIDIMODECHANGED control message for the grid control.
CMMouseEnterprotectedHandles the control message posted when the mouse enters a cell in the grid.
CMMouseLeaveprotectedHandles the control message posted when a mouse leaves a cell.
ColRowDeletedprotectedPerforms actions when a column or a row is deleted from the control.
ColRowExchangedprotectedPerforms a notification when column or row data at the specified positions are exchanged in the grid control.
ColRowInsertedprotectedPerforms actions needed when column or row data is inserted into the grid control.
ColRowMovedprotectedPerforms actions when a column or row is moved in the grid.
ColRowToOffsetprotectedConverts a column or row index to starting and ending pixels coordinates.
ColumnIndexFromGridColumnprotectedGets the position of the specified column relative to the first column in the grid.
ColumnFromGridColumnprotectedReturns the grid column definition at the specified position in Columns.
ColumnsChangedprotectedPerforms actions needed when one or more columns in the grid are changed.
ColWidthsChangedprotectedPerforms actions needed when the widths for grid columns have been changed.
CreateColumnsprotectedAllocates and configures resources for the Columns collection.
CheckNewCachedSizesprotectedChecks the values for cached column sizes when they have been reset in the grid.
CreateWndprotectedCreates and configures the widgetset handle for the grid control.
CreateParamsprotectedInitializes the window creation parameters with the settings for the control.
ClickprotectedPerforms actions needed when a mouse click occurs in the grid control.
DblClickprotectedPerforms actions needed to handle mouse double click events in the control.
DefaultColWidthIsStoredprotectedIndicates if the DefaultColWidth property is available in component streaming.
DefaultRowHeightIsStoredprotectedIndicates if the DefaultRowHeight property is available in component streaming.
DefinePropertiesprotectedDefines non-published properties included during LCL component streaming.
DestroyHandleprotectedDestroys the handle for the control and all child controls.
DialogCharprotectedApplies an accelerator key for a column in the grid.
DoCompareCellsprotectedPerforms a comparison between the specified cells in the grid control.
DoCopyToClipboardprotectedPerforms actions needed to copy a cell or a text selection to the clipboard.
DoCutToClipboardprotectedPerforms actions needed to cut a cell or a text selection to the clipboard.
DoEditButtonClickprotectedPerforms actions needed when the button for the editor control is clicked.
DoEditorHideprotectedPerforms actions needed to hide the cell Editor in the grid control.
DoEditorShowprotectedPerforms actions needed to show the cell Editor for the grid control.
DoExitprotectedPerforms actions needed when the control loses focus.
DoEnterprotectedPerforms actions needed when the grid control receives focus.
DoLoadColumnprotectedSignals the OnLoadColumn event handler for the grid control (when assigned).
DoSaveColumnprotectedSignals the OnSaveColumn event handler for the grid control (when assigned).
DoMouseWheelprotectedHandles a mouse wheel operation for the grid control.
DoMouseWheelDownprotectedHandles a mouse wheel down movement for the grid control.
DoMouseWheelUpprotectedHandles a mouse wheel up movement for the grid control.
DoMouseWheelLeftprotectedHandles a mouse wheel scroll left message for the control.
DoMouseWheelRightprotectedHandles a mouse wheel scroll right message for the control.
DoAutoAdjustLayoutprotectedPerforms actions to automatically apply the layout policy with the specified scaling factors.
DoOnChangeBoundsprotectedSignals OnChangeBounds event handlers for the control.
DoOPDeleteColRowprotectedPerforms a delete operation for a column or a row.
DoOPExchangeColRowprotectedPerforms an exchange of values for the columns or rows with the specified indexes.
DoOPInsertColRowprotectedPerforms an insert operation for a column or a row at the specified position.
DoOPMoveColRowprotectedPerforms a move operation for the column or row at the specified position.
DoPasteFromClipboardprotectedPastes data from the clipboard into the grid control.
DoPrepareCanvasprotectedPerforms actions needed to prepare the canvas for a drawing operation.
DoOnResizeprotectedPerforms actions needed when the grid control is resized.
DoSetBoundsprotectedCaptures the current client width prior to setting the new bounds for the control.
DoUTF8KeyPressprotectedApplies a UTF-8-encoded character to the active cell editor in the control.
DrawBorderprotectedDraws the border for the grid control.
DrawAllRowsprotectedDraws all of the rows for the grid.
DrawFillRectprotectedDraws the fill rectangle on the specified canvas.
DrawCellprotectedDraws a cell using a given state at the specified grid location (Col, Row, rectangle).
DrawCellGridprotectedDraws cell grid lines for the control.
DrawTextInCellprotectedDraws the text for a non-fixed cell in the grid.
DrawThemedCellprotectedDraws a cell using the theme services for the specified grid drawing state.
DrawCellTextprotectedDraws the specified text in the given text rectangle.
DrawGridCheckboxBitmapsprotectedDraws a check box bitmap which represents the given state in a cell.
DrawButtonCellprotectedDraws a cell in a button-style column.
DrawColRowMovingprotectedDraws a column or row when dragging is in effect.
DrawColumnTextprotectedDraws the text and image for a grid column title at the specified cell coordinates.
DrawColumnTitleImageprotectedDraws the image(s) used in the column title at the specified index in the grid.
DrawEdgesprotectedDraws the edges (and filled background) of the client area for the control.
DrawFocusRectprotectedDraws the focus rectangle for the specified cell.
DrawRowprotectedDraws the columns for the specified row in the grid control.
EditButtonClickedprotectedSignals the OnEditButtonClick or OnButtonClick event handler (when assigned).
EditordoGetValueprotectedGets the value for the cell Editor.
EditordoResetValueprotectedResets the value in the selected cell when a visible editor is cancelled or hidden.
EditordoSetValueprotectedSets the mask and value for a visible cell editor in the grid control.
EditorCanAcceptKeyprotectedReturns True if the Editor is able to accept the specified UTF-8 character.
EditorIsReadOnlyprotectedDetermines if the current column number is defined as read-only.
EditorHideprotectedHides a visible cell editor in the grid control.
EditorLockedprotectedReturns True if the Editor is locked, i.e. unable to accept input or make changes.
EditingAllowedprotectedIndicates if the grid and specified column allow editing.
EditorSelectAllprotectedPerforms actions to select the entire content in the current cell.
EditorShowprotectedDisplays the Editor for the selected cell.
EditorShowInCellprotectedShows the cell content for the Editor in situ.
EditorWidthChangedprotectedPerforms actions needed when the width for a cell Editor has been changed.
FirstGridColumnprotectedGets the position of the first column after any fixed columns in the grid.
FixedGridprotectedDetermines if all columns or all rows in the grid are fixed.
FontChangedprotectedPerforms actions needed when the font for the control is changed.
GetAutoFillColumnInfoprotectedGets auto-fill information for the specified column.
GetCellHintTextprotectedGets the hint for the specified cell using the Options enabled in the grid control.
GetCellsprotectedGets the cell content at the specified column and row numbers.
GetColumnAlignmentprotectedGets the horizontal Alignment for the specified column.
GetColumnColorprotectedGets the Color used to render the background for the specified column number.
GetColumnFontprotectedGets the font used to render values for the specified column.
GetColumnLayoutprotectedGets the vertical text Layout value for the specified column.
GetColumnReadonlyprotectedReturns True if the column is marked as ReadOnly.
GetColumnTitleprotectedGets the text displayed as the column title for the specified column number.
GetColumnWidthprotectedGets the width of the column at the specified column number.
GetDeltaMoveNextprotectedReturns the relative cell coordinates for the next cell in the grid navigation order.
GetDefaultColumnAlignmentprotectedGets the default horizontal alignment used for values in the grid control.
GetDefaultColumnWidthprotectedGets the default width used for the specified column.
GetDefaultColumnLayoutprotectedGets the default vertical layout for text in the specified column.
GetDefaultColumnReadOnlyprotectedGets the default setting for the ReadOnly flag in the specified column number.
GetDefaultColumnTitleprotectedGets the default text used as the column title for the specified column number.
GetDefaultEditorprotectedGets the default cell editor for the specified column.
GetDefaultRowHeightprotectedGets the default height for a row in the grid control.
GetGridDrawStateprotectedGets the grid drawing state for the cell with the specified column and row numbers.
GetImageForCheckBoxprotectedGets the bitmap used to draw check box columns in the grid.
GetScrollBarPositionprotectedGets the position for the specified scroll bar.
GetSmoothScrollprotectedGets the smooth scroll setting in the Options for the grid.
GetSBVisibilityprotectedGets the values for the scroll bar visibility flags in the control.
GetSBRangesprotectedGets the range values for the scroll bars when visible.
GetSelectedStateprotectedGets the effective selected state using the control Options and the grid draw state.
GetEditMaskprotectedGets the edit mask for the specified cell.
GetEditTextprotectedGets the text displayed in the Editor for the specified cell.
GetFixedcolorprotectedGets the value for the FixedColor property.
GetFirstVisibleColumnprotectedGets the column number for the first visible non-fixed column in the grid.
GetFirstVisibleRowprotectedGets the row number for the first visible non-fixed row in the grid.
GetLastVisibleColumnprotectedGets the column number for the last visible non-fixed column in the grid.
GetLastVisibleRowprotectedGets the row number for the last visible non-fixed row in the grid.
GetSelectedColorprotectedGets the value for the SelectedColor property.
GetTitleShowPrefixprotectedGets the prefix option for the title in the specified column number.
GetPxTopLeftprotectedGets a TPoint instance with the top and left coordinates for the first visible, non-fixed row in the grid control.
GetTruncCellHintTextprotectedGets the truncated version of the hint for the cell at the specified position.
GridColumnFromColumnIndexprotectedGets the ordinal position in Columns for the visible column specified in ColumnIndex.
GridMouseWheelprotectedPerforms actions to apply a mouse wheel message to the grid control.
HeaderClickprotectedPerforms actions needed when a mouse click occurs in a fixed header for a grid column or row.
HeaderSizedprotectedPerforms actions needed when a column or a row has been resized.
HeaderSizingprotectedPerforms actions to resize a column or row to the specified size.
HideCellHintWindowprotectedCancels the current hint display and restores the saved hint for the grid control.
InternalSetColCountprotectedPerforms actions needed to set the column count in the grid control.
InvalidateCellprotectedRenders a cell invalid, and redraws the cell if required.
InvalidateFromColprotectedInvalidates cells starting at the specified column number; all rows from the start position are affected.
InvalidateGridprotectedInvalidates the client area for the grid control.
InvalidateFocusedprotectedInvalidates a focused or highlighted cell or row.
IsColumnIndexValidprotectedIndicates if the specified index position is valid for the columns in the grid.
IsRowIndexValidprotectedIndicates if the specified index position is valid for the rows in the grid.
IsColumnIndexVariableprotectedTrue when the column index is in the range FixedCols..ColCount-1.
IsRowIndexVariableprotectedIndicates if the specified row is a valid, non-fixed row in the grid control.
GetIsCellTitleprotectedIndicates if the cell at the specified position is a fixed column header.
GetIsCellSelectedprotectedGets the value for the indexed IsCellSelected property.
IsEmptyRowprotectedIndicates if all non-fixed cells in the specified row are empty.
IsMouseOverCellButtonprotectedIndicates if the specified mouse position is over a cell defined with a button column cell editor.
KeyDownprotectedHandles key down events for the grid control.
KeyUpprotectedSignals the OnKeyUp event handler (when assigned).
KeyPressprotectedApplies the specified key press character to the control.
LoadContentprotectedLoads values for the grid control from the specified XML configuration file.
LoadGridOptionsprotectedLoads design-time values for the Options in a grid from an XML configuration file.
LoadedprotectedPerforms actions when the component has been loaded using LCL component streaming.
LockEditorprotectedLocks the Editor so that it cannot accept input or changes.
MouseButtonAllowedprotectedIndicates if the specified mouse button is a mouse down event used in the control.
MouseDownprotectedHandles mouse down events for the grid control.
MouseMoveprotectedApplies a change in the mouse pointer position to the grid control.
MouseUpprotectedHandles a mouse up event for the grid control.
MoveExtendprotectedMoves the selected cell or extends a selection using the specified column and row values.
MoveNextAutoprotectedMoves to the next cell in the auto-advance sequence.
MoveNextSelectableprotectedMoves to the next selectable cell in the specified direction.
MoveSelectionprotectedSignals the OnSelection event handler for a new mouse selection.
NotificationprotectedPerforms actions needed when the specified component is added to or removed from the control.
OffsetToColRowprotectedDetermines the index of a column or row for a the specified offset.
PaintprotectedDraws the edges, borders, and rows in the grid control.
PickListItemSelectedprotectedSignals the OnPickListSelect event handler when a selection is made in a picklist.
PrepareCanvasprotectedPrepares the canvas for drawing the cell at the specified location.
PrepareCellHintsprotectedPrepares the control to display hints for a cell.
RangeContainsprotectedIndicates whether the specified grid rectangle contains the specified cell coordinates.
ResetDefaultColWidthsprotectedRestores the default width for columns in the grid.
ResetEditorprotectedResets the value in the cell Editor, and optionally re-displays and selects it content.
ResetLastMoveprotectedResets the member used to track the last row or column movement.
ResetOffsetprotectedResets cached column (Top/Left) and row offsets.
ResetSizesprotectedResets the internal column sizes.
ResizeColumnprotectedResizes the specified column number to the given width.
ResizeRowprotectedResizes the specified row number to the given height.
RowHeightsChangedprotectedPerforms actions needed when the values in RowHeights have been changed.
SaveContentprotectedSaves design-time configuration, column and row settings, and data to the specified XML configuration file.
SaveGridOptionsprotectedSaves grid options to the specified XML configuration file.
ScrollBarRangeprotectedSets range information for the specified scroll bar.
ScrollBarPositionprotectedSets the position for the specified scroll bar to the given value.
ScrollBarIsVisibleprotectedReturns True if the specified scroll bar is visible.
ScrollBarPageprotectedUpdates the page size for the specified scroll bar.
ScrollBarShowprotectedDisplays or hides scroll bar(s) for the grid control.
ScrollBarAutomaticprotectedIndicates whether an automatic scroll bar of the given type is used on the grid control.
ScrollByprotectedScrolls the non-fixed area for the control by the specified delta values.
SelectEditorprotectedGets the cell editor for the current cell, and sets its PopupMenu.
SelectCellprotectedDetermines whether the specified cell can be selected in the grid control.
SetCanvasFontprotectedSets the Canvas font to the specified value.
SetColCountprotectedSets the value in the ColCount property.
SetColorprotectedSets the value in the Color property.
SetColRowprotectedMakes the specified column and row a selected cell in the grid control.
SetCursorprotectedChanges the cursor shape in the grid to the specified value.
SetEditTextprotectedSets the value used in the cell Editor to the specified text.
SetBorderStyleprotectedSets the value for the BorderStyle property.
SetFixedcolorprotectedSets the value for the FixedColor property.
SetFixedColsprotectedSets the value for the FixedCols property.
SetFixedRowsprotectedSets the value for the FixedRows property.
SetRawColWidthsprotectedSets the width for the specified column number in the internal list.
SetSelectedColorprotectedSets the value for the SelectedColor property.
SetFadeUnfocusedSelectionprotectedSets the value for the FadeUnfocusedSelection property.
ShowCellHintWindowprotectedGets and displays the cell hint(s) for the current cell in the grid.
SizeChangedprotectedPerforms actions needed when the number of columns or rows has been changed.
SortprotectedSorts rows or columns in the grid.
StartPushCellprotectedStarts an operation to render a cell in its "pushed" state.
TopLeftChangedprotectedSignals the OnTopLeftChanged event handler (when assigned) at run-time.
TryMoveSelectionprotectedTries to move the cell selection by or to the specified column and row values.
TrySmoothScrollByprotectedScrolls the grid origin by the specified relative amounts.
UnLockEditorprotectedDecrements the lock count for the cell Editor following a call to LockEditor.
UnprepareCellHintsprotectedRe-implemented in descendent classes.
UpdateHorzScrollBarprotectedUpdates the horizontal scroll bar to use the specified range, page, and position.
UpdateSelectionRangeprotectedUpdates the selection range when the current selection in the grid has changed.
UpdateVertScrollbarprotectedUpdates the vertical scroll bar to use the specified visibility, range, and page values.
UpdateBorderStyleprotectedUpdates the border style used for the control.
ValidateEntryprotectedValidates the value for the specified cell.
VisualChangeprotectedUpdates the grid after changes to the visual properties in the control.
WMSizeprotectedHandles a WM_SIZE window message for the control.
WMHScrollprotectedHandles the system message for horizontal scrolling.
WMVScrollprotectedHandles the system message for vertical scrolling.
WMKillFocusprotectedHandles the LM_KILLFOCUS message for the control.
WMSetFocusprotectedHandles the LM_KILLFOCUS message for the control.
WndProcprotectedExtends the message processing loop for the grid control.
FlipRectprotectedFlips coordinates for the specified cell rectangle when BiDiMode or RTL alignment is used.
FlipPointprotectedFlips cell coordinates for the specified point on the parent rectangle when BiDiMode or RTL alignment is used.
FlipXprotectedFlips the horizontal position in the client when BiDiMode or RTL alignment is used.
CreatepublicConstructor for the class instance.
DestroypublicDestructor for the class instance.
InvalidatepublicPerforms a request to redraw the control.
EditingDonepublicSignals the OnEditingDone event handler.
AdjustInnerCellRectpublicAdjusts the cell rectangle to account for grid lines drawn around a cell.
AutoAdjustColumnspublicAutomatically adjusts columns sizes to the width of their content.
BeginUpdatepublicBegins an update to the grid control.
CellRectpublicThe coordinates for the specified cell (ACol, ARow) as a standard rectangle (TRect).
CellToGridZonepublicDetermines the grid zone for the specified cell.
CheckPositionpublicDetermines if the cell can be selected, or finds a suitable position using auto-advance.
ClearColspublicClears the values in the FixedCols and Cols properties.
ClearRowspublicClears the cached fixed rows and row count values for the grid control.
ClearpublicClears all cells in the grid control.
ClearSelectionspublicClears the current range selection(s) and redraws the grid control.
EditorByStylepublicSelects a cell Editor control with the specified style.
EditorKeyDownpublicImplements the OnKeyDown event handler for the cell editor.
EditorKeyPresspublicImplements the OnKeyPress event handler for the cell editor.
EditorUTF8KeyPresspublicImplements the UTF-8 key press handler for the editor in the grid control.
EditorKeyUppublicImplements the OnKeyUp event handler for the cell editor.
EditorTextChangedpublicUpdates the grid control when the value in a cell Editor is changed.
EndUpdatepublicFinishes an active update to the grid control.
EraseBackgroundpublicClears the background for the grid control.
FixDesignFontsPPIpublicAdjusts fonts in the control to the specified design-time PixelsPerInch.
FocusedpublicIndicates if the grid is focused or has an active focused cell Editor.
HasMultiSelectionpublicIndicates if multi-select range selection mode is enabled and in use for the grid.
HideSortArrowpublicHides the arrow drawn as the sort indicator for a column.
InvalidateColpublicInvalidates all cells in the specified column, and causes them to be redrawn.
InvalidateRangepublicInvalidates a cell range in the grid and causes it to be redrawn.
InvalidateRowpublicInvalidates the drawing rectangle for the specified row number.
IsCellVisiblepublicDetermines whether the specified cell is visible.
IsFixedCellVisiblepublicDetermines if the specified cell is a visible fixed header cell in the grid.
LoadFromFilepublicLoads grid data from a file with the specified file name.
LoadFromStreampublicLoads grid data from the specified stream.
MouseCoordpublicGets the cell coordinates for the specified mouse pointer position.
MouseToCellpublicConverts the specified mouse screen coordinates to cell coordinates.
MouseToLogcellpublicConverts mouse coordinates to logical cell coordinates on the grid.
MouseToGridZonepublicConverts the specified mouse coordinates to the grid zone where the coordinates are located.
SaveToFilepublicSaves grid information to a file with the specified name.
SaveToStreampublicSaves grid information to the specified stream.
ScaleFontsPPIpublicResizes fonts using a target PPI and a scaling factor.
SetFocuspublicGives focus to the grid control.

Events

OnAfterSelectionprotectedEvent handler signalled after a new Selection is made in the grid.
OnBeforeSelectionprotectedEvent handler signalled before changing the Selection in the grid control.
OnCheckboxToggledprotectedEvent handler signalled when the value for a check box cell is toggled.
OnCompareCellsprotectedEvent handler signalled to compare the content in grid cells.
OnPrepareCanvasprotectedEvent handler signalled to prepare the Canvas to draw the grid.
OnDrawCellprotectedEvent handler signalled to draw a cell in the grid control.
OnEditButtonClickprotectedEvent handler signalled when the button in a cell Editor is clicked. Deprecated.
OnButtonClickprotectedEvent handler signalled when a button-style cell Editor control is clicked.
OnPickListSelectprotectedEvent handler signalled when an item is selected from a pick list-style Editor control.
OnSelectionprotectedEvent handler signalled when an area is selected in the grid control.
OnSelectEditorprotectedEvent handler signalled to select an Editor control for the current grid cell.
OnTopLeftChangedprotectedEvent handler signalled when the top left cell in the visible area of the control is changed.
OnUserCheckboxBitmapprotectedEvent handler signalled to get the user-defined bitmap used for a check box cell.
OnUserCheckboxImageprotectedEvent handler signalled to get the user-defined image used for a check box cell.
OnValidateEntryprotectedEvent handler signalled to perform validation for a cell value.
OnGetCellHintprotectedGets the hint text for a cell.
OnSaveColumnprotectedEvent handler signalled when an entry in Columns is saved to a configuration file using the SaveContent method.
OnLoadColumnprotectedEvent handler signalled when a column is loaded in the LoadColumns method.

Fields

fGridStateprotectedMember with the current state for the grid (edited, updated, etc.).

Inherited

From TCustomControl (5)

Canvas DestroyWnd OnPaint PaintWindow WMPaint

From TWinControl (211)

AddControl AlignControls AllAutoSized AutoAdjustLayout AutoSizeDelayed AutoSizeDelayedHandle AutoSizeDelayedReport AutoSizePhases BeginUpdateBounds BorderWidth BoundsLockCount BroadCast Brush BrushCreated CachedClientHeight CachedClientWidth CanFocus CanSetFocus CanTab ChangeScale ChildClassAllowed ChildHandlesCreated ChildKey ChildSizing ClientRectNeedsInterfaceUpdate CMBorderChanged CMDoubleBufferedChanged CMEnabledChanged CMEnter CMExit CMParentDoubleBufferedChanged CMShowHintChanged CMShowingChanged CMVisibleChanged CNChar CNKeyDown CNKeyUp CNSysKeyDown CNSysKeyUp ContainsControl ControlAtPos ControlCount ControlKeyDown ControlKeyUp Controls ControlsAligned CreateBrush CreateDockManager CreateHandle CreateParented CreateParentedControl CreateSubClass CustomAlignInsertBefore CustomAlignPosition DefaultHandler DefWndProc DesignerDeleting DisableAlign DoAddDockClient DoAdjustClientRectChange DoAlignChildControls DoAllAutoSize DoAutoSize DoChildSizingChange DockClientCount DockClients DockDrop DockManager DockOver DockSite DoConstraintsChange DoDockClientMsg DoDockOver DoDragMsg DoFlipChildren DoFloatMsg DoGetDockCaption DoKeyDownBeforeInterface DoKeyPress DoKeyUpBeforeInterface DoRemainingKeyDown DoRemainingKeyUp DoRemoveDockClient DoSendBoundsToInterface DoSendShowHideToInterface DoubleBuffered DoUnDock DoUndockClientMsg EnableAlign EndUpdateBounds FinalizeWnd FindChildControl FindNextControl FixDesignFontsPPIWithChildren FixupTabList FlipChildren FormEndUpdated GetAdjustedLogicalClientRect GetBorderStyle GetChildren GetChildrenRect GetClientOrigin GetClientRect GetControlIndex GetControlOrigin GetDeviceContext GetDockCaption GetEnumeratorControls GetEnumeratorControlsReverse GetMouseCapture GetParentHandle GetPreferredSizeClientFrame GetSiteInfo GetTabOrderList GetTextLen GetTopParentHandle Handle HandleAllocated HandleNeeded InitializeWnd InsertControl IntfGetDropFilesTarget IntfUTF8KeyPress InvalidateBoundsRealized InvalidateClientRectCache InvalidatePreferredChildSizes IsClientHeightStored IsClientWidthStored IsControlMouseMsg IsFlipped IsResizing IsSpecialSubControl KeyDownAfterInterface KeyDownBeforeInterface KeyUpAfterInterface KeyUpBeforeInterface LockRealizeBounds MainWndProc NotifyControls OnAlignInsertBefore OnAlignPosition OnDockDrop OnDockOver OnEnter OnExit OnGetDockCaption OnGetSiteInfo OnKeyDown OnKeyPress OnKeyUp OnUnDock OnUTF8KeyPress PaintControls PaintHandler PaintTo ParentDoubleBuffered ParentFormHandleInitialized ParentHandlesAllocated ParentWindow PerformTab RealGetText ReAlign RealizeBounds RealizeBoundsRecursive RealSetText ReloadDockedControl RemoveControl RemoveFocus Repaint ScaleBy ScaleControls ScrollBy_WS SelectFirst SelectNext SendDialogChar SendMoveSizeMessages SetBounds SetChildZPosition SetControlIndex SetDockManager SetShape SetTempCursor ShowControl Showing TabOrder UnlockRealizeBounds Update UpdateControlState UpdateDockCaption UpdateShowing UseDockManager UTF8KeyPress VisibleDockClientCount WindowHandle WMChar WMContextMenu WMDestroy WMEnter WMEraseBkgnd WMExit WMKeyDown WMKeyUp WMMove WMNotify WMShowWindow WMSysChar WMSysKeyDown WMSysKeyUp WMWindowPosChanged WriteLayoutDebugReport WSSetText

From TControl (344)

AccessibleDescription AccessibleName AccessibleRole AccessibleValue Action ActionChange ActionLink ActiveDefaultControlChanged AddHandler AddHandlerOnBeforeDestruction AddHandlerOnChangeBounds AddHandlerOnEnabledChanged AddHandlerOnEnabledChanging AddHandlerOnKeyDown AddHandlerOnMouseWheel AddHandlerOnResize AddHandlerOnVisibleChanged AddHandlerOnVisibleChanging AdjustSize Align AnchorAsAlign AnchorClient AnchoredControlCount AnchoredControls AnchorHorizontalCenterTo AnchorParallel Anchors AnchorSame AnchorSide AnchorSideBottom AnchorSideChanged AnchorSideLeft AnchorSideRight AnchorSideTop AnchorToCompanion AnchorToNeighbour AnchorVerticalCenterTo AutoSize AutoSizing AutoSizingAll AutoSizingLockCount BaseBounds BaseParentClientSize BeforeDestruction BeforeDragStart BeginAutoSizing BeginDrag BiDiMode BorderSpacing BoundsChanged BoundsRect BoundsRectForNewParent BringToFront CalculateDockSizes CanAutoSize Caption CaptureChanged CaptureMouseButtons ChangeBounds Changed CheckChildClassAllowed CheckNewParent CheckOnChangeBounds ClientHeight ClientOrigin ClientRect ClientToParent ClientToScreen ClientWidth CMChanged CMCursorChanged CMHintShow CMHitTest CMParentBiDiModeChanged CMParentColorChanged CMParentFontChanged CMParentShowHintChanged CMSysFontChanged CMTextChanged CNPreferredSizeChanged Color ColorIsStored ConstrainedResize Constraints ControlFontClass ControlOrigin ControlState ControlStyle ControlToScreen CreateAccessibleObject CreateControlBorderSpacing CreateFloatingDockSite Cursor DesktopFont DisableAutoSizing DoBorderSpacingChange DoCallKeyEventHandler DoCallMouseWheelEventHandler DoCallNotifyHandler Dock Docked DockOrientation DockTrackNoTarget DoContextPopup DoDock DoEndDock DoEndDrag DoFixDesignFontPPI DoMouseDown DoMouseUp DoMouseWheelHorz DoOnParentHandleDestruction DoOnShowHint DoScaleFontPPI DoStartDock DoStartDrag DragCanceled DragCursor DragDrop Dragging DragKind DragMode DragOver EnableAutoSizing Enabled EnabledChanged EnabledChanging EndAutoSizing EndDrag ExecuteCancelAction ExecuteDefaultAction FindSubComponent Floating FloatingDockSiteClass Font ForeignAnchorSideChanged FormIsUpdating GetAccessibleObject GetAction GetActionLinkClass GetAnchorsDependingOnParent GetCachedText GetCanvasScaleFactor GetChildAccessibleObjectAtPos GetClientScrollOffset GetColorResolvingParent GetControlClassDefaultSize GetCursor GetDefaultColor GetDefaultDockCaption GetDefaultHeight GetDefaultWidth GetDockEdge GetDragImages GetEnabled GetFloating GetFloatingDockSiteClass GetLogicalClientRect GetMousePosFromMessage GetPalette GetParentBackground GetParentComponent GetPopupMenu GetPreferredSize GetRGBColorResolvingParent GetScrolledClientRect GetSelectedChildAccessibleObject GetSidePosition GetTextBuf GetTopParent HandleObjectShouldBeVisible HasHelp HasParent Height HeightIsAnchored HelpContext HelpKeyword HelpType Hide Hint HostDockSite InitiateAction InvalidateControl InvalidatePreferredSize IsAParentAligning IsBorderSpacingInnerBorderStored IsCaptionStored IsControl IsControlVisible IsEnabled IsParentColor IsParentFont IsParentOf IsProcessingPaintMsg IsRightToLeft IsVisible Left LMCaptureChanged LoadedAll LRDockWidth ManualDock ManualFloat MouseCapture MouseEnter MouseInClient MouseLeave OnChangeBounds OnClick OnConstrainedResize OnContextPopup OnDblClick OnDragDrop OnDragOver OnEditingDone OnEndDock OnEndDrag OnMouseDown OnMouseEnter OnMouseLeave OnMouseMove OnMouseUp OnMouseWheel OnMouseWheelDown OnMouseWheelHorz OnMouseWheelLeft OnMouseWheelRight OnMouseWheelUp OnQuadClick OnResize OnShowHint OnStartDock OnStartDrag OnTripleClick Parent ParentBackground ParentBiDiMode ParentColor ParentDestroyingHandle ParentFont ParentFontChanged ParentShowHint ParentToClient Perform PopupMenu PositionDockRect QuadClick ReadBounds ReadState Refresh RemoveAllHandlersOfObject RemoveHandler RemoveHandlerOnBeforeDestruction RemoveHandlerOnChangeBounds RemoveHandlerOnEnabledChanged RemoveHandlerOnEnabledChanging RemoveHandlerOnKeyDown RemoveHandlerOnMouseWheel RemoveHandlerOnResize RemoveHandlerOnVisibleChanged RemoveHandlerOnVisibleChanging ReplaceDockedControl RequestAlign Resize Scale96ToFont Scale96ToForm Scale96ToScreen ScaleConstraints ScaleDesignToForm ScaleFontTo96 ScaleFontToScreen ScaleFormTo96 ScaleFormToDesign ScaleScreenTo96 ScaleScreenToFont ScreenToClient ScreenToControl SendToBack SessionProperties SetAction SetAlign SetAnchors SetAutoSize SetBiDiMode SetBoundsKeepBase SetDragMode SetEnabled SetHint SetInitialBounds SetName SetParent SetParentBackground SetParentBiDiMode SetParentComponent SetTextBuf SetVisible SetZOrder ShouldAutoAdjust Show ShowHelp ShowHint TBDockHeight Text TextChanged Top TripleClick UndockHeight UndockWidth UpdateAnchorRules UpdateBaseBounds UpdateMouseCursor UpdateRolesForForm UseRightToLeftAlignment UseRightToLeftReading UseRightToLeftScrollBar Visible VisibleChanged VisibleChanging Width WidthIsAnchored WindowProc WMCancelMode WMLButtonDBLCLK WMLButtonDown WMLButtonQuadCLK WMLButtonTripleCLK WMLButtonUp WMMButtonDBLCLK WMMButtonDown WMMButtonQuadCLK WMMButtonTripleCLK WMMButtonUp WMMouseHWheel WMMouseMove WMMouseWheel WMRButtonDBLCLK WMRButtonDown WMRButtonQuadCLK WMRButtonTripleCLK WMRButtonUp WMXButtonDBLCLK WMXButtonDown WMXButtonQuadCLK WMXButtonTripleCLK WMXButtonUp

From TLCLComponent (6)

DecLCLRefCount GetWSComponentClass IncLCLRefCount LCLRefCount NewInstance WidgetSetClass

From TComponent (64)

_AddRef _Release CanObserve ChangeName ComObject ComponentCount ComponentIndex Components ComponentState ComponentStyle DesignInfo DestroyComponents Destroying ExecuteAction FindComponent FreeNotification FreeOnRelease GetChildOwner GetChildParent GetDeltaStreams GetEnumerator GetIDsOfNames GetNamePath GetObservers GetOwner GetTypeInfo GetTypeInfoCount iicrGetComponent InsertComponent Invoke IsImplementorOf Loading Name ObserverAdded Observers OnGetDeltaStreams Owner PaletteCreated QueryInterface ReadDeltaState ReadDeltaStream ReferenceInterface RemoveComponent RemoveFreeNotification RemoveFreeNotifications SafeCallException SetAncestor SetChildOrder SetDesigning SetDesignInstance SetInline SetSubComponent Tag ToString TToStringNameMode UpdateAction Updated UpdateRegistry Updating ValidateContainer ValidateInsert ValidateRename VCLComObject WriteState

From TPersistent (4)

Assign FPOAttachObserver FPODetachObserver FPONotifyObservers

From TObject (35)

AfterConstruction CheckDisposed ClassInfo ClassName ClassNameIs ClassParent ClassType CleanupInstance DefaultHandlerStr Dispatch DispatchStr Disposed DisposeOf Equals FieldAddress Free FreeInstance GetDisposed GetHashCode GetInterface GetInterfaceByStr GetInterfaceEntry GetInterfaceEntryByStr GetInterfaceTable GetInterfaceWeak GetLastCastErrorInfo InheritsFrom InitInstance InstanceSize MethodAddress MethodName QualifiedClassName StringMessageTable SystemHasExtendedRTTI UnitName

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