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

TCustomGrid

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

TCustomGrid - the base class for all grid controls

Declaration

Source position: grids.pas line 706

type TCustomGrid = class(TCustomControl) end;

protected

  fGridState: TGridState;

  

fGridState - local variable to hold current state of the grid (whether being edited, updated etc)

  function RTLSign;

  class procedure WSRegisterClass; override;

  

Registers this component class with the current WidgetSet.

  procedure AddSelectedRange;

  procedure AdjustClientRect(); override;

  procedure AdjustEditorBounds(); virtual;

  

AdjustEditorBounds - method to adjust the editor's bounds to include a new row and column

  procedure AfterMoveSelection(); virtual;

  procedure AssignTo(); override;

  procedure AutoAdjustColumn(); virtual;

  

AutoAdjustColumn - automatically adjust column properties to accommodate largest object

  procedure BeforeMoveSelection(); virtual;

  

BeforeMoveSelection - method to use before a selection is moved

  procedure BeginAutoDrag; override;

  function BoxRect();

  procedure CacheMouseDown();

  procedure CalcAutoSizeColumn(); virtual;

  

CalcAutoSizeColumn - method for automatically calculating the size of a column

  procedure CalcFocusRect();

  

CalcFocusRect - method for calculating the bounds of a focused rectangle

  procedure CalcMaxTopLeft;

  procedure CalcScrollbarsRange;

  procedure CalculatePreferredSize(); override;

  function CanEditShow; virtual;

  

CanEditShow - returns True if the editing data can be shown

  function CanGridAcceptKey(); virtual;

  

CanGridAcceptKey - returns True is the grid is able to accept the given key

  procedure CellClick(); virtual;

  

CellClick - method for processing a click in a cell

  procedure CheckLimits();

  

CheckLimits - method for checking limits of specified cell

  procedure CheckLimitsWithError();

  

CheckLimitsWithError - method for checking limits of specified cel, with error trapping

  procedure CMBiDiModeChanged(); message;

  procedure CMMouseEnter(); message;

  procedure CMMouseLeave(); message;

  

CMMouseLeave - Control Message for a mouse leaving a cell

  procedure ColRowDeleted(); virtual;

  

ColRowDeleted - method for dealing with deletion of either a column or a row (depending on value of IsCol)

  procedure ColRowExchanged(); virtual;

  

ColRowExchanged - method for exchanging the current Column or Row (depending on value of IsCol) with the indexed other column or row

  procedure ColRowInserted(); virtual;

  

ColRowInserted - method for dealing with insertion of a column or row (depending on value of IsCol)

  procedure ColRowMoved(); virtual;

  

ColRowMoved - the column or row (determined by IsColumn) is moved from one index to another

  function ColRowToOffset();

  

ColRowToOffset - method for moving column or row (depending on value of IsCol); if Relative is True, moves by the amount of Index, otherwise moves from StartPos to EndPos. Returns True if successful

  function ColumnIndexFromGridColumn();

  

ColumnIndexFromGridColumn - extracts the index of the specified grid column

  function ColumnFromGridColumn();

  

ColumnFromGridColumn - returns the actual grid column given its index

  procedure ColumnsChanged();

  

ColumnsChanged - method for dealing with changed columns

  procedure ColWidthsChanged; virtual;

  

ColWidthsChanged - method for dealing with changes in column width

  function CreateColumns; virtual;

  

CreateColumns - returns the identity of the created columns

  procedure CheckNewCachedSizes(); virtual;

  

CheckNewCachedSizes - check the new values of cached sizes

  procedure CreateWnd; override;

  

Creates the interface object (widget) and assigns it to Handle.

  procedure CreateParams(); override;

  

Initializes the window creation parameter record with the settings of the control.

  procedure Click; override;

  

Invokes the OnClick and ActionLink.Execute handlers.

  procedure DblClick; override;

  

Invokes the OnDblClick handler.

  function DefaultColWidthIsStored;

  function DefaultRowHeightIsStored;

  procedure DefineProperties(); override;

  

  procedure DestroyHandle; override;

  

