[Overview][Constants][Types][Classes][Procedures and functions][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 614

type TCustomGrid = class(TCustomControl)

protected

  fGridState: TGridState;

  

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

protected

  class procedure WSRegisterClass; override;

  

WSRegisterClass - Register this Class for the current Widget Set

protected

  procedure AdjustEditorBounds(); virtual;

  

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

  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

  function BoxRect();

  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

  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 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;

  

CreateWnd - Creates the Window

  procedure CreateParams(); override;

  

CreateParams - create parameters for this windowed class

  procedure Click; override;

  

Click - a procedure that allows the programmer to simulate a mouse click over the control, and initiates the same Action as that associated with the OnClick event

  procedure DblClick; override;

  

DblClick - a procedure that allows the programmer to simulate a mouse double-click over the control, and initiates the same Action as that associated with the OnDblClick event

  procedure DefineProperties(); override;

  

  procedure DestroyHandle; override;

  

DestroyHandle - removes the handle for this window

  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;

  

Invoke the OnEnter event handler.

  function DoMouseWheelDown(); override;

  

DoMouseWheelDown - performs the action for a downward movement of the mouse wheel; returns True if handled

  function DoMouseWheelUp(); override;

  

DoMouseWheelUp - performs the action for an upward movement of the mouse wheel; returns True if handled

  procedure DoOnChangeBounds; override;

  

Calls 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;

  

Perform the actual setting of the boundary rectangle.

  function DoUTF8KeyPress(); override;

  

DoUTF8KeyPress - issues a LCL message and returns True if there has been a UTF8 key press

  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 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();

  

GetDefaultEditor - returns the default editor for the specified column

  function GetDefaultRowHeight; virtual;

  

GetDefaultRowHeight - returns the default row height

  function GetImageForCheckBox(); virtual;

  function GetScrollBarPosition();

  

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

  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 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 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

  procedure KeyDown(); override;

  

KeyDown - emulate the action of pressing the specified key (makes OnKeyDown respond)

  procedure KeyUp(); override;

  

KeyUp - emulates the action of a key being released (makes OnKeyUp respond)

  procedure LoadContent(); virtual;

  

LoadContent - method to load a configuration

  procedure Loaded; override;

  

  procedure LockEditor;

  

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

  procedure MouseDown(); override;

  

MouseDown - a procedure that allows the programmer to simulate a mouse button being down over the control, and initiates the same Action as that associated with the OnMouseDown event

  procedure MouseMove(); override;

  

MouseMove - a procedure that allows the programmer to simulate a mouse being moved over the control, and initiates the same Action as that associated with the OnMouseMove event

  procedure MouseUp(); override;

  

MouseUp - a procedure that allows the programmer to simulate a mouse button being Up over the control, and initiates the same Action as that associated with the OnMouseUp event

  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;

  

The default paint handler for the class

  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 ResetEditor;

  

ResetEditor - resets the current editor for the grid

  procedure 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 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 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 SetSelectedColor(); virtual;

  

SetSelectedColor - specifies colour for cells that have been selected

  procedure SizeChanged(); virtual;

  

SizeChanged - specifies the old number of columns and rows

  procedure Sort(); virtual;

  

Sort method

  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 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 WMHScroll(); message;

  

WMHScroll - system message for horizontal scrolling

  procedure WMVScroll(); message;

  

WMVScroll - system message for vertical scrolling

  procedure WMKillFocus(); message;

  

WMKillFocus - LCL Message to kill focus

  procedure WMSetFocus(); message;

  

WMSetFocus - LCL Message to set focus

  procedure WndProc(); override;

  

WndProc - message handler for the procedure of this window

  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]

  

BorderStyle - none, or single

  property BorderColor: TColor; [rw]

  

The colour of the border for this control

  property Col: Integer; [rw]

  

Current column index.

  property ColCount: Integer; [rw]

  

Number of columns of the grid.

  property Columns: TGridColumns; [rws]

  

The properties of the columns in this grid

  property ColWidths: Integer; [rw]

  

Column widths for the grid.

  property DefaultColWidth: Integer; [rw]

  

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 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 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 Options: TGridOptions; [rw]

  

The options available for use in this grid

  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 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]

  

Event handler for when the Edit button is clicked

  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();

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;

  

Render this control non-valid

  procedure EditingDone; override;

  

EditingDone - what to do when you have finished editing; calls the OnEditingDone event handler if assigned

  procedure AutoAdjustColumns;

  

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

  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

  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

  procedure LoadFromFile();

  

Load the grid data from a file with the specified name

  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 muse coordinates to a gid zone

  procedure SaveToFile();

  

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

  procedure SetFocus; override;

  

Set focus on the grid

  property SortOrder: TSortOrder; [rw]

  

Order of sorting - ascending or descending

  property TabStop;

  

Is the control in the sequence of controls accessed by successive presses of the Tab key?

end;

Inheritance

TCustomGrid

  

TCustomGrid - the base class for all grid controls

|

TCustomControl

  

TCustomControl - a base class for many window controls

|

TWinControl

|

TControl

|

TLCLComponent

  

TLCLComponent - base class for LCL components

|

TComponent,IUnknown,IInterfaceComponentReference

|

TPersistent

|

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.