Destroys this and all child widgets.

  function DialogChar(); override;

  function DoCompareCells(); virtual;

  

DoCompareCells - perform the comparison of two or more cells in a grid

  procedure DoCopyToClipboard; virtual;

  

DoCopyToClipboard - copy the selected data to the clipboard, leaving the original data in place

  procedure DoCutToClipboard; virtual;

  

DoCutToClipboard - cut the data from its current site and place it on the clipboard

  procedure DoEditButtonClick(); virtual;

  procedure DoEditorHide; virtual;

  

DoEditorHide - hide the data in the editor

  procedure DoEditorShow; virtual;

  

DoEditorShow - show the data in the editor

  procedure DoExit; override;

  

Invoke the OnExit event handler.

  procedure DoEnter; override;

  

Invokes the OnEnter event handler.

  procedure DoLoadColumn(); virtual;

  procedure DoSaveColumn(); virtual;

  function DoMouseWheel(); override;

  function DoMouseWheelDown(); override;

  

Invokes the OnMouseWheelDown handler.

  function DoMouseWheelUp(); override;

  

Invokes the OnMouseWheelUp handler.

  procedure DoAutoAdjustLayout(); override;

  procedure DoOnChangeBounds; override;

  

Invokes the OnChangeBounds event handler

  procedure DoOPDeleteColRow();

  

DoOPDeleteColRow performs the operation for deleting a column or row (depending on value of IsCol)

  procedure DoOPExchangeColRow();

  

DoOPExchangeColRow - perform the operation for exchanging either the current column or row (depending on value of IsCol) with the column or row specified by WithIndex

  procedure DoOPInsertColRow();

  

DoOPInsertColRow - perform th eoperation for inserting either a column or a row (depending on the value of IsCol) at th indexed position

  procedure DoOPMoveColRow();

  

DoOPMoveColRow - performs the operation for moving either a column or a row (depending on the value of IsCol) between FromIndex and ToIndex

  procedure DoPasteFromClipboard; virtual;

  

DoPasteFromClipboard paste the data from the clipboard to the current location

  procedure DoPrepareCanvas(); virtual;

  

DoPrepareCanvas - get the canvas ready for drawing

  procedure DoSetBounds(); override;

  

Internal function to set the control's bounds (Left, Top, Height, Width).

  function DoUTF8KeyPress(); override;

  procedure DrawBorder;

  

DrawBorder - draws the border of the grid

  procedure DrawAllRows; virtual;

  

DrawAllRows - draws all the rows

  procedure DrawFillRect();

  procedure DrawCell(); virtual;

  

DrawCell - draws a cell at the given grid location (Col, Row) or in the specified Rectangle

  procedure DrawCellGrid(); virtual;

  

DrawCellGrid draws a grid of cells at the specified location

  procedure DrawTextInCell(); virtual;

  procedure DrawThemedCell();

  procedure DrawCellText(); virtual;

  

DrawCellText - draws the given text string in the cell specified by Col, Row or by Rectangle

  procedure DrawGridCheckboxBitmaps(); virtual;

  

DrawGridCheckboxBitmaps - draws checkbox bitmaps in the nominated rectangle with the specified checkbox state

  procedure DrawButtonCell();

  procedure DrawColRowMoving;

  

DrawColRowMoving - draw a column or row while it is moving

  procedure DrawColumnText(); virtual;

  

DrawColumnText - draw the text of the specified column

  procedure DrawColumnTitleImage();

  

DrawColumnTitleImage - draw the title image of the specified column

  procedure DrawEdges;

  

DrawEdges of the current grid

  procedure DrawFocusRect(); virtual;

  

DrawFocusRect - draw a rectangle with focus in the nominated cell

  procedure DrawRow(); virtual;

  

DrawRow - draws the specified row

  procedure EditButtonClicked();

  

EditButtonClicked - calls OnEditButtonClick

  procedure EditordoGetValue; virtual;

  

EditordoGetValue - method for geting a value in the Editor

  procedure EditordoSetValue; virtual;

  

EditordoSetValue - method for specifying a value in the Editor

  function EditorCanAcceptKey(); virtual;

  

EditorCanAcceptKey - returns True if the Editor is able to accept the nominated (UTF8) key

  function EditorIsReadOnly; virtual;

  

EditorIsReadOnly - returns True if the Editor has Read Only status

  procedure EditorHide; virtual;

  

EditorHide - method for hiding the editor

  function EditorLocked;

  

EditorLocked - returns True if the Editor is locked, ie unable to accept input or make changes

  function EditingAllowed(); virtual;

  

EditingAllowed - Returns true if grid and current column allow editing

  procedure EditorSelectAll;

  

EditorSelectAll - editor procedure to Select All

  procedure EditorShow(); virtual;

  

EditorShow - shows the cell contents in the Editor

  procedure EditorShowInCell(); virtual;

  

EditorShowInCell - shows the Editor's content in situ in the Cell

  procedure EditorTextChanged(); virtual;

  procedure EditorWidthChanged(); virtual;

  

EditorWidthChanged - method for dealing with a change in editor width

  function FirstGridColumn; virtual;

  function FixedGrid;

  

FixedGrid - returns True if the Grid is fixed

  procedure FontChanged(); override;

  

FontChanged - method to deal with a change in font

  procedure GetAutoFillColumnInfo(); virtual;

  

GetAutoFillColumnInfo - finds out information (max, min, priority) about the auto-fill properties of the indexed column

  function GetCellHintText(); virtual;

  function GetCells(); virtual;

  function GetColumnAlignment();

  

GetColumnAlignment - returns the Alignment value for the nominated column

  function GetColumnColor();

  

GetColumnColor - returns the Colour for the specified column

  function GetColumnFont();

  

GetColumnFont - returns the font for the specified column

  function GetColumnLayout();

  

GetColumnLayout - returns the Text Layout value for the specified column

  function GetColumnReadonly();

  

GetColumnReadonly - returns True if the column is marked ReadOnly

  function GetColumnTitle();

  

GetColumnTitle - returns the column title string

  function GetColumnWidth();

  

GetColumnWidth - returns the width of the column

  function GetDeltaMoveNext(); virtual;

  

GetDeltaMoveNext return the relative cell coordinate of the next cell to which movement will occur

  function GetDefaultColumnAlignment(); virtual;

  

GetDefaultColumnAlignment - returns the default alignment for the specified column

  function GetDefaultColumnWidth(); virtual;

  

GetDefaultColumnWidth - returns the default width for the specified column

  function GetDefaultColumnLayout(); virtual;

  

GetDefaultColumnLayout - returns the default text layout for the nominated column

  function GetDefaultColumnReadOnly(); virtual;

  

GetDefaultColumnReadOnly - returns the default setting of the ReadOnly flag for the specified column

  function GetDefaultColumnTitle(); virtual;

  

GetDefaultColumnTitle - returns the default title string for the specified column

  function GetDefaultEditor(); virtual;

  

GetDefaultEditor - returns the default editor for the specified column

  function GetDefaultRowHeight; virtual;

  

GetDefaultRowHeight - returns the default row height

  function GetGridDrawState();

  function GetImageForCheckBox(); virtual;

  function GetScrollBarPosition();

  

GetScrollBarPosition - returns the position of the scroll bar specified by Which

  function GetSmoothScroll(); virtual;

  procedure GetSBVisibility(); virtual;

  

GetSBVisibility - finds the values of the visibility flags for the scrollbars

  procedure GetSBRanges(); virtual;

  

GetSBRanges - finds the ranges of values for the scrollbars, if they are visible

  procedure GetSelectedState(); virtual;

  function GetEditMask(); virtual;

  

GetEditMask - returns the edit mask string for the specified cell

  function GetEditText(); virtual;

  

GetEditText - returns the Edit text string for the specified cell

  function GetFixedcolor; virtual;

  

GetFixedcolor - returns a value for the fixed colour

  function GetFirstVisibleColumn;

  function GetFirstVisibleRow;

  function GetLastVisibleColumn;

  function GetLastVisibleRow;

  function GetSelectedColor; virtual;

  

GetSelectedColor - returns the value for the colour of tems that have been selected

  function GetTitleShowPrefix();

  function GetPxTopLeft;

  function GetTruncCellHintText(); virtual;

  function GridColumnFromColumnIndex();

  

GridColumnFromColumnIndex - returns the number of the column given its column index

  procedure GridMouseWheel(); virtual;

  procedure HeaderClick(); virtual;

  

HeaderClick - method to deal with a click on the column (if IsColumn is True) or row Header

  procedure HeaderSized(); virtual;

  

HeaderSized - method to deal with re-sizing of a column (IsColumn True) or row header

  procedure HeaderSizing(); virtual;

  procedure HideCellHintWindow;

  procedure InternalSetColCount();

  

InternalSetColCount - specify the column count

  procedure InvalidateCell();

  

InvalidateCell - render a cell non-valid, and redraw if required

  procedure InvalidateFromCol();

  

InvalidateFromCol - render the grid non-valid from the specified column onwards

  procedure InvalidateGrid;

  

InvalidateGrid - render the whole grid non-valid

  procedure InvalidateFocused;

  

InvalidateFocused - render the focused item non-valid

  function GetIsCellTitle(); virtual;

  function GetIsCellSelected(); virtual;

  

GetIsCellSelected - returns True if the given cell is selected

  function IsEmptyRow();

  function IsMouseOverCellButton();

  procedure KeyDown(); override;

  

Invokes the OnKeyDown handler.

  procedure KeyUp(); override;

  

Invokes the OnKeyUp handler.

  procedure KeyPress(); override;

  procedure LoadContent(); virtual;

  

LoadContent - method to load a configuration

  procedure LoadGridOptions(); virtual;

  procedure Loaded; override;

  

  procedure LockEditor;

  

LockEditor - lock the editor so that it will not accept input or changes

  function MouseButtonAllowed(); virtual;

  procedure MouseDown(); override;

  

Handler for MouseDown events.

  procedure MouseMove(); override;

  

Handler for MouseMove events.

  procedure MouseUp(); override;

  

Invokes the OnMouseUp handler.

  function MoveExtend();

  

MoveExtend - move an extended selection; if Relative is true, use Delta column and row to find position; returns True if successful

  function MoveNextAuto();

  

MoveNextAuto - move to next cell in automatic sequence; if Relative is True, use delta col and row to find position; returns True if successful

  function MoveNextSelectable();

  

MoveNextSelectable - move to next selectable cel; use delta col and row if Relative is True; returns True if successful

  procedure MoveSelection; virtual;

  

MoveSelection - moves the selected text, cell or group of cells

  function OffsetToColRow();

  

OffsetToColRow - move by the value of Offset to another column or row (determined by the value of IsCol), returning True if successful

  procedure Paint; override;

  

Override this method in your derived class with your own paint handler.

  procedure PickListItemSelected();

  

PickListItemSelected - indicates that an item was selected from the pick-list

  procedure PrepareCanvas(); virtual;

  

PrepareCanvas - method to get the canvas ready for drawing at the specified location

  procedure PrepareCellHints(); virtual;

  procedure ResetDefaultColWidths; virtual;

  procedure ResetEditor;

  

ResetEditor - resets the current editor for the grid

  procedure ResetLastMove;

  function ResetOffset();

  

ResetOffset - resets the offset, checking columns and rows if demanded

  procedure ResetSizes; virtual;

  

ResetSizes - resets the sizes

  procedure ResizeColumn();

  

ResizeColumn - resizes the nominated column to the specified width

  procedure ResizeRow();

  

ResizeRow - resizes the nominated row to the specified height

  procedure RowHeightsChanged; virtual;

  

RowHeightsChanged - method invoked when row heights are changes

  procedure SaveContent(); virtual;

  

SaveContent as specified in the XML configuration variable

  procedure SaveGridOptions(); virtual;

  procedure ScrollBarRange();

  

ScrollBarRange - specify the range of the scrollbar; Which determines whether it is horizontal or vertical

  procedure ScrollBarPosition();

  

ScrollBarPosition - records the position ( Value) of the scrollbar; Which determines horizontal or vertical

  function ScrollBarIsVisible();

  

ScrollBarIsVisible - Returns True if visible; Which determines whether horizontal or vertical

  procedure ScrollBarPage();

  

ScrollBarPage - a Page movement of the scrollbar (specified by Which)

  procedure ScrollBarShow();

  

ScrollBarShow method

  function ScrollBarAutomatic(); virtual;

  

ScrollBarAutomatic method

  procedure ScrollBy(); override;

  procedure SelectEditor; virtual;

  

SelectEditor - chooses the editor for current use

  function SelectCell(); virtual;

  

Is called if a grid cell is highlighted.

  procedure SetCanvasFont();

  

SetCanvasFont to specified value

  procedure SetColor(); override;

  

SetColor to specified value

  procedure SetColRow();

  

SetColRow - specifies the column and row for addressing

  procedure SetEditText(); virtual;

  

SetEditText - specifies the text-string to be placed in the Editor for processing

  procedure SetBorderStyle(); override;

  

SetBorderStyle - specifies a new border style

  procedure SetFixedcolor(); virtual;

  

SetFixedcolor - specifies colour for fixed cells

  procedure SetFixedCols(); virtual;

  

Write specifier for FixedCols

  procedure SetFixedRows(); virtual;

  

Write specifier for FixedRows

  procedure SetRawColWidths();

  

Write specifier for RawColWidths

  procedure SetSelectedColor(); virtual;

  

SetSelectedColor - specifies colour for cells that have been selected

  procedure ShowCellHintWindow();

  procedure SizeChanged(); virtual;

  

SizeChanged - specifies the old number of columns and rows

  procedure Sort(); virtual;

  

Sort method

  procedure StartPushCell;

  procedure TopLeftChanged; virtual;

  

TopLeftChanged - the top left cell has changed

  function TryMoveSelection();

  

TryMoveSelection - attempts to move the selection by the specified offset; returns True if sucessful

  procedure UnLockEditor;

  

UnLockEditor - frees a previously locked Editor

  procedure UnprepareCellHints; virtual;

  procedure UpdateHorzScrollBar(); virtual;

  

UpdateHorzScrollBar - updates the scrollbar in the given range by the given page, if it is visible

  procedure UpdateSelectionRange;

  

UpdateSelectionRange - updates the range of the current selection

  procedure UpdateVertScrollbar(); virtual;

  

UpdateVertScrollbar - updates the scrollbar in the given range by the given page, if it is visible

  procedure UpdateBorderStyle;

  

UpdateBorderStyle - brings the border style up to date

  function ValidateEntry(); virtual;

  procedure VisualChange; virtual;

  

VisualChange - a change in the visual properties

  procedure WMSize(); message;

  procedure WMHScroll(); message;

  

WMHScroll - system message for horizontal scrolling

  procedure WMVScroll(); message;

  

WMVScroll - system message for vertical scrolling

  procedure WMKillFocus(); message;

  

Handler for loosing Focus event. Eventually triggers #lcl.Controls.TControl.EditingDone.

  procedure WMSetFocus(); message;

  

Handler for receiving Focus event.

  procedure WndProc(); override;

  

The general message handler for this control.

  property AllowOutboundEvents: Boolean; [rw]

  

AllowOutboundEvents - permits mouse click on an imaginary (out-of-bounds) cell; moves cursor to nearest valid cell

  property AlternateColor: TColor; [rws]

  

The colour to be used for the background on alternate rows of the grid. Having alternate rows in different colours can make the grid easier to read.

  property AutoAdvance: TAutoAdvance; [rw]

  

Automatically advance down the grid on successive mouse clicks or presses of the ENTER or TAB key

  property AutoEdit: Boolean; [rw]

  

Whether the Edit mode is automatically entered when a cell is selected

  property AutoFillColumns: Boolean; [rw]

  

Automatically resize columns so they fill all grid's visible area

  property BorderStyle: TBorderStyle; [rw]

  

Allows to show a border (line) around the control,

  property BorderColor: TColor; [rw]

  

The colour of the border for this control

  property CellHintPriority: TCellHintPriority; [rw]

  property Col: Integer; [rw]

  

Current column index.

  property ColCount: Integer; [rw]

  

Number of columns of the grid.

  property ColRow: TPoint; [rw]

  property ColumnClickSorts: Boolean; [rw]

  property Columns: TGridColumns; [rws]

  

The properties of the columns in this grid

  property ColWidths []: Integer; [rw]

  

Column widths for the grid.

  property DefaultColWidth: Integer; [rws]

  

Default value for the width of newly created grid columns.

  property DefaultRowHeight: Integer; [rws]

  

Default value for the height of newly created grid rows.

  property DefaultDrawing: Boolean; [rw]

  

Is the default drawing method to be used for this grid? Default is TRUE

  property DefaultTextStyle: TTextStyle; [rw]

  

Default style for displaying text - includes alignment, layout, single or multi-lines

  property DragDx: Integer; [rw]

  

DragDx - the amount (DeltaX) by which an object should be dragged

  property Editor: TWinControl; [rw]

  

The editor to be used for modifying information in the cells of the grid

  property EditorBorderStyle: TBorderStyle; [rw]

  

The border style for the editor used in this grid

  property EditorMode: Boolean; [rw]

  

Is grid ready to accept edits? (EditorMode True)

  property EditorKey: Boolean; [rw]

  

EditorKey - is the current key available to the editor?

  property EditorOptions: Integer; [rw]

  

The set of options available for the grid's editor

  property EditorShowing: Boolean; [rw]

  

Is the editor for the grid displayed?

  property ExtendedColSizing: Boolean; [rw]

  

ExtendedColSizing - the sizing to be used for extended columns

  property ExtendedRowSizing: Boolean; [rw]

  

ExtendedRowSizing - the sizing to be used for extended rows

  property ExtendedSelect: Boolean; [rw]

  

ExtendedSelect - the ability to select cells beyond the boundary of the visible part of the grid

  property FastEditing: Boolean; [rw]

  

Is the FastEditing method being used?

  property AltColorStartNormal: Boolean; [rw]

  

AltColorStartNormal - using a second colour to display alternate rows, but starting the first row with the normal colour

  property FixedCols: Integer; [rw]

  

Number of the fixed columns of the grid (ie the columns containing title or identifier material, that don't get scrolled when the rest of the grid moves).

  property FixedRows: Integer; [rw]

  

Number of the fixed rows of the grid (ie the rows containing title or identifier material, that don't get scrolled when the rest of the grid moves).

  property FixedColor: TColor; [rw]

  

The color for the fixed cells of the grid.

  property FixedGridLineColor: TColor; [rw]

  property FixedHotColor: TColor; [rw]

  

FixedHotColor - the 'Hot' colour for the active (selected, etc) fixed cells of the grid

  property Flat: Boolean; [rw]

  

Is the cell to be displayed Flat, ie with no texturing or raised/lowered effect

  property FocusColor: TColor; [rw]

  

The colour to be used for the cell receiving focus

  property FocusRectVisible: Boolean; [rw]

  

FocusRectVisible - is the rectangle receiving focus visible?

  property GCache: TGridDataCache; [r]

  

GCache - the cache to be used for grid data

  property GridFlags: TGridFlags; [rw]

  

GridFlags - the flags that are set for the grid

  property GridHeight: Integer; [r]

  

GridHeight - the height of the grid

  property GridLineColor: TColor; [rw]

  

Colour to be used for GridLines

  property GridLineStyle: TPenStyle; [rw]

  

Style to be used for GridLines

  property GridLineWidth: Integer; [rw]

  

Width (thickness) of GridLines

  property GridWidth: Integer; [r]

  

Width of the whole Grid

  property HeaderHotZones: TGridZoneSet; [rw]

  

HeaderHotZones - the zones of the header that are under the cursor, so are capable of being selected or pushed (or not!)

  property HeaderPushZones: TGridZoneSet; [rw]

  

HeaderPushZones - the zones of the header that have been selected by the cursor, or pushed

  property TabAdvance: TAutoAdvance; [rw]

  property TitleImageList: TImageList; [rw]

  

TitleImageList - the list of images to be used with the titles

  property InplaceEditor: TWinControl; [r]

  

InplaceEditor - the editor to be used in-place, ie in the cell itself instead of outside the grid

  property IsCellSelected []: Boolean; [r]

  

IsCellSelected - is the cell specified by aCol, aRow selected?

  property LeftCol: Integer; [rw]

  

LeftCol - the left-most column

  property MouseWheelOption: TMouseWheelOption; [rw]

  property Options: TGridOptions; [rw]

  

The options available for use in this grid

  property Options2: TGridOptions2; [rw]

  property RangeSelectMode: TRangeSelectMode; [rw]

  property Row: Integer; [rw]

  

The current Row (record) within the grid

  property RowCount: Integer; [rw]

  

Number of rows in the grid

  property RowHeights []: Integer; [rw]

  

The row heights for the grid.

  property SaveOptions: TSaveOptions; [rw]

  

The set of options for saving information from the grid (design, attributes, content or position)

  property SelectActive: Boolean; [rw]

  

SelectActive - if True, the current active cell is selected

  property SelectedColor: TColor; [rw]

  

Colour to be used for selected cells

  property SelectedColumn: TGridColumn; [r]

  

The column (field) currently selected

  property Selection: TGridRect; [rw]

  

The current selection (rows and columns) in the grid

  property ScrollBars: TScrollStyle; [rw]

  

The ScrollBars to be used with this grid

  property StrictSort: Boolean; [rw]

  

StrictSort - is strict sorting to be used?

  property TitleFont: TFont; [rw]

  

The font to be used in the grid's title

  property TitleStyle: TTitleStyle; [rw]

  

The style to be used for the grid's title

  property TopRow: Integer; [rw]

  

The first row (record) in the grid

  property UseXORFeatures: Boolean; [rw]

  

UseXORFeatures: When True, the dotted focus rectangle is painted using the XOR raster operation

  property VisibleColCount: Integer; [rs]

  

The number of visible columns

  property VisibleRowCount: Integer; [rs]

  

The number of visible rows

  property OnAfterSelection: TOnSelectEvent; [rw]

  property OnBeforeSelection: TOnSelectEvent; [rw]

  

OnBeforeSelection - event handler for use before a selection is made

  property OnCheckboxToggled: TToggledCheckboxEvent; [rw]

  property OnCompareCells: TOnCompareCells; [rw]

  

Event handler for comparing the contents of grid cells

  property OnPrepareCanvas: TOnPrepareCanvasEvent; [rw]

  

Event handler to prepare the Canvas for drawing

  property OnDrawCell: TOnDrawCell; [rw]

  

Event handler for drawing a cell

  property OnEditButtonClick: TNotifyEvent; [rw] deprecated ;

  

Event handler for when the Edit button is clicked

  property OnButtonClick: TOnSelectEvent; [rw]

  property OnPickListSelect: TNotifyEvent; [rw]

  

Event handler for selecting an item from a picklist (eg drop-down list in TComboBox)

  property OnSelection: TOnSelectEvent; [rw]

  

Event handler for when an area of a grid (one or a group of cells) is selected

  property OnSelectEditor: TSelectEditorEvent; [rw]

  

Event handler for selecting an editor

  property OnTopLeftChanged: TNotifyEvent; [rw]

  

Event handler when the top left cell is changed (ie the grid has been scrolled so that a different cell occupies top left)

  property OnUserCheckboxBitmap: TUserCheckBoxBitmapEvent; [rw]

  

OnUserCheckboxBitmap - event handler for a user accessing a checkbox bitmap

  property OnValidateEntry: TValidateEntryEvent; [rw]

  function FlipRect();

  function FlipPoint();

  function FlipX();

  property OnGetCellHint: TGetCellHintEvent; [rw]

  

Get individual hint for each cell

  property OnSaveColumn: TSaveColumnEvent; [rw]

  property OnLoadColumn: TSaveColumnEvent; [rw]

public

  constructor Create(); override;

  

Create - constructor for TCustomGrid: calls inherited Create, then creates lists of columns and rows, initialises many visual properties and options, creates the various editors and loads any bitmaps required for the display

  destructor Destroy; override;

  

Destroy - destructor for TCustomGrid: frees various resources including editors, columns, rows, font then calls inherited Destroy

  procedure Invalidate; override;

  

Force a delayed Repaint of the control, by marking its visible area of the control as invalid.

  procedure EditingDone; override;

  

Invokes the OnEditingDone event handler.

  procedure AdjustInnerCellRect();

  procedure AutoAdjustColumns; virtual;

  

AutoAdjustColumns - automatically adjust the columns according to the size of their contents

  procedure BeginUpdate;

  

Begin updating the grid

  function CellRect();

  

The coordinates of the current cell (column, row) expressed as a standard rectangle (TRect)

  function CellRectValid();

  function CellToGridZone();

  

Convert the coordinates of the current cell (col, row) to a grid zone

  procedure CheckPosition;

  

Check the position of the cursor

  procedure Clear;

  

Clear all cells from the grid.

  procedure ClearSelections;

  function EditorByStyle(); virtual;

  

Select a cell editor control with the specified style

  procedure EditorKeyDown();

  

Emulate the OnKeyDown event handler in the cell editor

  procedure EditorKeyPress();

  

Emulate the OnKeyPress event handler in the cell editor

  procedure EditorKeyUp();

  

Emulate the OnKeyUp event handler in the cell editor

  procedure EndUpdate();

  

EndUpdate - Finish updating the grid

  procedure EraseBackground(); override;

  

Clear the background to the grid

  function Focused; override;

  function HasMultiSelection;

  procedure InvalidateCol();

  

InvalidateCol - render the specified column non-valid

  procedure InvalidateRange();

  

InvalidateRange - render a range of the grid non-valid

  procedure InvalidateRow();

  

InvalidateRow - render the specified row non-valid

  function IsCellVisible();

  

Finds out whether a particular cell is visible

  function IsFixedCellVisible();

  procedure LoadFromFile(); virtual;

  

Load the grid data from a file with the specified name

  procedure LoadFromStream(); virtual;

  function MouseCoord();

  

Find the mouse coordinates relative to the grid origin

  function MouseToCell();

  

Convert mouse coordinates to the position of a cell in the grid

  function MouseToLogcell();

  

Convert mouse coordinates to the position of a logical cell in the grid

  function MouseToGridZone();

  

MouseToGridZone - convert mouse coordinates to a grid zone

  procedure SaveToFile(); virtual;

  

Save the data in the grid to a file with specified name

  procedure SaveToStream(); virtual;

  procedure SetFocus; override;

  

Set focus on the grid

  property SelectedRange []: TGridRect; [r]

  property SelectedRangeCount: Integer; [r]

  property SortOrder: TSortOrder; [rw]

  

Order of sorting - ascending or descending

  property SortColumn: Integer; [r]

  property TabStop: Boolean;

  

Allows the user to navigate to this control, by pressing the Tab key.

Inheritance

TCustomGrid

  

TCustomGrid - the base class for all grid controls

|

TCustomControl

  

The base class for windowed controls which paint themselves.

|

TWinControl

  

The base class for controls which can contain other (child) controls.

|

TControl

  

The base class for visible controls.

|

TLCLComponent

  

The base class for LCL components associated with widgets.

|

TComponent

?

TObject

Description

A grid is a collection of cells that are organized in columns and rows. Grids are suitable for showing data that have tabular nature, 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 property 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 property 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.

See also

TStringGrid

  

TStringGrid - a specialised grid for displaying strings (text material) in a matrix of columns and rows

TDrawGrid

  

TDrawGrid - a drawn grid. May contain images in its cells

HowToUseGrids

  

How to use Grids including StringGrids, DrawGrids and DbGrids

The latest version of this document can be found at lazarus-ccr.sourceforge.net.