From 4880ec8934a11f5e755538424d268a82a73ec8ad Mon Sep 17 00:00:00 2001 From: juha Date: Tue, 12 Nov 2019 22:55:27 +0000 Subject: [PATCH] Docs: Updated documentation for LCL Grids. Issue #36289, patch from Don Siders. git-svn-id: trunk@62234 - --- docs/xml/lcl/grids.xml | 26117 ++++++++++++++++++++------------------- 1 file changed, 13602 insertions(+), 12515 deletions(-) diff --git a/docs/xml/lcl/grids.xml b/docs/xml/lcl/grids.xml index 9fc327f492..fcfbffdbe2 100644 --- a/docs/xml/lcl/grids.xml +++ b/docs/xml/lcl/grids.xml @@ -2,251 +2,227 @@ + ==================================================================== + Grids + ==================================================================== + --> - Classes for displaying tabular data in the form of a grid of rows and columns + + Classes for displaying tabular data as a series of rows and columns - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + Current revision level for the grids.pas file + +
+
1
+
Initial revision
+
2
+
Introduced goSmoothScroll grid option
+
3
+
Introduced Col/Row FixedAttr and NormalAttr
+
+
+
+ - - - + Lazarus message for setting the value in a grid edit control + - - - + Lazarus message for getting the value in a grid edit control + - - - + Lazarus message for setting the grid for an edit control - - - - - + + + Lazarus message for setting the bounds for a grid edit control + - - - + Lazarus message for selecting the content in a grid edit control + - - - + Lazarus message for setting the edit mask used in a grid edit control + - - - - + + Lazarus message for setting the position of a grid edit control - - - - - + + + Lazarus message sent when the grid can display its editing controls - - - - - - - - - - - - - - - - - - - - - - - + + + Lazarus message used to get the grid for an editing control + - - - + Represents the auto-size editor option in a grid message + + + - - - + Represnts the hook key down editor option in a grid message + + + - - - + Represents the hook key press editor option in a grid message + + + - - - - - - - - - + Represents the hook key up editor option in a grid message + + + - - - + Represents the select all content editor option in a grid message + + + - - - - + + Represents the implemented editor option in a grid message + + + + + Default width for columns in a grid control + +

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

+
+ + + +
+ + + Default width for edit control buttons in a grid + +

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

+
+ + + +
+ + + Default padding used for title images displayed in a grid + +

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

+
+ + + + +
+ - EGridException - exception handler for an error in a Grid class - - - + Exception raised for an error occurring in a Grid class +
+ +

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

+
+ +
+ - - - + Represents grip option values available for grid controls + +

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

+

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

+
+ + + + + + +
+ - + Shows vertical lines around fixed cells - + Shows horizontal lines around fixed cells @@ -258,11 +234,11 @@ - + Enables range selection for grid cells - + Enables focused drawing for selected cell(s) @@ -274,40 +250,66 @@ - + Enables moving the position of an entire row in a grid - + Enables moving the position of an entire column in a grid - Allow editing - + Allows editing in grid cells + + + + + Automatically add new rows + + Does not add rows if the last cell is empty and + goAutoAddRowsSkipContentCheck is not set. + + + + + + - Move with tab key inside grid - If set, the tab key changes the active cell within the grid. -If not set, the tab key changes the active control. + Controls Tab key behavior in the grid + +

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

+
+ + +
+ Select the whole row instead of only one cell + - Always show editor - Always show editor. If not set, the user has to enter the edit mode by pressing some character key or F2 key. + Always shows the cell editor + +

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

+
+ - + Enables tracking of the thumb position in grid scroll bars - Enable cellextent calcs + Enable cellextent calculations @@ -320,12470 +322,1144 @@ If not set, the tab key changes the active control.
Switch scrolling mode - Default is pixel scroll. + Default is pixel scroll. + + + + Show row numbers in first fixed column + +

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

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

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

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

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

+

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

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

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

+

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

+

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

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

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

+
+
- + - + - + - + - - - - - + + - - - - - - - - - - - + + + Set type used to store TGridZone enumeration values + + + - - - + Enumerated type with values controlling grid auto advance behavior + +

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

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

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

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

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

+
+ + + + +
+ + + Titles are displayed using the Lazarus drawing style + + + + Titles are displayed using the standard drawing style (higher contrast) + + + + Titles are displayed using the drawing style Native to the OS or platform + + + + + + +

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

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

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

+
+ + + + +
+ + + + Enumerated type with sort orders supported in a grid control + +

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

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

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

+
+ + +
+ + + Uses all hints (both control and cell hints) including short and long display text values + + + + Uses all hints except the default hint for the grid control + + + Uses the truncated cell hint text + + + + Identifies the action performed for cell content + + TCellProcessType is an enumerated type with values that identify the action performed for the content in a grid cell. Values in the enumeration indicate whether cell content is copied or pasted in event handlers. TCellProcessType arguments are passed to the TCustomStringGrid.OnCellProcess event handler. + + + + + + + + Copies the content in a grid cell + + + Pastes content into the grid cell + + - - - + All save options available in LCL grid controls + +

+ soAll is a TSaveOptions set type representing all of the TGridSaveOptions values available in a LCL grid control. +

+
+ + +
+ + + Set with the default grid options enabled for LCL grid controls + + + + + + + + + + - - - + Default spacing around rubberband rectangles + + + + + Default padding for the content in grid cells + + + + + + Minimum proximity to row or column borders for resizing operations + + + + - - - + Pointer to a TCellProps type + + - - - + Contains attributes, data, and text for grid cells + + - - - + Attributes for a grid cell + + - - - + Data for a grid cell + + - - - + Display text for a grid cell + + - - - + Pointer to a TColRowProps type + + + - - - + Contains the size and attributes for a column or a row in a grid + + + - - - + + + + - - - + + + + - - - + + + + - - - + Pointer to a TGridMessage type + + + - - - + Contains a LCL message and its auxiliary values + + - - - - + + The LCL message value + + - - - + Grid for the LCL message + + - - - + Grid column for the LCL message + + - - - + Grid row for the LCL message + + - - - + Cell value for the LCL message + + - - - + Rectangle coordinates for the LCL message + + - - - + Options for the LCL message + + + - TStringCellEditor - the default editor for - TStringGrid + Implements the default editor for cells in TCustomGrid - - - + +

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

+
+ + + +
- - - - - + + + + + + + Window handling procedure for the cell editor + + - - - - - - + + LCL message for the window handling procedure - - - - - - - - + + + - + - - + + msg_SetMask - issues message for specifying mask - - - + + - + Message for the control + msg_SetValue - issue message for specifying value - - - + + - + Message for the control + msg_GetValue - issues message for obtaining value - - - + + - + Message for the control msg_SetGrid - issues message for specifying grid - - - + + - + Message for the control + msg_SelectAll - issues message for Selecting All - - - + + - + Message for the control - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TVirtualGrid - an array of rows and columns containing data, which never gets displayed - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - doDestroyItem - method for destroying an Item at the given Row and Column location - - - - - - - - - - - - - - - - - - - - - - - - doNewItem - method for producing a new item at the given location specified by Row, Col - - - - - - - - - - - - - - - - - - - - - - - - DeleteColRow - remove either a column or a row, depending on the value of - IsColumn - - - - - - - - - - - - - - - - - MoveColRow - move either a column or a row (depending on value of - IsColumn) at - FromIndex to the location - ToIndex - - - - - - - - - - - - - - - - - - - - - ExchangeColRow - exchange either the current column or row (depending on the value of - IsColumn) with the entity specified by - WithIndex - - - - - - - - - - - - - - - - - - - - - DisposeCell - dispose of the resources and pointer for the given cell - - - - - - - - - - - - DisposeColRow - dispose of the specified row or column, freeing its pointer - - - - - - - - - - - - Create - constructor for TVirtualGrid: calls inherited Create then creates arrays of Cells, Columns and Rows; forms links for actions and event handlers - - - - TObject.Create - - - - - - Destroy - destructor for TVirtualGrid: frees rows, columns and cells, then calls inherited Destroy - - - - - TObject.Destroy - - - - - - Clear the grid - - - - - - - - GetDefaultCell - returns the properties of the default cell - - - - - - - - - - - - GetDefaultColRow - returns the properties of the default column and row - - - - - - - - - - - - ColCount - the number of columns in the current grid - - - - - - - RowCount - the number of rows in the current grid - - - - - - - Celda - the current cell as defined by its column and row - - - - - - - - - - - - - - - Cols - the columns to which the grid applies - - - - - - - - - - The Rows to which the grid applies - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TCustomGrid - the base class for all grid controls - -

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.

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - EditorHide - method for hiding the editor - - - - - - - - - - - - - - - EditorSelectAll - editor procedure to Select All - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - EditorShow - shows the cell contents in the Editor - - - - - - - - - - - Read specifier for LeftCol - - - - - - - - - - - - - - - - - - - - - - Read specifier for ColWidths - - - - - - - - - - - - - - - - - - - - - - - - - - Read specifier for RowHeights - Returns the current row height - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Read specifier for TopRow - - - - - - - - - - - Read specifier for VisibleRowCount - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Write specifier for Col - - - - - - - - - - - - - - - - - - - - - - - - - - Write specifier for RawColWidths - - - - - - - - - - - - - - - Write specifier for ColCount - - - - - - - - - - - Write specifier for DefColWidth - - - - - - - - - - - Write specifier for DefRowHeight - - - - - - - - - - - - - - - - - - - - - - Write specifier for Editor - - - - - - - - - - - Write specifier for FixedCols - - - - - - - - - - - Write specifier for FixedRows - - - - - - - - - - - - - - - - - - - - - - Write specifier for GridLineColor - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Write specifier for LeftCol - - - - - - - - - - - Write specifier for Options - - - - - - - - - - - Write specifier for Row - - - - - - - - - - - Write specifier for RowCount - - - - - - - - - - - - - - - - - - - - - - - - - - Write specifier for ScrollBars - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Write specifier for TopRow - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - UpdateSelectionRange - updates the range of the current selection - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - fGridState - local variable to hold current state of the grid (whether being edited, updated etc) - - - - - - - AutoAdjustColumn - automatically adjust column properties to accommodate largest object - - - - - - - - - - - - BeforeMoveSelection - method to use before a selection is moved - This method is called from TCustomGrid.MoveExtend method whenever the current grid cursor location is about to change. The destination column and row are specified in DCol and DRow parameters respectively. -The new location is known to be a valid selectable cell (see - ), and is given in absolute cell coordinates. At this point the current grid location has not changed and can be retrieved with Col and Row properties. - -The purpose of this method is to call event handler OnBeforeSelection. - - - - - - - - - - - - - - - - - - CalcAutoSizeColumn - method for automatically calculating the size of a column - - - - - - - - - - - - - - - - - - - - - - - - CalcFocusRect - method for calculating the bounds of a focused rectangle - - - - - - - - - - - - CellClick - method for processing a click in a cell - - - - - - - - - - - - - - - - CheckLimits - method for checking limits of specified cell - - - - - - - - - - - - - - - - ColRowDeleted - method for dealing with deletion of either a column or a row (depending on value of - IsCol) - - - - - - - - - - - - - - - - ColRowExchanged - method for exchanging the current Column or Row (depending on value of - IsCol) with the indexed other column or row - - - - - - - - - - - - - - - - - - - - ColRowMoved - the column or row (determined by - IsColumn) is moved from one index to another - - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ColWidthsChanged - method for dealing with changes in column width - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - DrawBorder - draws the border of the grid - - - - - - - - - - - - - - - DrawCell - draws a cell at the given grid location (Col, Row) or in the specified Rectangle - - - - - - - - - - - - - - - - - - - - - - - - DrawCellGrid draws a grid of cells at the specified location - - - - - - - - - - - - - - - - - - - - - - - - DrawColRowMoving - draw a column or row while it is moving - - - - - - - - DrawEdges of the current grid - - - - - - - - DrawFocusRect - draw a rectangle with focus in the nominated cell - - - - - - - - - - - - - - - - - - - - DrawRow - draws the specified row - - - - - - - - - - - - EditordoGetValue - method for getting a value in the Editor - - - - - - - - EditordoSetValue - method for specifying a value in the Editor - - - - - - - - EditorCanAcceptKey - returns True if the Editor is able to accept the nominated (UTF8) key - - - - - - - - - - - - - - - - EditorIsReadOnly - returns True if the Editor has Read Only status - - - - - - - - - - - - GetAutoFillColumnInfo - finds out information (max, min, priority) about the auto-fill properties of the indexed column - - - - - - - - - - - - - - - - - - - - - - - - GetFixedcolor - returns a value for the fixed color - - - - - - - - - - - - GetSelectedColor - returns the value for the color of items that have been selected - - - - - - - - - - - - GetEditMask - returns the edit mask string for the specified cell - - - - - - - - - - - - - - - - - - - - GetEditText - returns the Edit text string for the specified cell - - - - - - - - - - - - - - - - - - - - SetEditText - specifies the text-string to be placed in the Editor for processing - - - - - - - - - - - - - - - - - - - - HeaderClick - method to deal with a click on the column (if - IsColumn is True) or row Header - - - - - - - - - - - - - - - - HeaderSized - method to deal with re-sizing of a column (IsColumn True) or row header - - - - - - - - - - - - - - - - InvalidateCell - render a cell non-valid, and redraw if required - - - - - - - - - - - - - - - - InvalidateCell - render a cell non-valid, and redraw if required - - - - - - - - - - - - - - - - - - - - InvalidateCol - render the specified column non-valid - - - - - - - - - - - - InvalidateGrid - render the whole grid non-valid - - - - - - - - InvalidateRow - render the specified row non-valid - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - LoadContent - method to load a configuration - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - MoveExtend - move an extended selection; if - Relative is true, use Delta column and row to find position; returns True if successful - - - - - - - - - - - - - - - - - - - - - - - - MoveNextAuto - move to next cell in automatic sequence; if - Relative is True, use delta col and row to find position; returns True if successful - - - - - - - - - - - - MoveNextSelectable - move to next selectable cell; use delta col and row if - Relative is True; returns True if successful - - - - - - - - - - - - - - - - - - - - - - - - MoveSelection - moves the selected text, cell or group of cells - - - - - - - - OffsetToColRow - move by the value of - Offset to another column or row (determined by the value of - IsCol), returning True if successful - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PrepareCanvas - method to get the canvas ready for drawing at the specified location - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ResetOffset - resets the offset, checking columns and rows if demanded - - - - - - - - - - - - - - - - RowHeightsChanged - method invoked when row heights are changes - - - - - - - - SaveContent as specified in the XML configuration variable - - - - - - - - - - - - ScrollBarRange - specify the range of the scrollbar; - Which determines whether it is horizontal or vertical - - - - - - - - - - - - - - - - - - - - ScrollBarPosition - records the position ( - Value) of the scrollbar; - Which determines horizontal or vertical - - - - - - - - - - - - - - - - ScrollBarPage - a Page movement of the scrollbar (specified by - Which) - - - - - - - - - - - - - - - ScrollBarShow method - Change the appearance of the scrollbars in the grid. - -'Which' can be any of : SB_BOTH, SB_VERT, SB_HORZ -'aValue' can be True or False - - - - - - - - - - - - - - ScrollBarAutomatic method - Check if scrollbars are shown automatically by the grid or not. - -'Which' can be any of : SB_BOTH, SB_VERT, SB_HORZ - - - - - - - - - - - - - - - SelectEditor - chooses the editor for current use - - - - - - - Is called if a grid cell is highlighted. - -

The SelectCell method is called if a grid cell will be highlighted.

-

The aCol and aRow parameters contain the column and the row of the highlighted cell.

-

Component developers may use the SelectCell method to react on focus changes. The Result is true if the cell is allowed to be selected. -Application developers should use the OnSelectCell event instead.

-
-
- - - - - - - - - - - - - - - - SetBorderStyle - specifies a new border style - - - - - - - - - - - - SetFixedcolor - specifies color for fixed cells - - - - - - - - - - - - SetSelectedColor - specifies color for cells that have been selected - - - - - - - - - - - - SizeChanged - specifies the old number of columns and rows - - - - - - - - - - - - - - - Sort method - -

Method to sort all items in the grid

-

If ColSorting is True, sorts the items in a column; otherwise sorts a row -

-

The three given indexes specify the items to be sorted

-
- - -
- - - - - - - - - - - - - - - - - - - - TopLeftChanged - the top left cell has changed - - - - - - - - TryMoveSelection - attempts to move the selection by the specified offset; returns True if successful - - - - - - - - - - - - - - - - - - - - - - - - UpdateHorzScrollBar - updates the scrollbar in the given range by the given page, if it is visible - - - - - - - - - - - - - - - - - - - - UpdateVertScrollbar - updates the scrollbar in the given range by the given page, if it is visible - - - - - - - - - - - - - - - - - - - - VisualChange - a change in the visual properties - - - - - - - - WMHScroll - system message for horizontal scrolling - - - - - - - - - - - - WMVScroll - system message for vertical scrolling - - - - - - - - - - - - - - - - - - - - - - Automatically advance down the grid on successive mouse clicks or presses of the ENTER or TAB key - - - - Automatically resize columns so they fill all grid's visible area - -

When this option is turned on, the grid will resize all columns to fill the grid's client width. What columns are resized is determined by the following conditions:

-

1. Fixed Columns are not resized. -2. If the grid has Custom Columns, all columns with SizePriority=0 are not resized.

-

Note that Custom Columns are initially created with SizePriority=1. For TDbGrid, which automatically adds Custom Columns, this means the user will not be able to resize such columns using the mouse.

-
-
- - - Only a restricted series of options is available: none or a single border. - - - - - - Current column index. - Col property holds the column index of the current grid cell cursor. The current grid column can be changed programmatically by setting a new value to this property. - - - - Number of columns of the grid. - This is the number of columns in the grid, including fixed and normal columns. - - - - - - - - - Column widths for the grid. - -

The column is specified with the aCol parameter. The aCol parameter must fall within the valid index range of 0 to ColCount-1.

-

The return value of the property is the width of this column, measured in pixels.

-

The initial width of a newly created column is specified with the DefaultColWidth property. After that the user may redefine this value.

-

If the Options property includes the appropriate value, the column width may also be changed by the user at runtime.

-
- - - -
- - - - - - - Default value for the width of newly created grid columns. -

If new columns of the grid are created by changing the ColCount property, the width of these new columns will be set to the value of the DefaultColWidth property.

Use 0 for auto-sized width.

Use GetRealDefaultColWidth for real value.

-
- - - -
- - - Default value for the height of newly created grid rows. -

If new rows of the grid are created by changing the RowCount property, the height of these new rows will be set to the value of the DefaultRowHeight property.

Use 0 for auto-sized height.

Use GetRealDefaultRowHeight for real value.

-
- - - -
- - - Is the default drawing method to be used for this grid? Default is TRUE - - - - - - Default style for displaying text - includes alignment, layout, single or multi-lines - - - - - DragDx - the amount (DeltaX) by which an object should be dragged - - - - - - The editor to be used for modifying information in the cells of the grid - - - - - - Is grid ready to accept edits? (EditorMode True) - - - - - EditorKey - is the current key available to the editor? - - - - - - Is the editor for the grid displayed? - - - - - - Number of the fixed columns of the grid (i.e. the columns containing title or identifier material, that don't get scrolled when the rest of the grid moves). - -

Contains the fixed column count of a grid.

-

Fixed columns are normally used for headings.

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

Contains the fixed row count of a grid.

-

Fixed rows are normally used for headings.

-
- - - - -
- - - The color for the fixed cells of the grid. - The color used by headings. - - - - - - - - Is the cell to be displayed Flat, i.e. with no texturing or raised/lowered effect - - - - - - The color to be used for the cell receiving focus - - - - - - - FocusRectVisible - is the rectangle receiving focus visible? - - - - - - - GCache - the cache to be used for grid data - - - - - - - GridHeight - the height of the grid - - - - - - Color to be used for GridLines - - - - Style to be used for GridLines - - - - Width (thickness) of GridLines - - - - Width of the whole Grid - - - - - LeftCol - the left-most column - - - - - - The options available for use in this grid - For a list of options see - - - - - - The current Row (record) within the grid - - - - - - Number of rows in the grid - This is the number of rows in the grid, including fixed and normal rows. - - - - - - - - - The row heights for the grid. - -

The row is specified with the aRow parameter. The aRow parameter must fall within the valid index range of 0 to RowCount-1.

-

The return value of the property is the height of this row, measured in pixels.

-

The initial height of a newly created row is specified with the DefaultRowHeight property. After that the user may redefine this value. If the Options property includes the appropriate value, the row height may also be changed by the user at runtime.

-
- - - -
- - - - - - - The set of options for saving information from the grid (design, attributes, content or position) - These options are used when saving grid information, but also when loading grid information. - - - - - - - - - SelectActive - if True, the current active cell is selected - - - - - - Color to be used for selected cells - - - - The current selection (rows and columns) in the grid - - - - - - The ScrollBars to be used with this grid - - - - The first row (record) in the grid - - - - - - The number of visible columns - - - - - - The number of visible rows - - - - - - - OnBeforeSelection - event handler for use before a selection is made - - - - - - Event handler for comparing the contents of grid cells - - - - - - Event handler to prepare the Canvas for drawing - - - - - - Event handler for drawing a cell - - - - - - Event handler for when an area of a grid (one or a group of cells) is selected - The Col and Row parameters contain the column and the row of the highlighted cell. - -Application developers may use the OnSelection and OnBeforeSelection events to react on focus changes. Component developers should use the method instead. - - - - - Event handler for selecting an editor - - - - - - Event handler when the top left cell is changed (i.e. the grid has been scrolled so that a different cell occupies top left) - - - - - - - Create - constructor for TCustomGrid: calls inherited Create, then creates lists of columns and rows, initializes many visual properties and options, creates the various editors and loads any bitmaps required for the display - -

// Inherited create Calls SetBounds->WM_SIZE->VisualChange so

-

// fGrid needs to be created before that

-
- - - TCustomControl.Create - -
- - - - - - - - Destroy - destructor for TCustomGrid: frees various resources including editors, columns, rows, font then calls inherited Destroy - - - - - TCustomControl.Destroy - - - - - - - - - - - - - AutoAdjustColumns - automatically adjust the columns according to the size of their contents - - - - - - - Begin updating the grid - - - - - - - The coordinates of the current cell (column, row) expressed as a standard rectangle (TRect) - - - - - - - - - - - - - - - - - - - Clear all cells from the grid. - -

Reset Column and Row counts to 0. Grid is completely emptied.

-

Compatibility: This property applies to Lazarus grids only , under Delphi/Kylix a grid can't be completely emptied.

-
-
- - - - - - - - - - - - - - - - - - Leave the cell editor - - - - - - - - - - - Emulate the OnKeyDown event handler in the cell editor - - - - - - - - - - - - - - - - - - - Emulate the OnKeyPress event handler in the cell editor - - - - - - - - - - - - - - - Emulate the OnKeyUp event handler in the cell editor - - - - - - - - - - - - - - - - - - - - EndUpdate - Finish updating the grid - - - - - - - - - - - - EndUpdate - Finish updating the grid - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - IsCellSelected - is the cell specified by - aCol, aRow selected? - - - - - - - - - - - - - - - - - - - Finds out whether a particular cell is visible - - - - - - - - - - - - - - - - - - - Load the grid data from a file with the specified name - Note that the SaveOptions property determines what information is loaded. - - - - - - - - - - - - - Convert mouse coordinates to the position of a cell in the grid - - - - - - - - - - - - - - - Convert mouse coordinates to the position of a cell in the grid - - - - - - - - - - - - - - - - - - - - - - - Convert mouse coordinates to the position of a logical cell in the grid - - - - - - - - - - - - - - - - MouseToGridZone - convert mouse coordinates to a grid zone - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Save the data in the grid to a file with specified name - Note that the property SaveOptions determines what information is saved. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TDrawGrid - a drawn grid. May contain images in its cells - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TStringGrid - a specialized grid for displaying strings (text material) in a matrix of columns androws - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Draw rubberband rect - Draw a rubberband around the provided cellrect -Second line of text - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Show row numbers in first fixed column - The displayed row numbering starts with 1. - -The row number is only displayed if no text has been assigned to the cell directly. - - - - - Keeps focused cell visible while scrolling - - - - Header cells change look when mouse is over them - - - - Header cells looks pushed when clicked - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TGridColumn - a column of similar data items in a grid - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TButtonCellEditor - the editor for button cells in a grid - - - - - - - - - - - - - - - - - - - - - - - - - - msg_SetGrid - issues message for specifying grid - - - - - - - - - - - - msg_SetPos - issues message for specifying position - - - - - - - - - - - - Col - the column in which the edited cell resides - - - - - - - Row - the row in which the edited cell resides - - - - - - - TPickListCellEditor - the editor for a picklist cell in a grid - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - msg_GetValue - issues a message to find the value - - - - - - - - - - - - msg_SetGrid - issues a message to specify the grid - - - - - - - - - - - - msg_SetValue - issues a message to specify the value - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - InsertColRow - insert either a column or a row (depending on value of - IsColumn) at the specified index position - - - - - - - - - - - - - - - - TGridColumnTitle - the title for a column in a grid - -

- TGridColumnTitle - the title for a column in a grid

-

The actual title is held in Caption -

-

- Column refers to the Grid Column to which the Title is attached

-
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - GetDefaultCaption - returns the e default caption for this column - - - - - - - - - - - - GetDefaultAlignment - returns the default alignment - - - - - - - - - - - - GetDefaultColor - returns the default color - - - - - - - - - - - - GetDefaultLayout - returns the default layout - - - - - - - - - - - - SetCaption - specifies the caption to use (rather than using default) - - - - - - - - - - - - Create - constructor for TGridColumnTitle: calls inherited Create then links the column, creates and configures the default font - - - - TObject.Create - - - - - - - - - - Destroy - destructor for TGridColumnTitle: frees form, disconnects alignments, disposes of captions and colors then calls inherited Destroy - - - - - TPersistent.Destroy - - - - - - FillTitleDefaultFont - use the default font for the whole of the title - - - - - - - - IsDefault - returns True if this is the default title - - - - - - - - - - - The Column to which the title applies - - - - - - The Alignment (whether justified or centered) for this title - - - - - - The Layout for the text of the title - - - - - - The Caption for this title - - - - - - The Color to use for this title - - - - - - The Font for this title - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - GetPickList - returns the picklist as a list of strings - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - GetDefaultAlignment - returns the default alignment - - - - - - - - - - - - GetDefaultColor - returns the default color - - - - - - - - - - - - GetDefaultLayout - returns the default layout for text - - - - - - - - - - - - GetDefaultMaxSize -returns the default maximum size - - - - - - - - - - - - GetDefaultMinSize - returns the default minimum size - - - - - - - - - - - - GetDefaultReadOnly - returns the default value for the - ReadOnly property - - - - - - - - - - - - GetDefaultSizePriority - returns the default value for size priority - - - - - - - - - - - - GetDefaultVisible - returns the default value for the - Visible property - - - - - - - - - - - - GetDefaultWidth - returns the default value for width - - - - - - - - - - - - ColumnChanged - method for dealing with change of column - - - - - - - - AllColumnsChange - method for processing a change in all columns - - - - - - - - CreateTitle - creates a column title and returns it in the result - - - - - - - - - - - - IsDefaultFont - if True, the default font is being used - - - - - - - Create - constructor for TGridColumn: calls inherited Create, -then creates a title and font, initializes a picklist and sets styles - - - - TCollectionItem.Create - - - - - - - - - - Destroy - destructor for TGridColumn: disposes of various local variables, frees picklist, font and title, then calls inherited Destroy - - - - - TCollectionItem.Destroy - - - - - - FillDefaultFont - method to fill all cells in the column with the default font - - - - - - - - IsDefault - returns True if this column is the default - - - - - - - - - - - The Grid to which this column belongs - - - - - - - WidthChanged - if True, width has been changed - - - - - - - Alignment - whether justified, centered etc - - - - - - - ButtonStyle - the style of any column button - - - - - - the Color for this column - - - - - - - DropDownRows - the number of rows in the drop-down list - - - - - - Whether the column has been Expanded - - - - - - - The Font for the column - - - - - - The Layout for text - - - - - - - MinSize - the minimum size - - - - - - - MaxSize - the maximum size - - - - - - - PickList - the list of items selected from this column - - - - - - - ReadOnly - if True, only reading (not writing) is allowed - - - - - - - SizePriority - the value of the size priority in the sorted order - - - - - - The Title for the column - - - - - - The Width of the column - - - - - - - Visible - if True, the column can be seen (i.e. not hidden) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TGridColumns - the group of columns in the grid - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TitleFontChanged - method to deal with a change in title font - - - - - - - - FontChanged - method to deal with a change in font for the columns - - - - - - - - RemoveColumn - method to remove the specified column - - - - - - - - - - - - MoveColumn from the first index to the second - - - - - - - - - - - - - - - - ExchangeColumn - exchange the position of the current column with the specified other column - - - - - - - - - - - - - - - - InsertColumn with the specified index - - - - - - - - - - - - Create - constructor for TGridColumns: calls inherited Create then loads the grid - - - - TCollection.Create - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RealIndex - the proper index for this column - Real in this sense means proper or correct, not a Real number (as it is specified as an integer) - - - - - - - - - - - - - - - IndexOf this column - - - - - - - - - - - - - - - - IsDefault returns True if this is the default column - - - - - - - - - - - - HasIndex - returns True if the current column has an index value - - - - - - - - - - - - - - - - VisibleIndex - the index value of a visible column - - - - - - - - - - - - - - - The Grid to which the current collection of columns belongs - - - - - - - Items - the list of columns in this collection - - - - - - - - - - - VisibleCount - the number of visible columns - - - - - - If True, the columns are Enabled - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CanEditShow - returns True if the editing data can be shown - - - - - - - - - - - - CanGridAcceptKey - returns True is the grid is able to accept the given key - - - - - - - - - - - - - - - - - - - - CheckLimitsWithError - method for checking limits of specified cell, with error trapping - - - - - - - - - - - - - - - - CMMouseLeave - Control Message for a mouse leaving a cell - - - - - - - - - - - - ColRowInserted - method for dealing with insertion of a column or row (depending on value of - IsCol) - - - - - - - - - - - - - - - - - - - - - - - - - - - - ColumnIndexFromGridColumn - extracts the index of the specified grid column - - - - - - - - - - - - - - - - ColumnFromGridColumn - returns the actual grid column given its index - - - - - - - - - - - - - - - - ColumnsChanged - method for dealing with changed columns - - - - - - - - - - - - CreateColumns - returns the identity of the created columns - - - - - - - - - - - - CheckNewCachedSizes - check the new values of cached sizes - - - - - - - - - - - - - - - - - - - DoCompareCells - perform the comparison of two or more cells in a grid - - - - - - - - - - - - - - - - - - - - - - - - - - - - DoCopyToClipboard - copy the selected data to the clipboard, leaving the original data in place - - - - - - - - DoCutToClipboard - cut the data from its current site and place it on the clipboard - - - - - - - - DoEditorHide - hide the data in the editor - - - - - - - - DoEditorShow - show the data in the editor - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - DoOPDeleteColRow performs the operation for deleting a column or row (depending on value of - IsCol) - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - - - DoOPInsertColRow - perform the operation for inserting either a column or a row (depending on the value of - IsCol) at the indexed position - - - - - - - - - - - - - - - - DoOPMoveColRow - performs the operation for moving either a column or a row (depending on the value of - IsCol) between - FromIndex and - ToIndex - - - - - - - - - - - - - - - - - - - - - DoPasteFromClipboard paste the data from the clipboard to the current location - - - - - - - - DoPrepareCanvas - get the canvas ready for drawing - - - - - - - - - - - - - - - - - - - - DrawAllRows - draws all the rows - - - - - - - - DrawCellText - draws the given text string in the cell specified by Col, Row or by Rectangle - - - - - - - - - - - - - - - - - - - - - - - - - - - - DrawColumnText - draw the text of the specified column - - - - - - - - - - - - - - - - - - - - - - - - EditButtonClicked - calls - OnEditButtonClick - - - - - - - - - - - - - EditorLocked - returns True if the Editor is locked, i.e. unable to accept input or make changes - - - - - - - - - - - - EditorShowInCell - shows the Editor's content - in situ in the Cell - - - - - - - - - - - - - - - - EditorWidthChanged - method for dealing with a change in editor width - - - - - - - - - - - - - - - - FixedGrid - returns True if the Grid is fixed - - - - - - - - - - - - FontChanged - method to deal with a change in font - - - - - - - - - - - - GetColumnAlignment - returns the Alignment value for the nominated column - - - - - - - - - - - - - - - - - - - - GetColumnColor - returns the Color for the specified column - - - - - - - - - - - - - - - - - - - - GetColumnFont - returns the font for the specified column - - - - - - - - - - - - - - - - - - - - GetColumnLayout - returns the Text Layout value for the specified column - - - - - - - - - - - - - - - - - - - - GetColumnReadonly - returns True if the column is marked ReadOnly - - - - - - - - - - - - - - - - GetColumnTitle - returns the column title string - - - - - - - - - - - - - - - - GetColumnWidth - returns the width of the column - - - - - - - - - - - - - - - - GetDeltaMoveNext return the relative cell coordinate of the next cell to which movement will occur - - - - - - - - - - - - - - - - - - - - - - - - GetDefaultColumnAlignment - returns the default alignment for the specified column - - - - - - - - - - - - - - - - GetDefaultColumnWidth - returns the default width for the specified column - - - - - - - - - - - - - - - - GetDefaultColumnLayout - returns the default text layout for the nominated column - - - - - - - - - - - - - - - - GetDefaultColumnReadOnly - returns the default setting of the ReadOnly flag for the specified column - - - - - - - - - - - - - - - - GetDefaultColumnTitle - returns the default title string for the specified column - - - - - - - - - - - - - - - - GetDefaultEditor - returns the default editor for the specified column - - - - - - - - - - - - - - - - GetDefaultRowHeight - returns the default row height - - - - - - - - - - - - GetScrollBarPosition - returns the position of the scroll bar specified by - Which - - - - - - - - - - - - - - - - - GetSBVisibility - finds the values of the visibility flags for the scrollbars - - - - - - - - - - - - - - - - GetSBRanges - finds the ranges of values for the scrollbars, if they are visible - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - GridColumnFromColumnIndex - returns the number of the column given its column index - - - - - - - - - - - - - - - - InternalSetColCount - specify the column count - - - - - - - - - - - - InvalidateRange - render a range of the grid non-valid - - - - - - - - - - - - InvalidateFromCol - render the grid non-valid from the specified column onwards - - - - - - - - - - - - InvalidateFocused - render the focused item non-valid - - - - - - - - GetIsCellSelected - returns True if the given cell is selected - - - - - - - - - - - - - - - - - - - - LockEditor - lock the editor so that it will not accept input or changes - - - - - - - - - - - - - - - - - - - - - - - PickListItemSelected - indicates that an item was selected from the pick-list - - - - - - - - - - - - ResetEditor - resets the current editor for the grid - - - - - - - - ResetSizes - resets the sizes - - - - - - - - ResizeColumn - resizes the nominated column to the specified width - - - - - - - - - - - - - - - - ResizeRow - resizes the nominated row to the specified height - - - - - - - - - - - - - - - - ScrollBarIsVisible - Returns True if visible; - Which determines whether horizontal or vertical - - - - - - - - - - - - - - - - SetCanvasFont to specified value - - - - - - - - - - - - SetColor to specified value - - - - - - - - - - - - SetColRow - specifies the column and row for addressing - - - - - - - - - - - - - - - - UnLockEditor - frees a previously locked Editor - - - - - - - - UpdateBorderStyle - brings the border style up to date - - - - - - - - - - - - - - - - - - - - - - - - - - - - - AllowOutboundEvents - permits mouse click on an imaginary (out-of-bounds) cell; moves cursor to nearest valid cell - -

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

-

Default value is true, as this has been the grid's behavior since the beginning.

-

This property was added to simulate Delphi behavior where outbound events are not available; to enable Delphi compatibility set this property to false.

-
- -
- - - The color to be used for the background on alternate rows of the grid. Having alternate rows in different colors can make the grid easier to read. - - - - - - Whether the Edit mode is automatically entered when a cell is selected - - - - - - The color of the border for this control - - - - - - The properties of the columns in this grid - -

The Columns property of a grid refers to the physical column in the table, and determines its size, shape, color etc. It should not be confused with the COLUMNS construct frequently used in SQL programming, which refers to Fields of data. The contents of Fields can be displayed as Columns in a Grid, but they must be seen as separate and distinct. It is irrelevant to refer to the color, font or width of a data field from a database, but these are all very relevant in specifying the appearance of a column in a grid.

-
- -
- - - The border style for the editor used in this grid - - - - - - The set of options available for the grid's editor - - - - - - - ExtendedColSizing - the sizing to be used for extended columns - - - - - - - ExtendedRowSizing - the sizing to be used for extended rows - - - - - - - ExtendedSelect - the ability to select cells beyond the boundary of the visible part of the grid - - - - - - Is the FastEditing method being used? - - - - - - - AltColorStartNormal - using a second color to display alternate rows, but starting the first row with the normal color - -

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

-

Using a different color for the background of alternate rows often makes the data in a grid much easier to read

-
- -
- - - - FixedHotColor - the 'Hot' color for the active (selected, etc) fixed cells of the grid - - - - - - - GridFlags - the flags that are set for the grid - - - - - - - HeaderHotZones - the zones of the header that are under the cursor, so are capable of being selected or pushed (or not!) - - - - - - - HeaderPushZones - the zones of the header that have been selected by the cursor, or pushed - - - - - - - InplaceEditor - the editor to be used in-place, i.e. in the cell itself instead of outside the grid - - - - - - The column (field) currently selected - - - - - - - StrictSort - is strict sorting to be used? - - - - - - The font to be used in the grid's title - - - - - - The style to be used for the grid's title - - - - - - - UseXORFeatures: When True, the dotted focus rectangle is painted using the XOR raster operation - -

This property controls how the dotted focus rectangle appears in the grid. When True, the rectangle is painted using the XOR raster operation. This allow us to see the focus rectangle no matter what the cells' background color is. When False, the user can control the color of the dotted focus rectangle using the FocusColor property

-

It also controls the look of the column/row resizing. When True, a line shows visually the size that the the column or row will have if the user ends the operation. When False, the column or row resizing takes effect just as the user drags the mouse

-
- -
- - - Event handler for when the Edit button is clicked - - - - - - Event handler for selecting an item from a picklist (e.g. drop-down list in TComboBox) - - - - - - - - - - - - - Convert the coordinates of the current cell (col, row) to a grid zone - - - - - - - - - - - - - - - - - - - Check the position of the cursor - - - - - - - Select a cell editor control with the specified style - - - - - - - - - - - - - - - - - - - Clear the background to the grid - - - - - - - - - - - Find the mouse coordinates relative to the grid origin - - - - - - - - - - - - - - - - - - - Set focus on the grid - - - - - - - Order of sorting - ascending or descending - - - - - - - TCustomDrawGrid - Base Class for drawn grids including - TDrawGrid and - TStringGrid - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FGrid - local variable holding a virtual grid on which to work - - - - - - - CalcCellExtent - calculate the dimensions required for the cell specified by - aCol, aRow - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CreateVirtualGrid - returns the created virtual grid - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - DrawCellAutonumbering - draws a cell using auto numbering - - - - - - - - - - - - - - - - - - - - - - - - DrawFocusRect - draws the rectangle currently receiving focus - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - NotifyColRowChange tells the system that a column or row has been changed (determined by - IsColumn) and whether this was an Insert - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create - constructor for TCustomDrawGrid: attaches a virtual grid then calls inherited Create - - - - - TCustomGrid.Create - - - - - - - - - - Destroy - destructor for TCustomDrawGrid: frees the grid then calls inherited Destroy - - - - - TCustomGrid.Destroy - - - - - Delete either a column or a row (specified by index), depending on the value of the boolean IsColumn - - - - - - - - - - - - - - - - Exchange either a column or a row, specified by index, with the col or row specified by WithIndex; boolean IsColumn determines whether rows or columns are to be exchanged - - - - - - - - - - - - - - - - - - - - InsertColRow inserts a column or row (specified by - Iscolumn) at the stated index location - - - - - - - - - - - - - - - Move column or row from FromIndex to ToIndex; boolean IsColumn specifies whether col or row is to be moved - - - - - - - - - - - - - - - - - - - Sort column or row specified by index and optionally by FromIndex and ToIndex; IsColumn specifies whether col or row is to be sorted - - - - - - - - - - - - - - - - - - - - - - - Use the default method for drawing a cell specified by aCol, aRow, at location aRect with state aState - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Event handler when a grid column or row is deleted - - - - - - Event handler when a grid column or row has its position exchanged with another - - - - - - Event handler when a column or row is inserted into the grid - - - - - - Event handler when a grid column or row is moved - - - - - - Event handler for comparing the contents of cells - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Event handler for finding the edit mask while editing a grid cell - - - - - - Event handler for finding the text to be edited in a grid cell - - - - - - Event handler when a column or row header is clicked - - - - - - Event handler when a column or row header is re-sized - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Event handler when a grid cell is selected - - - - - - Event handler for storing the text that has been edited in a cell - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - HeaderHotZones - the header zones corresponding to the position of the mouse cursor - - - - - - - HeaderPushZones - the zones of the header that have been pushed down (selected) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TCustomStringGrid - base class for - TStringGrid - - - - - - - - - - - TStringGridStrings - the strings that populate the cells of a TStringGrid - All of the properties are defined in the ancestor classes (TStrings etc) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create - constructor for TStringGridStrings: calls inherited Create and -initializes some local variables - - - - TObject.Create - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SelectionSetText - stores the text in the selection - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Whether or not the current cell has been Modified - - - - - - - - Create - constructor for TCustomStringGrid: calls inherited Create then sets up default styles, layout and alignment - - - - TCustomDrawGrid.Create - - - - - - - - - - Destroy - destructor for TCustomStringGrid: frees maps of columns and rows, then calls inherited Destroy - - - - TCustomDrawGrid.Destroy - - - - - - AutoSizeColumn - automatically adjust width of column to accommodate widest text -

This procedure sets the column width to the size of the widest text it finds in all rows for the column aCol. -

Tip: see the goDblClickAutoSize option to allow columns to be automatically resized when doubleClicking the column border.

-
- - -
- - - - - - - - AutoSizeColumns - automatically resizes all columns by adjusting them to fit in the longest text in each column - Automatically resizes all columns by adjusting them to fit in the longest text in each column. This is a quick method of applying AutoSizeColumn() for every column in the grid. - - - - - - - Clean all cells in the grid subject to the given CleanOptions, optionally specifying a range of cells or a rectangular region. -

Cleans all cells in the grid subject to the given CleanOptions, optionally specifying a range of cells or a rectangular region. See for more information.

The cleaning operation does not change the number of rows and columns.

Some examples:

  • Clean all cells: grid.Clean([]); (the same as grid.clean)
  • Clean all non fixed cells: grid.Clean([gzNormal]);
  • Clean all cells but don't touch grid column headers: Grid.Clean([gzNormal, gzFixedRows]);
  • -
-
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - Cells - the text content of a cell or cells, indexed by - aCol, aRow - - - - - - - - - - - - - - - - Cols - get or set a list of strings for column names as specified by the - index - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The Objects present in the specified cell - - - - - - - - - - - - - - - Rows - gets or sets a list of strings for row names as specified by - index - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - HeaderHotZones - the header zones corresponding to the position of the mouse cursor - - - - - - - HeaderPushZones - the zones of the header that have been pushed down (selected) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CopyToClipboard - copy a range of cells to clipboard - This method will copy a range of cells into the clipboard, the cells values are TAB separated. - -The range is defined based on optional AUseSelection parameter which is false by default and which means the range is set to the whole grid, including fixed cols/rows. If AUseSelection is true, the range of cells is set to current - - - - How to use Grids including StringGrids, DrawGrids and DbGrids - - -

Customizing grids -

-

Grid are components derived from the TCustomControl class and don't have a native widget associated with them, so they are not restricted by the look of the current interface theme. This can be both an advantage and a disadvantage: usually programmers want to create a uniform-look application. Lazarus grids are flexible enough to allow programmers to make them look similar to other native controls; alternatively they can customize the grid to obtain almost the same look in any platform or widget interface (with the exception of scrollbars, whose look is still determined by the current theme).

-

Some properties can affect the way the grid looks by acting when the cell is about to be painted in PrepareCanvas/OnPrepareCanvas by changing default canvas properties like brush color or font. Following is a list of such properties:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Properties and Events for customizing grids
- PropertyMeaning
AlternateColorThe user can change the background color that appears on alternate rows. This is to allow easy reading of grid rows data.
ColorSets the primary color used to draw non fixed cells' background.
FixedColorThe color used to draw fixed cells' background.
FlatEliminates the 3d look of fixed cells.
TitleFontFont used to draw the text in fixed cells.
TitleStyle -

Changes the 3D look of fixed cells. There are 3 settings:

-
    -
  • tsLazarus The default look
  • -
  • tsNative Tries to set a look that is in concordance with current widgetset theme.
  • -
  • tsStandard A more contrasted look, like Delphi grids.
  • -
-
AltColorStartNormal(Boolean). If true, alternate color is always in the second row after fixed rows; the first row after fixed rows will always be the default color. If false, default color is set to the first row as if there were no fixed rows.
BorderColorSets the grid's border color used when Flat=True and BorderStyle=bsSingle;
EditorBorderStyleIf set to bsNone under Windows the cell editors will not have the border, like in Delphi; set to bsSingle by default because the border can be theme specific in some widgetsets and to allow a uniform look.
FocusColorThe color used to draw the current focused cell if UseXORFeatures is not set; by default this is clRed.
FocusRectVisibleTurns on/off the drawing of focused cell.
GridLineColorColor of grid lines in non fixed area.
GridLineStylePen style used to draw lines in non fixed area, possible choices are: psSolid, psDash, psDot, psDashDot, psDashDotDot, psinsideFrame, psPattern, psClear; default is psSolid.
SelectedColorColor used to draw cell background on selected cells.
UseXORFeaturesIf set, focus rect is drawn using XOR mode so it should make visible the focus rect in combination with any cell color background. It also affects the way that moving columns look.
DefaultDrawing(Boolean). Normally the grids prepare the grid canvas using some properties according to the kind of cell that is being painted. If the user has written an OnDrawCell event handler, DefaultDrawing (if set) also paints the cell background; if the user is taking full responsibility for drawing the cell it is better to turn off this property so painting is not duplicated. In a StringGrid, if DefaultDrawing is set it draws the text in each cell.
AutoAdvanceWhere the cell cursor will go when pressing enter or tab/shift tab, or after editing.
ExtendedColSizingIf true, the user can resize columns, not just at the headers, but anywhere along the column's height.
-

- Other properties that also affect the grid's look: -

-

- Options: This property is a set of zero or more choices, with some elements that enable diverse functionality but others that are related directly with grid's look. Options can be set at designtime or runtime.

-
    -
  • - goFixedVertLine, goFixedHorzLine: draws a vertical or horizontal line respectively, delimiting cells or columns in the fixed area; active by default.
  • -
  • - goVertLine, goHorzLine: the same as previous, but for the normal browseable area. A grid can be made to simulate a listbox by unsetting both of these options.
  • -
  • - goDrawFocusSelected: if this option is enabled, a selection background is painted in the focused cell in addition to the focused dotted rectangle (note this doesn't work yet when the - goRowSelect option is set; in such case the row is always painted as if - goDrawFocusSelected is set)
  • -
  • - goRowSelect: selects the full row instead of individual cells
  • -
  • - goFixedRowNumbering: if set, grid will do numbering of rows in first fixed column
  • -
  • - goHeaderHotTracking: if set, the grid will try to show a different look when the mouse cursor is over any fixed cell. In order for this to work, desired cell zone needs to be enabled with the property - HeaderHotZones. Try combining this option with property TitleStyle= tsNative to get themed hot tracking look.
  • -
  • - goHeaderPushedLook: if set, this option enables a pushed look when clicking any fixed cell. The zone of "pushable" cells is enabled using HeaderPushedZones property.
  • -
-

- Description of grid's drawing process -

-

Like other custom controls, the grid is drawn using the paint method. In general terms the grid is drawn by painting all rows, and each row by painting its individual cells.

-

The process is as follow:

-
    -
  • First the visible cells area is determined: each row is tested to see if it intersects the canvas clipping region; if it's OK, then the visible area is painted by drawing columns of each row.
  • -
  • The column and row values are used to identify the cell that is about to be painted and again each column is tested for intersection with the clipping region; if everything is OK, some additional properties like the cell's rectangular extent and visual state are passed as arguments to the DrawCell method.
  • -
  • -

    As the drawing process is running, the visual state of each cell is adjusted according to grid options and position within grid. The visual state is retained in a variable of type TGridDrawState which is a set with following elements: -

    - - - - - - - - - - - - - - - - - - - - - -
    gdSelectedThe cell will have a selected look.
    gdFocusedThe cell will have a focused look.
    gdFixedCell have to be painted with fixed cell look.
    gdHotthe mouse is over this cell, so paint it with hot tracking look
    gdPushedthe cell is being clicked, paint it with pushed look
    -
  • -
  • -

    - DrawCell. The DrawCell method is virtual and may be overridden in descendent grids to do custom drawing. The information passed to - DrawCell helps to identify which particular cell is being painted, the physical area occupied on the screen and its visible status. See - DrawCell reference for details. For each cell the following occurs: -

    -
      -
    • - PrepareCanvas. If the DefaultDrawing property is set, the grid canvas is setup with default properties for brush and font based on current visual state. For several design and runtime properties, the text alignment is set to match programmer selection in custom columns if they exists. If DefaultDrawing is false, brush color is set to clWindow and Font color to clWindowText, the text alignment is set with grids defaultTextStyle property value.
    • -
    • - OnPrepareCanvas. If the programmer wrote an event handler for the - OnPrepareCanvas event, it is called at this point. This event can be used for doing simple customization like changing a cell's background color, font's properties like color, font face and style, Text layout like different combinations of left, center, top, bottom, right alignment, etc. Any change made to the canvas for a particular cell in this event would be lost, because the next cell drawing will reset canvas again to a default state. So it's safe doing changes only for a particular cell or cells and forget about it for the rest. Using this event sometimes helps to avoid using the - OnDrawCell grid event, where users would be forced to duplicate the grid's drawing code.
    • -
    • - OnDrawCell. Next, if no handler for the OnDrawCell event was specified, the grid calls the - DefaultDrawCell method which simply paints the cell background using the current canvas brush color and style. - If the OnDrawCell handler exists, the grid first paints the cell background, but only if the - DefaultDrawing property was set; then it calls the OnDrawCell event to do custom cell painting. - Usually programmers want to do custom drawing only for particular cells, but standard drawing for others: in this case, they can restrict custom operation to certain cell or cells by looking into - ACol, ARow and AState arguments, and for other cells simply call the DefaultDrawCell method and let the grid to take care of it.
    • -
    • - Text. At this point, if the DefaultDrawing property is true, the cell's text content is painted (only for TStringGrid) .
    • -
    • - Grid lines The last step for each cell is to paint the grid lines: if grid options goVertLine, goHorzLine, goFixedVertLine and - goFixedHorzLine are specified the cell grid is drawn at this point. Grids with only rows or only cols can be obtained by changing these options. If the programmer elected to have a "themed" look it is done at this point also (see property TitleStyle).
    • -
    • - FocusRect When all columns of the current row have been painted it is time to draw the focus rectangle for the current selected cell or for the whole row if the - goRowSelect option is set.
    • -
    -
  • -
-

- Grid's cell selection -

-

The location of a grid's current (focused) cell (or row) can be changed using keyboard, mouse or through code. In order to change cell focus successfully to another position, we must test the target position to see if it is allowed to receive cell focus. When using the keyboard, AutoAdvance performs part of the process by finding what should be the next focused cell. When using mouse clicks or moving by code, focus will not move from the current cell unless the target cell is permitted to receive focus.

-

The grid calls SelectCell to see if a cell is focusable: if this function returns true, then the target cell identified with arguments aCol and aRow is focusable (the current implementation of TCustomGrid simply returns true). TCustomDrawGrid and hence TDrawGrid and TStringGrid override this method and check first if a cell is any wider than 0; normally you don't want a 0 width cell selected so a cell with this characteristics is skipped automatically in the process of finding a suitable cell. The overridden method SelectCell also calls the user configurable event OnSelectCell: this event receives the cell coordinates as arguments and always returns a default result of True.

-

Once a cell is known to be focusable and we are sure a movement will take place, the method BeforeMoveSelection is called; this in turns triggers the OnBeforeSelection event. This method's arguments are the coordinates for the new focused cell; at this point any visible editor is hidden too. The "before" word means that selection is not yet changed and current focused coordinates can be accessed with grid.Col and grid.Row properties.

-

After that, the internal focused cell coordinates are changed and MoveSelection is called; this method's purpose (if set) is to trigger the OnSelection event (this is a notification that the focused cell has changed and the new cell coordinates are available through grid.row and grid.col properties).

-

Note that is not good to use the OnSelectCell event to detect cell focus changes, as this event will be triggered several times even for the same cell in the process of finding a suitable cell. Is better to use OnBeforeSelection or OnSelection events for this purpose.

-

- Using cell editors -

-

Users can specify what editor will be used for a cell using one of two methods.

-
    -
  1. - Using a custom column and selecting the ButtonStyle property of the column. In this method the user can select the style of the editor that will be shown. Available values are: - cbsAuto, cbsEllipsis, cbsNone, cbsPickList, cbsCheckboxColumn.
  2. -
  3. - Using the OnSelectEditor grid event. Here the user specifies in the Editor parameter which editor to use for a cell identified by - aCol, ARow in a TCustomDrawGrid derived grid or TColumn in TCustomDBGrid. - The public EditorByStyle() function takes as parameter one of the following values: - cbsAuto, cbsEllipsis, cbsNone, cbsPickList, cbsCheckboxColumn. -
    - This method takes precedence over the first one using custom columns. A Custom cell editor can be specified here, with values specific to the cell, row or column.
  4. -
-

- Description of editor styles -

-

The following is a description of the editor styles. They are enumerated values of type TColumnButtonStyle and so they are prefixed by 'cbs'. This type was used to remain compatible with Delphi's DBGrid.

-
    -
  • - cbsAuto This is the default editor style for TCustomGrid derived grids. The TStringCellEditor derived from TCustomMaskEdit is specialized to edit single line strings and is used by default in TStringGrid and TDrawGrid. When using Custom Columns, if the programmer filled the Column's PickList property, this behaves as if cbsPickList editor style was set. For a TCustomDBGrid that has a field of type boolean, it behaves as if cbsCheckBoxColumn editor style was specified. This is the recommended value for Custom Cell Editors. TODO: related OnEditingDone.
  • -
  • -

    - cbsEllipsis This editor style is the most generic one. A button with ellipsis (...) appears in the editing cell and the programmer can use the OnEditButtonClick grid event to take any programmed action when the user presses the button. For example a calendar dialog could pop up to allow the user to select a specific date, a file open dialog could appear to find files, or a calculator could appear so the user could enter the numeric result of calculations, etc. -

    -
      -
    • OnEditButtonClick is just a notification, to find out in which cell a button has been clicked by taking a look at the grid.Row and grid.Col properties.
    • -
    • A DBGrid has specific properties to retrieve the active column or field and because this event occurs in the active record, it could update the information in the active field.
    • -
    • This editor style is implemented using TButtonCellEditor, a direct descendant of TButton.
    • -
    -
  • -
  • - cbsNone This editor style instructs the grid not to use any editor for a specific cell or column; it behaves then, as if the grid were readonly for such a cell or column.
  • -
  • - cbsPickList Used to present the user with a list of values that can be entered. This editor style is implemented using TPickListCellEditor, a component derived from TCustomComboBox. The list of values that are shown is filled in one of two ways depending on the method used to select the editor style. -
    - When using custom columns, programmers can enter a list of values using the column's PickList property. [FOR BEGINNERS: TODO: exact procedure to edit the list]
  • -
  • -

    - cbsCheckboxColumn This editor style is at the moment only available in TDBGrid. If a field's contents associated with the column are restricted to a pair of values, for example, yes-no, true-false, on-off, 1-0, etc then cbsCheckboxColumn is used to modify the appearance of a column by using a checkbox representation that the user can toggle by using a mouse click or pressing the SPACE key. -

    -
      -
    • If a columns' ButtonStyle property is set to cbsAuto and DBGrid detects that the field associated with the column is a boolean field, then the grid uses this editor style automatically. This automatic selection can be disabled or enabled using DBGrid's OptionsExtra property; setting dgeCheckboxColumn element to false disables this feature.
    • -
    • The values that are used to recognize the checked or unchecked states are set in a column's properties ValueChecked and ValueUnchecked.
    • -
    • At any moment, the field value can be in one to three states: Unchecked, Checked or Grayed.
    • -
    -
  • -
-
- Todo: samples of what can be made and what to leave for OnDrawCell? - -
msg_SetPos - issues message for specifying position + + Message for the control + + + + Message used to get the grid control for the cell editor + + + + + Message for the control + + + + Constructor for the class instance + +

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

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

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

+
+ + + +
+ + + + + EditText is a published in TStringCellEditor. + + + + + + + + OnEditingDone is a published in TStringCellEditor. + + + + + + + + TButtonCellEditor - the editor for button cells in a grid + +

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

+
+ + + + + + +
+ + + + + + + + + msg_SetGrid - issues message for specifying grid + + + + + + + + msg_SetBounds - issues message for specifying bounds + + + + + + + + + msg_SetPos - issues message for specifying position + + + + + LCL message for the grid control + + msg_Ready - issues message when ready + + LCL message for the grid control + + + + + Column number for the grid cell editor + +

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

+

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

+
+ + + +
+ + + + Row number for the grid cell editor + +

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

+

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

+
+ + + +
+ + + + Implements a cell editor control which displays a Pick List + +

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

+

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

+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + msg_GetValue - issues a message to find the value + + + + + + LCL message for the grid control + + + + + + msg_SetGrid - issues a message to specify the grid + + + + + + LCL message for the grid control + + + + + + msg_SetValue - issues a message to specify the value + + + + + + LCL message for the grid control + + msg_SetPos - issues a message to specify the position + + LCL message for the grid control + + + + + TEditorItem - a single item on which a Composite Cell Editor operates @@ -12799,11 +1475,17 @@ The range is defined based on optional AUseSelection parameter which ActiveControl - returns True if this item is part of an active control + TCompositeCellEditor - a general purpose editor for cells in a grid + + + + msg_GetValue - issues a message to find the value @@ -12836,41 +1518,10803 @@ The range is defined based on optional AUseSelection parameter which msg_SetPos - issues a message to specify the position - + SendChar - transmits the specified character and returns an integer status result 0 - failure, 1 - success + + AddEditor - adds the specified Editor with the given alignment and specified ActiveControl property - + + + + Defines the event handler signalled to draw a cell a grid control + + + + + + Grid control for the event notification + + + + Column number to draw in the event handler + + + + Row number to draw in the event handler + + + + Rectangle to draw in the event handler + + + + Grid drawing state used in the event handler + + + + + + Specifies the event handler signalled when a cell is selected in a grid control + + + TOnSelectCellEvent specifies the event handler signalled when a cell is selected in a custom-drawn grid control. TOnSelectCellEvent is the type used to implement the OnSelectCell in TCustomDrawGrid. + + + + + + + + Control for the event notification + + + + Column number for the selection notification + + + + Row number for the selection notification + + + + Set to True if the specified cell can be selected + + + + + + Specifies an event handler signalled for a selection in a grid control + + +

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

+
    +
  • OnAfterSelection
  • +
  • OnBeforeSelection
  • +
  • OnButtonClick
  • +
  • OnSelection
  • +
+

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

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

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

+
    +
  • OnColRowDeleted
  • +
  • OnColRowExchanged
  • +
  • OnColRowInserted/
  • +
  • OnColRowMoved
  • +
+

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

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

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

+

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

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

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

+

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

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

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

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

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

+

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

+

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

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

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

+

+ Sender is the grid control triggering the event notification. +

+

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

+

+ AState contains the grid drawing state for the cell data. +

+

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

+
+ + + + + + + +
+ + + Grid control for the event notification + + + + Column number for the cell in the event notification + + + + Row number for the cell in the event notification + + + + Grid drawing state for the cell in the event notification + + + + + Specifies the event handler used to get the image drawn for a Checkbox column in a grid + + +

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

+

+ Sender is the grid control generating the event notification. +

+

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

+

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

+

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

+

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

+

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

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

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

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

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

+

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

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

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

+

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

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

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

+

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

+
+ + + +
+ + Grid control generating the event notification + + + Column number for the cell in the event notification + + + Row number for the cell in the event notification + + + Process to perform on the cell value + + + Value for the cell after processing has been applied + + + + Event used to get cell hints + + + + + The grid + + + Column index + + + Row index + + + Hint text + This text will be displayed as hint. + + + + + Specifies an event handler used to load/save the configuration for a column in a grid + + +

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

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

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

+

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

+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + doDestroyItem - method for destroying an Item at the given Row and Column location + + + + + + + + + + + + + + + + + + + + + + + + + doNewItem - method for producing a new item at the given location specified by Row, Col + + + + + + + + + + + + + + + + + + + + + + + + + DeleteColRow - remove either a column or a row, depending on the value of + IsColumn + + + + + + + + + + + + + + + + + MoveColRow - move either a column or a row (depending on value of IsColumn) at FromIndex to the location ToIndex + + + + + + + + + + + + + + + + + + + + + ExchangeColRow - exchange either the current column or row (depending on the value of IsColumn) with the entity specified by WithIndex + + + + + + + + + + + + + + + + + + + + + DisposeCell - dispose of the resources and pointer for the given cell + + + + + + + + + + + + + DisposeColRow - dispose of the specified row or column, freeing its pointer + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create - constructor for TVirtualGrid: calls inherited Create then creates arrays of Cells, Columns and Rows; forms links for actions and event handlers + + + + TObject.Create + + + + + + + Destroy - destructor for TVirtualGrid: frees rows, columns and cells, then calls inherited Destroy + + + + TObject.Destroy + + + + + + + Clear the grid + + + + + + + + + GetDefaultCell - returns the properties of the default cell + + + + + + + + + + + + + GetDefaultColRow - returns the properties of the default column and row + + + + + + + + + + + + + ColCount - the number of columns in the current grid + + + + + + + + + RowCount - the number of rows in the current grid + + + + + + + + + Celda - the current cell as defined by its column and row + + + + + + + + + + + + + + + + + Cols - the columns to which the grid applies + + + + + + + + + + + + The Rows to which the grid applies + + + + + + + + + + + + InsertColRow - insert either a column or a row (depending on value of IsColumn) at the specified index position + + + + + + + + + + + + + + + + + Provides properties and methods relevant to the title for a column in a grid + + +

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

+
    +
  • Alignment
  • +
  • Color
  • +
  • Font
  • +
  • ImageIndex
  • +
  • ImageLayout
  • +
  • Layout
  • +
  • MultiLine
  • +
  • PrefixOption
  • +
+

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

+

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

+

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

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

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

+

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

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

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

+
+ + + + + + + +
+ + + + + + + + + + + GetDefaultCaption - returns the e default caption for this column + + + + + + + Default value for the Caption property + + + + + + GetDefaultAlignment - returns the default alignment + + + + + + + Default value for the Alignment property + + + + + + GetDefaultColor - returns the default color + + + + + + Default value for the Color property + + + + + + GetDefaultLayout - returns the default layout + + + + + + + Default value for the Layout property + + + + + + SetCaption - specifies the caption to use (rather than using default) + + + + + + + New value for the property + + + + + + Constructor for the class instance + + +

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

+

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

+

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

+

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

+
+ + TObject.Create + +
+ + + Column class instance where the column title is used + + + + + + Destroy - destructor for TGridColumnTitle: frees form, disconnects alignments, disposes of captions and colors then calls inherited Destroy + + + + TPersistent.Destroy + + + + + + + FillTitleDefaultFont - use the default font for the whole of the title + + + + + + + + + IsDefault - returns True if this is the default title + + + + + + + + + + + + The Column to which the title applies + + + + + + + The Alignment (whether justified or centered) for this title + + + + + + + The Caption for this title + + + + + + + The Color to use for this title + + + + + + + The Font for this title + + + + - ImageIndex - the index for any image to be used in the title (default=0, i.e. no image) + ImageIndex - the index for any image to be used in the title (default=0, i.e. no image) +
+ - ImageLayout - the layout to use for any image in the title + ImageLayout - the layout to use for any image in the title +
+ + + + The Layout for the text of the title + + + + + + Indicates if the column title can be displayed as multiple lines + +

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

+
+ + + +
+ + + Indicates if accelerator keys are used in the column title + +

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

+
+ + + + +
+ + + + Implements a column definition used for tabular data in TCustomGrid + +

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

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

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

+

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

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

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

+
+ + + + +
+ + + Class instance generating the notification + + + + + Gets the value for the Alignment property + + + + + + Value for the property + + + + + Gets the value for the Color property + + + + + + Value for the property + + + + + Gets the value for the Expanded property + + Always returns True in the current implementation. + + + + + + Value for the property + + + + + Gets the value for the Font property + + + + + + Value for the property + + + + + Gets the value for the Grid property + + + + + + Value for the property + + + + + Gets the value for the Layout property + + + + + + Value for the property + + + + + Gets the value for the MaxSize property + + + + + + Value for the property + + + + + Gets the value for the MinSize property + + + + + + Value for the property + + + + + Gets the value for the SizePriority property + + + + + + Value for the property + + + + + + GetPickList - returns the picklist as a list of strings + + + + + + + Value for the property + + + + + Gets the value for the ReadOnly property + + + + + + Value for the property + + + + + Gets the value for the Visible property + + + + + + Value for the property + + + + + Gets the value for the Width property + + + + + + Value for the property + + + + + Indicates if the Alignment is used for the class instance + + + + + + + + True when Alignment has been assigned in the class instance + + + + + Indicates if the Color is used in the class instance + + + + + + + + True when Color has been assigned in the class instance + + + + + Indicates if the Font has been assigned for the column + + + + + + True when Font has a value other than the default font + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Sets the value in the Alignment property + + + + + + + + New value for the property + + + + + Sets the value in the ButtonStyle property + + + + + + New value for the property + + + + + Sets the value in the Color property + + + + + + New value for the property + + + + + Sets the value in the Expanded property + + + + + + New value for the property + + + + + Sets the value in the Font property + + + + + + New value for the property + + + + + Sets the value in the Layout property + + + + + + New value for the property + + + + + Sets the value in the MaxSize property + + + + + + New value for the property + + + + + Sets the value for the MinSize property + + + + + + New value for the property + + + + + Sets the value for the PickList property + + + + + + New value for the property + + + + + Sets the value for the ReadOnly property + + + + + + New value for the property + + + + + Sets the value for the SizePriority property + + + + + + New value for the property + + + + + Sets the value for the Title property + + + + + + New value for the property + + + + + Sets the value for the Visible property + + + + + + New value for the property + + + + + Sets the value for the Width property + + + + + + New value for the property + + + + + + + + + + + + + + + + + GetDefaultAlignment - returns the default alignment + + + + + + + + + + + + + GetDefaultColor - returns the default color + + + + + + + + + + + + + GetDefaultLayout - returns the default layout for text + + + + + + + + + + + + + GetDefaultMaxSize -returns the default maximum size + + + + + + + + + + + + + GetDefaultMinSize - returns the default minimum size + + + + + + + + + + + + + GetDefaultReadOnly - returns the default value for the ReadOnly property + + + + + + + + + + + + + GetDefaultSizePriority - returns the default value for size priority + + + + + + + + + + + + + GetDefaultVisible - returns the default value for the Visible property + + + + + + + + + + + + + GetDefaultWidth - returns the default value for width + + + + + + + + + + + + + ColumnChanged - method for dealing with change in the column + + + + + + + + + AllColumnsChange - method for processing a change in all columns + + + + + + + + + CreateTitle - creates a column title and returns it in the result + + + + + + + TGridColumnTitle instance created in the method + + + + + + IsDefaultFont - if True, the default font is being used + + + + + + + + Constructor for the class instance + +

+ Create is the constructor for TGridColumn. Create calls the inherited Create method using ACollection as the owner for the collection item. Create allocates resources needed for members in the class instance, and sets the default values for properties such as: Title, Font, IsDefaultFont, ButtonStyle and DropDownRows. +

+
+ + TCollectionItem.Create + + + + + + +
+ + + Collection which owns the collection item + + + + + + Destroy - destructor for TGridColumn: disposes of various local variables, frees picklist, font and title, then calls inherited Destroy + + + + + + + + + + + FillDefaultFont - method to fill all cells in the column with the default font + + + + + + + + + IsDefault - returns True if this column is the default + + + + + + + + + + + + The Grid to which this column belongs + + + + + + + + WidthChanged - if True, width has been changed + + + + + + + + + Alignment - whether justified, centered, etc + + + + + + + + + ButtonStyle - the style of any column button + + + + + + + + The Color for this column + + + + + + + + DropDownRows - the number of rows in the drop-down list + + + + + + + + + Whether the column has been Expanded + + + + + + + + The Font for the column + + + + + + + The Layout for text + + + + + + + + MinSize - the minimum size + + + + + + + + + MaxSize - the maximum size + + + + + + + + + PickList - the list of items selected from this column + + + + + + + + + ReadOnly - if True, only reading (not writing) is allowed + + + + + + + + + SizePriority - the value of the size priority in the sorted order + + + + + + + + The Title for the column + + + + + + + The Width of the column + + + + + + + + Visible - if True, the column can be seen (i.e. not hidden) + + + + + + + + GetValueChecked - returns a checked value as a string + + + + + + GetValueUnchecked - returns an unchecked value as a string + + + + + + ValueChecked - a string value of a checked item + + + + + + ValueUnchecked - a string value of an unchecked item + + + + + + GetDefaultValueUnchecked - returns the default value for an unchecked column + + + + + + + Stores data about rows and columns used in a TCustomGrid class instance + + + TGridPropertyBackup is a record type used to store data about rows and columns, including fixed cells, used in a TCustomGrid class instance. + + + + + + + + + + Indicates if the grid contains valid row or column counts + + + + + + + + Number of fixed rows in the grid + + + + + + + Number of fixed columns in the grid + + + + + + Number of rows in the grid + + + + + + Number of columns in the grid + + + + + + + + TGridColumns - the group of columns in the grid + + +

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

+

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

+

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

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

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

+
+ + + + +
+ + + + + FontChanged - method to deal with a change in font for the columns + + + + + + + + + RemoveColumn - method to remove the specified column + + + + + + + Ordinal position of the column to remove in the method + + + + + + MoveColumn from the first index to the second + + + + + + + Original position for the column moved in the method + + + + New position for the column moved in the method + + + + + + ExchangeColumn - exchange the position of the current column with the specified other column + + + + + + + Position of a column exchanged in the method + + + + Position of the other column exchanged in the method + + + + + + InsertColumn with the specified index + + + + + + + Position in the collection where the column is inserted + + + + + + Create - constructor for TGridColumns: calls inherited Create then loads the grid + + + + TCollection.Create + + + + + Grid which owns the collection of column definitions + + + + Class reference used to create new items in the collection + + + + + + Column added to the collection + + + + + Clears all items in the collection + +

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

+
+ +
+ + + + + RealIndex - the proper index for this column + + + Real in this sense means proper or correct, not a Real number (as it is specified as an integer) + + + + + + + + + + + + + + + + Gets the ordinal position in the collection for the specified item + + +

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

+
+ + + + +
+ + + Ordinal position for the collection item, or -1 when not found + + + + Grid column to locate in the collection + + + + + + IsDefault returns True if this is the default column + + + + + + + + + + + + + HasIndex - returns True if the current column has an index value + + + + + + + + + + + + + + + + + VisibleIndex - the index value of a visible column + + + + + + + + + + + + + + + + + The Grid to which the current collection of columns belongs + + +

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

+

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

+
+ + + + + + +
+ + + + + Provides indexed access to column definitions in the collection + + +

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

+

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

+

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

+

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

+

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

+
+ + + + + + + + +
+ + + Ordinal position for the column definition used as the value + + + + + + VisibleCount - the number of visible columns + + + + + + + + + If True, the columns are Enabled + + + + + + + + Stores mouse coordinates in screen pixels + +

+ TGridCoordinate is an alias for the TPoint type, and used to capture mouse coordinates in TCustomGrid and descendent classes. The X and Y coordinates refer to screen pixels, and are derived from the row and column numbers for the corresponding cell. +

+
+ + + + +
+ + + + + + TGridRect is an alias for the TRect type. + + + + + + + + TGridRectArray is an array type used to store TGridRect values. + + + + + + + Stores size and movement data for columns or rows in a grid + + +

+ TSizingRec is a record type used to store size and movement information for columns or rows in TCustomGrid and descendent classes. TSizingRec is the type used for an internal member in TCustomGrid. +

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + Stores cache information about a grid control + + + TGridDataCache is a record type used to store and cache information about a grid control, its layout, and activity. TGridDataCache is the type used to implement the GCache in TCustomGrid. + + + + + + + + + + + Sum of the column widths for fixed cells in a grid. + + + + + + + + + Sum of the row heights for fixed cells in a grid. + + + + + + + + + Sum of the column widths for all cells in a grid. + + + + + + + + + Sum of the row heights for all cells in a grid. + + + + + + + + + Width of the grid control minus the width for the vertical scrollbar. + + + + + + + + + Height of the grid control minus the width of the horizontal scrollbar. + + + + + + + + + Difference between ClientWidth and FixedWidth. + + + + + + + + + Difference between ClientHeight and FixedHeight. + + + + + + + + Difference between the scrollbar range and the grid page + + + + + + + + + Visible non-fixed rectangle of cell coordinates. + + + + + + + + + Bottom/Right coordinates in (pixels) for the visible parts of a grid. + + + + + + + + + True when there are no fixed columns to display in a grid. + + + + + + + + + True when there are no fixed rows to display in the grid. + + + + + + + + + True when there are no fixed cells for columns or rows in a grid. + + + + + + + + + Cumulative width for all columns in a grid. + + + + + + + + + Cumulative height for all rows in a grid. + + + + + + + + + Offset in pixels for the Top/Left column in a grid. + + + + + + + + + Offset in pixels for the Top/Left row in a grid. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Visible cells excluding partially visible cells + + + + + + + + + + + + + + + + + Enumerated type with cursors available in a grid + + + + + Normal cursor shape/style + + + Cursor displayed when changing the size of a column + + + Cursor displayed when resizing the height of a row + + + Cursor displayed when dragging a row or column + + + + + + TCustomGrid - the base class for all grid controls + + +

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

+

+ Key properties: +

+

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

+

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

+

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

+

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

+

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

+

+ The ScrollBars controls the creation of scrollbars for the grid. +

+

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

+

+ The Options controls options for the grid. +

+

+ Key methods and events: +

+

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

+

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

+

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

+

+ Component developers must override the DrawCell method in customized grids. +

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Adjusts a row or column count + +

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

+

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

+

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

+

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

+

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

+
+ + + + + + + +
+ + + True when the count values are for a columns instead of rows + + + + Count value before adjustment + + + + Count value after adjustment + + + + + + Stores visible parts of the grid (excluding fixed cells) in the grid cache + + + + + + + + + + + + Removes the range selection active in the grid + + + + + + + + + + Ensures that row and column numbers for fixed cells are valid + + + Raises an EGridException if values in row or column numbers for fixed cells contain negative values, or are not in range for the grid control. + + + + + + + + + + + + + + + + + + + + + + + + Ensures that a handle has been allocated for the grid prior to actions that affect the row or column count + + + + + + + + + + + + + + + Ensures a row or column index is not out of range + + + + + + + + + True when the Index is for a column; False when it is for a Row + + + Value examined in the method + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Gets the value for the ColRow property + + + + + + + Value for the property + + + + Sets the value for the ColRow property + + + + + + + New value for the property + + + + + Indicates if the cell at the specified coordinates is a non-fixed cell, and uses a button-style column editor + + + + + + + + + + + + + Gets the value for the SelectedColumn property + + + + + + + Value for the property + + + + Sets the value in the AlternateColor property + + + + + + + New value for the property + + + + + Sets the value in the AutoFillColumns property + + + + + + + + New value for the property + + + + Sets the value for the BorderColor property + + + + + + + New value for the property + + + + Sets the value for the ColumnClickSorts property + + + + + + + New value for the property + + + + Sets the value for the Columns property + + + + + + + New value for the property + + + + Sets the value for the EditorOptions property + + + + + + + New value for the property + + + + Sets the value for the EditorBorderStyle property + + + + + + + New value for the property + + + + Sets the value for the AltColorStartNormal property + + + + + + + New value for the property + + + + + Sets the value for the Flat property + + + + + + + + New value for the property + + + + + Sets the value for the FocusRectVisible property + + + + + + New value for the property + + + + Sets the value for the TitleImageList property + + + + + New value for the property + + + + Sets the value for the TitleImageListWidth property + + + + + New value for the property + + + + Sets the value for the TitleFont property + + + + + New value for the property + + + + Sets the value for the TitleStyle property + + + + + New value for the property + + + + Sets the value for the UseXorFeatures property + + + + + New value for the property + + + + + Performs actions needed when a column in the grid is resized + +

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

+

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

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

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

+

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

+

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

+
+ + + + + + +
+ + True when the cell is valid or has not been altered + + + Indicates the cell value is validated using ValidateEntry + + + + + Sets the position and size for an active cell editor in the grid + + + + + + + Applies a UTF-8-encoded character value to the active cell editor + + + + + + UTF-8-encoded character applied in the method + + + + + Sets the value for the EditorMode property + + + + + + + + New value for the property + + + + + Changes the cell editor position and value at run-time + + + + + + + + + + Indicates if a cell editor is always displayed for an active cell in the grid + + + The return value is True when editing is allowed for the cell, it is not a fixed cell, and goAlwaysShowEditor is included in the Options property. + + + + + + + + + + + Ensures that row and column positions, and selection(s) are valid for the grid + + + + + + + + + + + + + + + + + + + + Gets the value for LeftCol property + + + + + + Value for the property + + + + + Gets the value for the ColCount property + + + + + + Value for the property + + + + + Gets the value for the ColWidths property + + + + + + Value for the property + + + + Column number to examine in the method + + + + Gets the value for the Columns property + + + + + Value for the property + + + + Gets the value for the DefaultColWidth property + + + + + Value for the property + + + + Gets the value for the DefaultRowHeight property + + + + + Value for the property + + + + Gets the value for the EditorBorderStyle property + + + + + Value for the property + + + + Gets the number of pixels needed for the grid border when used + + + + + + + Number of pixels needed for the grid border + + + + + Gets position and layout information for an image used in the column fixed header cell + + + + + + Column number examined in the method + + + Position of the image used for the column + + + Image layout used for the column + + + + + Gets image information displayed in a column header for a sortable column in the grid + + + GetSortTitleImageInfo is used in the implementation of the methods like TCustomGrid.DrawColumnTitleImage and TCustomStringGrid.AutoAdjustColumn. + + + + + + + + + + + + + + + + + + + + + + + + + Gets the value for the RowCount property + + + + + + + + Value for the property + + + + + Gets the value for the RowHeights property + Returns the current row height + + + + + + + + + + + + + Gets the value for the indexed SelectedRange property + + + + + Value for the property + + + Ordinal position for the grid rectangle + + + + Gets the value for the SelectedRangeCount property + + + + + Value for the property + + + + + Gets the value for the Selection property + + + + + + Value for the property + + + + Gets a cursor for the specified grid cursor state + + + + + TCursor representing the specified cursor state + + + Grid cursor state retrieved in the method + + + + + Gets the value for the TopRow property + + + + + + + + + + + Gets the value for the VisibleRowCount property + + + + + + + + + + + + + + + + + + + + + + Gets the value for the VisibleRowCount property + + + + + + + + Value for the property + + + + + + Performs actions needed to resize one or more columns to fill the client area for the grid control + + +

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

+

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

+

+ InternalAutoFillColumns is called from the UpdateCachedSizes method. +

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

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

+

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

+
+ + + + + + + + + + + +
+ + Object generating the event notification + + + + Reads the Columns collection from the specified TReader class instance + + + + + TReader used to load values during LCL component streaming + + + + + + Reads the list of Integer values in ColWidths from the specified TReader class instance + + + + + + + TReader used to load values during LCL component streaming + + + + + + Reads the list of Integer values in RowHeights using the specified TReader class instance + + + + + + + TReader used to load values during LCL component streaming + + + + + + + + + + + + + + Restores the SavedCursor for the grid, and resets CursorState to its default value + + + + + + + + Saves configuration, layout, and appearance information in Columns to an XML configuration file + + + + + + XML configuration file where the values are written + + + + + + + + Scrolls the grid until the cell at the specified location is visible + + + + + + + + + + + + + + + + + + + + Scrolls the grid until the cell at the specified location is the new origin (top, left) for the grid + + + + + + + + + + + + + + + + + + + + + + + + Sets the value in the Col property + + + + + + + + New value for the property + + + + + Sets the value in the indexed ColWidths property + + + + + + + + Column number for the update width value + + + + New value for the property + + + + Sets the value for the ColRowDragIndicatorColor property + + + + + New value for the property + + + + + Sets the value for the DefColWidth property + + + + + + + + New value for the property + + + + + Sets the value for the DefRowHeight property + + + + + + + + New value for the property + + + + + Sets the value for the DefaultDrawing property + + + + + + + + New value for the property + + + + + Sets the value for the Editor property + + + + + + + + New value for the property + + + + + Sets the value for the FocusColor property + + + + + + + + New value for the property + + + + + Sets the value for the GridLineColor property + + + + + + + + New value for the property + + + + Sets the value for the FixedGridLineColor property + + + + + + + New value for the property + + + + + Sets the value for the GridLineStyle property + + + + + + + + New value for the property + + + + + Sets the value for the GridLineWidth property + + + + + + + + New value for the property + + + + + Sets the value for the LeftCol property + + + + + + + + New value for the property + + + + + Sets the value for the Options property + + + + + + + + New value for the property + + + + Sets the value for the Options2 property + + + + + + + New value for the property + + + + Sets the value for the RangeSelectMode property + + + + + + + New value for the property + + + + + Sets the value for the Row property + + + + + + + + New value for the property + + + + + Sets the value for the RowCount property + + + + + + + + New value for the property + + + + + Sets the value in the indexed RowHeights property + + + + + + Row number affected in the method + + + + New value for the specified row number + + + + + Sets the value for the ScrollBars property + + + + + + + + New value for the property + + + + + Sets the value for the SelectActive property + + + + + + + + New value for the property + + + + + Sets the value for the Selection property + + + + + + + + New value for the property + + + + Sets the value for the indexed cursor state in the grid control + + + + + + + + + + + + + Sets the value for the TopRow property + + + + + + + + New value for the property + + + + + Updates the grid to perform a column sizing operation for the cell at the specified location + + + + + + + + + + + + + + + + Changes the cursor shape to the specified value + + + + + + + + + + + + Cursor shape applied in the method + + + Indicates if the existing cursor shape is stored for later reuse + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Performs actions needed when the size for columns or rows in the grid are adjusted + + + + + + + + Updates the visibility for horizontal and vertical scrollbars + + + + + + + + Updates the Cache information for the grid when visual aspects for columns or rows are changed + + + + + + + + Writes the Columns collection using the specified TWriter instance + + +

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

+ + Not used in the current implementation of TCustomGrid.DefineProperties. + +
+ + + +
+ + TWriter instance used for the class + + + + + + Writes the list of Integers in ColWidths using the specified TWriter instance + + + + + + + TWriter instance used to write the values + + + + + + Writes the list of Integers in RowHeights using the specified TWriter instance + + + + + + + TWriter instance used to write the values + + + + + Handles the Window Message used to erase the background for the control + + + Always returns 1 as the Message result. + + + + + + + Lazarus message applied in the method + + + + + + Handles the Window Message which applies Tab and Arrow keys in dialog boxes and custom controls + + + Examines the Options property for the presence of the goTabs enumeration value. When present, the DLGC_WANTTAB is or'd to the result value in Msg. + + + + + + + + + Lazarus message processed in the method + + + + + + fGridState - local variable to hold current state of the grid (whether being edited, updated etc) + + + + + + + + Gets the positive or negative multiplier used to adjust scroll values for BiDi mode + + + + + + + + + + + + Adds the current selection to the array of rectangles in Selections + + + + + + + Adjusts the client rectangle and sets the grid flag reflecting the change + + + + + + Client rectangle adjusted in the method + + AdjustEditorBounds - method to adjust the editor's bounds to include a new row and column + + + + + + + + + Signals the OnAfterSelection event handler for the grid + + + + + + + + `` + + + + + Stores properties from the current grid class instance in the specified target + + + + + + Grid instance where value are stored + + + + + + AutoAdjustColumn - automatically adjust column properties to accommodate the largest value in the column + + + + + + + Column number adjusted in the method + + + + + + BeforeMoveSelection - method to use before a selection is moved + + +

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

+

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

+

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

+
+ + + + + +
+ + + + + + + + + + + Starts an auto-drag operation in the grid control + +

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

+

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

+
+ + + + + + + + +
+ + + + + + + Not currently used in the grid implementation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CalcAutoSizeColumn - method for automatically calculating the size of a column + + + + + + + + + + + + + + + + + + + + + + + Deprecated + + + + + + + + + + + + + + + + + CalcFocusRect - method for calculating the bounds of a focused rectangle + + + + + + + + + + + + + + + + + Updates the range, page, and thumb position for visible scrollbars + +

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

+

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

+
+ + + + + + + + +
+ + + Gets the preferred width and height for cells in the grid + + Always returns 0 (zero) in the PreferredWidth and PreferredHeight variable arguments. + + + + + + + + + + + + + + + + + CanEditShow - returns True if the editing data can be shown + + + + + + + + + + + + CanGridAcceptKey - returns True is the grid is able to accept the given key + + + + + + + + + + + + + + + + + + + + CellClick - method for processing a click in a cell + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CheckLimits - method for checking limits of specified cell + + + + + + + + + + + + + + + + + CheckLimitsWithError - method for checking limits of specified cell, with error trapping + + + + + + + + + + + + + + Control message posted when the mouse enters a cell in the grid + + + + + + + + + + + CMMouseLeave - Control Message for a mouse leaving a cell + + + + + + + + + + + + ColRowDeleted - method for dealing with deletion of either a column or a row (depending on value of IsCol) + + + + + + + + + + + + + + + + + ColRowExchanged - method for exchanging the current Column or Row (depending on value of IsCol) with the indexed other column or row + + + + + + + + + + + + + + + + + + + + + ColRowInserted - method for dealing with insertion of a column or row (depending on value of + IsCol) + + + + + + + + + + + + + + + + ColRowMoved - the column or row (determined by + IsColumn) is moved from one index to another + + + + + + + + + + + + + + + + + + + + + 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 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Gets the position of the specified column relative to the first column in the grid + + +

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

+

+ ColumnIndexFromGridColumn is used in the implementation of TCustomGrid methods like: +

+
    +
  • ColumnFromGridColumn
  • +
  • DoOPExchangeColRow
  • +
  • DoOPInsertColRow
  • +
  • DoOPMoveColRow
  • +
  • DoOPDeleteColRow
  • +
+
+ + + + + + + +
+ + + Relative position for the specified column + + + + Column number to locate in the grid + + + + + + ColumnFromGridColumn - returns the actual grid column given its index + + + + + + + + + + + + + + + + ColumnsChanged - method for dealing with changed columns + + + + + + + + + + + + ColWidthsChanged - method for dealing with changes in column width + + + + + + + + + CreateColumns - returns the identity of the created columns + + + + + + + + + + + + CheckNewCachedSizes - check the new values of cached sizes + + + + + + + + + + + + + + + + + + + + + + Indicates if the DefaultColWidth is available in component streaming + + + + + + + + + + + Indicates if the DefaultRowHeight is available in component streaming + + + + + + + + + + + + + + + + + Applies an accelerator key to a column in the grid + +

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

+

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

+
+ + + + + + +
+ + + + + Lazarus messaged examined in the method + + + + + + DoCompareCells - perform the comparison of two or more cells in a grid + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DoCopyToClipboard - copy the selected data to the clipboard, leaving the original data in place + + + + + + + + DoCutToClipboard - cut the data from its current site and place it on the clipboard + + + + + + + Performs actions needed when the button for editor control is clicked + + +

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

+

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

+

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

+

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

+
+ + + + + + +
+ + Column number for the affected cell + + + Row number for the affected cell + + + + + + DoEditorHide - hide the data in the editor + + + + + + + + + DoEditorShow - show the data in the editor + + + + + + + + + Signals the OnLoadColumn event handler for the grid control + + + + + + + + + + + + + + + + + + + + + + + + Signals the OnSaveColumn event handler for the grid control + + + + + + + + + + + + + + + + + + + + + + + + Applies mouse wheel options and handles the mouse wheel operation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DoOPDeleteColRow performs the operation for deleting a column or row (depending on value of IsCol) + + + + + + + + + + + + + + + + + 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 + + + + + + + + + + + + + + + + + + + + + DoOPInsertColRow - perform the operation for inserting either a column or a row (depending on the value of IsCol) at the indexed position + + + + + + + + + + + + + + + + + DoOPMoveColRow - performs the operation for moving either a column or a row (depending on the value of IsCol) between FromIndex and ToIndex + + + + + + + + + + + + + + + + + + + + + DoPasteFromClipboard paste the data from the clipboard to the current location + + + + + + + + + DoPrepareCanvas - get the canvas ready for drawing + + + + + + + + + + + + + + + + + + + Performs actions needed when the grid control is resized + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DrawBorder - draws the border of the grid + + + + + + + + + DrawAllRows - draws all of the rows for the grid + + + + + + + + Use FillRect after calc the new rect depend on Right To Left. + + + + + + + + + + + + + + DrawCell - draws a cell at the given grid location (Col, Row) or in the specified Rectangle + + + + + + + + + + + + + + + + + + + + + + + + + DrawCellGrid draws a grid of cells at the specified location + + + + + + + + + + + + + + + + + + + + + + + Draws the text for a non-fixed cell in the grid + + The implementation for DrawTextInCell is empty in TCustomGrid. It is overridden in descendent classes. + + + + + + + + + + + + + + + + + + + Draws a cell using the theme services for the specified grid drawing state + + +

+ DrawThemedCell is a procedure used to draw the cell at the specified coordinates using the theme services for the platform or widget set. DrawThemedCell is used to render fixed header cells in the DefaultDrawCell method. +

+

+ aCol contains the column number for the affected cell. +

+

+ aRow contains the row number for the affected cell. +

+

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

+

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

+ + + + + + + + + + + + + + + + + + + + + +
Grid Draw StateTheme ElementDescription
gdPushedthHeaderItemPressedDraws the cell using the Pressed state
gdHotthHeaderItemHotDraws the cell using the Hotlighted state
Other statesthHeaderItemNormalDraws the cell using the normal drawing state
+
+ + + +
+ + Column number for the affected cell + + + Row number for the affected cell + + + Screen coordinates for the cell + + + Grid drawing state for the cell + + + + + + DrawCellText - draws the given text string in the cell specified by Col, Row or by Rectangle + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DrawGridCheckboxBitmaps - draws checkbox bitmaps in the nominated rectangle with the specified checkbox state + + + + + + + + + + + + + + + + + Draws a cell using theme servies for button styles + + + + + + + + + + + + + + + + + + Draws a column or row when dragging is in effect + + + + + + + + DrawColumnText - draw the text of the specified column + + + + + + + + + + + + + + + + + + + + + DrawColumnTitleImage - draw the title image of the specified column - - - EditingAllowed - Returns true if grid and current column allow editing + + + + + + + + Draws the edges for the grid control + + + + + + + + DrawFocusRect - draw a rectangle with focus in the nominated cell + + + + + + + + + + + + + + + + + + + + + DrawRow - draws the specified row + + + + + + + + + + + + + EditButtonClicked - calls OnEditButtonClick + + + + + + + + + + + + + EditordoGetValue - method for getting a value in the Editor + + + + + + + Resets the value in the cell when the cell editor is cancelled or hidden + + + + + + + + EditordoSetValue - method for specifying a value in the Editor + + + + + + + + + EditorCanAcceptKey - returns True if the Editor is able to accept the nominated (UTF8) key + + + + + + + + + + + + + + + + + EditorIsReadOnly - returns True if the Editor has Read Only status + + + + + + + + + + + Hides a visible cell editor in the grid control + + + + + + + + EditorLocked - returns True if the Editor is locked, i.e. unable to accept input or make changes + + + + + + + + + + + + + Returns True if both the grid and the current column allow editing. + + + + + + + + + + + + Selects the entire content in the cell when a cell editor is active + + + + + + + Displays and enables the cell editor for the selected cell, and optionally selects all content in the cell + + + + + + + Indicates if the entire content in the cell is selected in its cell editor + + + + + + + EditorShowInCell - shows the Editor's content + in situ in the Cell + + + + + + + + + + + + + + + + + EditorWidthChanged - method for dealing with a change in editor width + + + + + + + + + + + + + + + Gets the position of the first column after any fixed columns in the grid + +

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

+

+ FirstGridColumn is used in the implementation of methods including: +

+
    +
  • GetColWidths
  • +
  • GetIsCellTitle
  • +
  • ColumnIndexFromGridColumn
  • +
  • GridColumnFromColumnIndex
  • +
  • ColumnsChanged
  • +
+
+ + + + + + + + +
+ + Position of the first column after any fixed columns in the grid + + + + + + FixedGrid - returns True if the Grid is fixed + + + + + + + + + + + + + FontChanged - method to deal with a change in font + + + + + + + + + + + + + GetAutoFillColumnInfo - finds out information (max, min, priority) about the auto-fill properties of the indexed column + + + + + + + + + + + + + + + + + + + + + + + + Gets the hint for the specified cell using the Options enabled in the grid control + + + + + + + + + + + + + + + + Gets the cell content at the specified column and row numbers + + Always returns an empty string ('') in TCustomGrid. Overridden in descendent classes. + + + + + + + + + + + + + + + + + GetColumnAlignment - returns the Alignment value for the nominated column + + + + + + + + + + + + + + + + + + + + + GetColumnColor - returns the Color for the specified column + + + + + + + + + + + + + + + + + + + + + GetColumnFont - returns the font for the specified column + + + + + + + + + + + + + + + + + + + + + GetColumnLayout - returns the Text Layout value for the specified column + + + + + + + + + + + + + + + + + + + + + GetColumnReadonly - returns True if the column is marked ReadOnly + + + + + + + + + + + + + + + + + GetColumnTitle - returns the column title string + + + + + + + + + + + + + + + + GetColumnWidth - returns the width of the column + + + + + + + + + + + + + + + + + GetDeltaMoveNext return the relative cell coordinate of the next cell to which movement will occur + + + + + + + + + + + + + + + + + + + + + + + + + GetDefaultColumnAlignment - returns the default alignment for the specified column + + + + + + + + + + + + + + + + + GetDefaultColumnWidth - returns the default width for the specified column + + + + + + + + + + + + + + + + + GetDefaultColumnLayout - returns the default text layout for the nominated column + + + + + + + + + + + + + + + + + GetDefaultColumnReadOnly - returns the default setting of the ReadOnly flag for the specified column + + + + + + + + + + + + + + + + + GetDefaultColumnTitle - returns the default title string for the specified column + + + + + + + + + + + + + + + + + GetDefaultEditor - returns the default cell editor for the specified column + + + + + + + + + + + + + + + + + GetDefaultRowHeight - returns the default row height + + + + + + + + + + + + Gets the grid drawing state for the cell with the specified column and row numbers + + + + + + + + + + + + + + + + + Gets the bitmap used to draw Checkbox columns in the grid + + +

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

+

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

+
+ + + + + + +
+ + Column number for the Checkbox cell + + + Row number for the Checkbox cell + + + Checkbox state for the cell + + + Image list with images used for Checkbox drawing states + + + Ordinbal position of the image used for the corresponding Checkbox state + + + Bitmap with the image drawn for the Checkbox state + + + + + + GetScrollBarPosition - returns the position of the scroll bar specified by + Which + + + + + + + + + + + + + + + Checks for the smooth scroll setting in the Options for the grid + + + + + True when Options contains the value goSmoothScroll + + + + Indicates the scrollbar checked in the method; not used in the current implementation + + + + + + + GetSBVisibility - finds the values of the visibility flags for the scrollbars + + + + + + + + + + + + + + + + + GetSBRanges - finds the range of values for the scrollbars when visible + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + GetEditMask - returns the edit mask string for the specified cell + + + + + + + + + + + + + + + + + + + + + GetEditText - returns the Edit text string for the specified cell + + + + + + + + + + + + + + + + + + + + + GetFixedcolor - returns a value for the fixed color + + + + + + + + + + + Gets the position for the first visible non-fixed column in the grid + + + + + Column number for the first visible column + + + + Gets the position for the first visible non-fixed row in the grid + + + + + Row number for the first visible row + + + + Gets the position for the last visible non-fixed column in the grid + + + + + Position for the last visible column in the grid + + + + Gets position for the last visible non-fixed row in the grid + + + + + Row number for the last visible non-fixed row + + + + + + GetSelectedColor - returns the value for the color of items that have been selected + + + + + + + + + + + Gets the prefix option for titles in the specifiefd column number + + + + + Truw when the TGridColumn is configured to use prefixes + + + Column number examined in the method + + + + + + + + + + + + + + Gets the truncated version of a hint for the cell at the specified position + + + + + + + + + + + + + + + + + + GridColumnFromColumnIndex - returns the number of the column given its column index + + + + + + + + + + + + + + + Performs actions needed when the mouse wheel is scrolled in the grid + + + + + + + Shift state modifier in effect for the action + + + Relative change in the current position for the action + + + + + + HeaderClick - method to deal with a click on the column (if IsColumn is True) or row Header + + + + + + + + + + + + + + + + + HeaderSized - method to deal with re-sizing of a column (IsColumn True) or row header + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Cancels the current hint display and restores the saved hint for the grid + + + + + + + + InternalSetColCount - specify the column count + + + + + + + + + + + + + InvalidateGrid - render the whole grid non-valid + + + + + + + + InvalidateFocused - render the focused item non-valid + + + + + + + + Indicates if the specified index position is valid for the columns in the grid + + + + + + True when Index is in range for the column definitions in the grid + + + Index position examined in the method + + + + + Indicates if the specified index position is valid for the rows in the grid + + + + + + True when Index is in range for the rows in the grid + + + Index position examined in the method + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Indicates if the cell at the specified position is a fixed header for a row or column + + + + + + + + + + + + + + + + + + GetIsCellSelected - returns True if the given cell is selected + + + + + + + + + + + + + + + + + + + Indicates if the row at the specified position contains empty cells + + + + + + + + + True when all cells in the specified row contain empty strings ('') + + + Row number to examine in the method + + + + + Indicates if the specified mouse position is over a button in a cell editor + + + + + + + + + Screen coordinates for the mouse pointer + + + Screen coordinates for the mouse pointer + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LoadContent - method to load a configuration + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LockEditor - lock the editor so that it will not accept input or changes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + MoveExtend - move an extended selection; if Relative is true, use Delta column and row to find position; returns True if successful + + + + + + + + + + + + + + + + + + + + + + + + + MoveNextAuto - move to next cell in automatic sequence; if Relative is True, use delta col and row to find position; returns True if successful + + + + + + + + + + + + + + + + + MoveNextSelectable - move to next selectable cell; use delta col and row if + Relative is True; returns True if successful + + + + + + + + + + + + + + + + + + + + + + + + + MoveSelection - moves the selected text, cell or group of cells + + + + + + + + + OffsetToColRow - move by the value of Offset to another column or row (determined by the value of IsCol), returning True if successful + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + PickListItemSelected - indicates that an item was selected from the pick-list + + + + + + + + + + + + PrepareCanvas - method to get the canvas ready for drawing at the specified location + + + + + + + + + + + + + + + + + + + + + + + Current implementation is empty. + + + + + + + + + + + Restores the default width for columns in the grid + +

+ ResetDefaultColWidths updates an internal member with the list of column widths currently in use for the grid. ResetDefaultColWidths calls the VisualChange method after resetting the column widths to their default value. No actions are performed in the method when AutoFillColumns contains True. +

+
+ + + + +
+ + + + + ResetEditor - resets the current editor for the grid + + + + + + + Resets the member used to track the last row or column movement + + + + + + + + ResetOffset - resets the offset, checking columns and rows if demanded + + + + + + + + + + + + + + + + + ResetSizes - resets the sizes + + + + + + + + + ResizeColumn - resizes the nominated column to the specified width + + + + + + + + + + + + + + + + + ResizeRow - resizes the nominated row to the specified height + + + + + + + + + + + + + + + + + RowHeightsChanged - method invoked when row heights are changes + + + + + + + + + SaveContent as specified in the XML configuration variable + + + + + + + + + + + Saves grid options to the specified XML configuration file + +

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

+

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

+
+ + + + + + + + + +
+ + XML configuration file where values are stored + + + + + + ScrollBarRange - specify the range of the scrollbar; + Which determines whether it is horizontal or vertical + + + + + + + + + + + + + + + + + + + + + ScrollBarPosition - records the position (Value) of the scrollbar; Which determines horizontal or vertical + + + + + + + + + + + + + + + + + ScrollBarIsVisible - Returns True if visible; + Which determines whether horizontal or vertical + + + + + + + + + + + + + + + + + ScrollBarPage - a Page movement of the scrollbar (specified by + Which) + + + + + + + + + + + + + + + + ScrollBarShow method + +

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

+

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

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

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

+

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

+
+ + + + + + +
+ + Scrollbar(s) affected in the method + + + True indicates the scrollbar(s) are visible + + + + + + + Check if scrollbars are shown automatically by the grid or not. + 'Which' can be any of : SB_BOTH, SB_VERT, SB_HORZ + + + + + + + + + + + + + + + + + + + + + + + + + + SelectEditor - chooses the cell editor for the current cell + + + + + + + + Is called if a grid cell is highlighted. + +

+ The SelectCell method is called if a grid cell will be highlighted. +

+

+ The aCol and aRow parameters contain the column and the row of the highlighted cell. +

+

+ Component developers may use the SelectCell method to react to focus changes. The Result is true if the cell can be selected. Application developers should use the OnSelectCell event instead. +

+
+
+ + + + + + + + + + + + + + + + + SetCanvasFont to specified value + + + + + + + + + + + Sets the value in the ColCount property + + + + + + + New value for the property + + + + + + Sets the value in the Color property + + + + + + + + + New value for the property + + + + + + SetColRow - specifies the column and row for addressing + + + + + + + + + + + + + + + Changes the cursor shape in the grid to the specified value + + + + + + + + + + + + + SetEditText - specifies the text-string to be placed in the Editor for processing + + + + + + + + + + + + + + + + + + + + + SetBorderStyle - specifies a new border style + + + + + + + + + + + + + SetFixedcolor - specifies color for fixed cells + + + + + + + + + + + Sets the value for the FixedCols property + + + + + + + New value for the property + + + + Sets the value for the FixedRows property + + + + + + + New value for the property + + + + Sets column widths during LCL component streaming + + + + + + + + + + + + + + SetSelectedColor - specifies color for cells that have been selected + + + + + + + + + + + Gets and displays the cell hint(s) for the current cell in the grid + +

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

+

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

+

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

+
+ + + + + + + +
+ + Screen coordinates for the mouse pointer + + + + + + SizeChanged - specifies the old number of columns and rows + + + + + + + + + + + + + + + + Sorts rows or columns in the grid + +

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

+
+ +
+ + + Indicates if the sort is performed for a column instead of a row + + + + + + + + + + + + + + + + + + + + + + + + TopLeftChanged - the top left cell has changed + + + + + + + + TryMoveSelection - attempts to move the selection by the specified offset; returns True if successful + + + + + + + + + + + + + + + + + + + + + + + + UnLockEditor - frees a previously locked Editor + + + + + + + + + + + Current implementation is empty in TCustomGrid. + + + + + + + UpdateHorzScrollBar - updates the scrollbar in the given range by the given page, if it is visible + + + + + + + + + + + + + + + + + + + Updates the selection range when the cell selection or other visual aspects of the grid are changed + + + + + + + + + UpdateVertScrollbar - updates the scrollbar in the given range by the given page, if it is visible + + + + + + + + + + + + + + + + + + + + UpdateBorderStyle - brings the border style up to date + + + + + + + + +

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

+

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

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

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

+

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

+
+ + + + + + +
+ + + + + + + + + + + + + + WMHScroll - system message for horizontal scrolling + + + + + + + + + + + + WMVScroll - system message for vertical scrolling + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AllowOutboundEvents - permits mouse click on an imaginary (out-of-bounds) cell; moves cursor to nearest valid cell + + +

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

+

+ Default value is True, as this has been the grid's behavior since the beginning. +

+

+ This was added to simulate Delphi behavior where outbound events are not available; to enable Delphi compatibility set this to False. +

+
+ +
+ + + + + The color to be used for the background on alternate rows of the grid. Having alternate rows in different colors can make the grid easier to read. + + + + + + + + + Automatically advance down the grid on successive mouse clicks or presses of the ENTER or TAB key + + + + + + Whether the Edit mode is automatically entered when a cell is selected + + + + + + + Automatically resize columns so they fill all grid's visible area + +

+ When this option is turned on, the grid will resize all columns to fill the grid's client width. What columns are resized is determined by the following conditions: +

+
    +
  1. Fixed Columns are not resized.
  2. +
  3. + If the grid has Custom Columns, all columns with SizePriority set to 0 are not resized. +
  4. +
+

+ Note that Custom Columns are initially created with SizePriority=1. For TDbGrid, which automatically adds Custom Columns, this means the user will not be able to resize such columns using the mouse. +

+
+
+ + + + + Only a restricted series of options is available: none or a single border. + + + + + + + The color of the border for this control + + + + + + Identifies how text is combined to form the Hint property + +

+ CellHintPriority is a TCellHintPriority that identifies how text is combined to form the Hint property. The default value for the is chpAllNoDefault. See for a description of the enumeration values and their meanings. +

+

+ CellHintPriority is used in the implementation of the ShowCellHintWindow, MouseMove, and GetTruncCellHintText methods. +

+
+ + + + + + +
+ + + + Current column index. + + Col is an Integer which holds the column index of the current grid cell cursor. The current grid column can be changed programmatically by setting a new value to this property. + + + + + + Number of columns of the grid. + +

+ ColCount is an Integer that represents the number of columns in the grid, including fixed and normal columns. Changing the value in ColCount after Columns have been created causes an EGridException to be raised. Use the Columns to add or delete columns defined in the grid. +

+

+ Use FixedColCount for the number of fixed columns in the grid. +

+

+ Use VisibleColCount for the number of non-fixed columns in the grid. +

+

+ Use RowCount, FixedRowCount, and VisibleRowCount to access the row-oriented equivalents. +

+
+ + Raises an EGridException when the value is changed and Columns already exist in the grid. + + + + + + + + + + +
+ + + + Provides access to current column and row numbers as a TPoint instance + + +

+ ColRow is a TPoint used to provide access to the current values in Col and Row as a TPoint instance. The X member in TPoint is used for the value in the Col property. The Y member in TPoint is used for the value in the Row property. +

+

+ Setting the value for the causes the CheckLimitsWithError method to be called for the X and Y values when AllowOutboundEvents is False. The SetColRow method is called to update the values in the Col and Row properties. +

+
+ + + + + + + +
+ + + Cursor shape displayed when a column is dragged or moved + + + + + + + Color used to render the indicator drawn when a column or row is dragged in the grid + + + + + + + Cursor shape displayed when a column is resized + + + + + + Indicates if clicking a column header changes its sort order + +

+ ColumnClickSorts is a Boolean used to indicate if clicking a column header changes its sort order. The default value for the is False. +

+

+ ColumnClickSorts is used in the HeaderClick method to determine if the value in the SortOrder is toggled for a click in the header cell for SortColumn. +

+
+ + + + + +
+ + + + The properties of the columns in this grid + +

+ Columns is a TGridColumns used to represent column definitions for the grid control. Columns contains the TGridColumn instances which define the attributes for the column such as its size, shape, color, etc. +

+

+ Columns should not be confused with the COLUMNS construct frequently used in SQL programming, which refer to Fields of data. The contents of Fields can be displayed as Columns in a Grid, but they must be seen as separate and distinct. It is irrelevant to refer to the color, font or width of a data field from a database, but these are all very relevant in specifying the appearance of a column in a grid. +

+
+ + + +
+ + + + Column widths for the grid. + +

+ The column is specified with the aCol parameter. The aCol parameter must fall within the valid index range of 0 to ColCount-1. +

+

+ The return value of the is the width of this column, measured in pixels. +

+

+ The initial width of a newly created column is specified with the DefaultColWidth property. After that the user may redefine this value. +

+

+ If the Options includes the appropriate option value, the column width may also be changed by the user at run-time. +

+
+ + + + + + + +
+ + + + + + + + Default value for the width of newly created grid columns. + +

+ If new columns of the grid are created by changing the ColCount property, the width of these new columns will be set to the value of the DefaultColWidth property. +

+

+ Use 0 for auto-sized width. +

+

+ Use GetRealDefaultColWidth for real value. +

+
+ + + +
+ + + + Default value for the height of newly created grid rows. + +

+ If new rows of the grid are created by changing the RowCount property, the height of these new rows will be set to the value of the DefaultRowHeight property. +

+

+ Use 0 for auto-sized height. +

+

+ Use GetRealDefaultRowHeight for real value. +

+
+ + + +
+ + + + Is the default drawing method to be used for this grid? Default is TRUE + + + + + + + Default style for displaying text - includes alignment, layout, single or multi-lines + + + + Color used to draw text in the grid when the Enabled is False + + + + + + + + DragDx - the amount (DeltaX) by which an object should be dragged + + + + + + + The editor to be used for modifying information in the cells of the grid + + + + + + + The border style for the editor used in this grid + + + + + + + Is grid ready to accept edits? (EditorMode True) + + + + + + EditorKey - is the current key available to the editor? + + + + + + + The set of options available for the grid's editor + + + + + + + Is the editor for the grid displayed? + + + + + + + + ExtendedColSizing - the sizing to be used for extended columns + + + + + + + + ExtendedRowSizing - the sizing to be used for extended rows + + + + + + + + + ExtendedSelect - the ability to select cells beyond the boundary of the visible part of the grid + + + + + + + Indicates if fast editing is used in the grid + +

+ FastEditing is a Boolean which indicates if cell editing initialized by a KeyDown message instead of a navigation key is used in the grid control. The value in FastEditing is used when TPickListCellEditor handles KeyDown messages. +

+

+ The default value for the is True as assigned in the Create constructor. +

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

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

+

+ Using a different color for the background of alternate rows often makes the data in a grid much easier to read. +

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

Contains the fixed column count of a grid.

+

Fixed columns are normally used for headings.

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

Contains the fixed row count of a grid.

+

Fixed rows are normally used for headings.

+
+ + + + +
+ + + + The color for the fixed cells of the grid. + The color used by headings. + + + + + + + + Color used to draw lines around fixed grid cells + +

+ The default value for the is cl3DDKShadow as asssigned in the constructor. Changing the value in FixedGridLineColor causes the grid to be redrawn. The color is not used when GridLineWidth contains the value 0 (zero). +

+

+ FixedGridLineColor is used in the implementation of the DrawCellGrid method. +

+
+ + + + +
+ + + + + FixedHotColor - the 'Hot' color for the active (selected, etc) fixed cells of the grid + + + + + + + + + Is the cell to be displayed Flat, i.e. with no texturing or raised/lowered effect + + + + + + + + The color to be used for the cell receiving focus + + + + + + + + FocusRectVisible - is the rectangle receiving focus visible? + + + + + + + + GCache - the cache to be used for grid data + + + + + + + + GridFlags - the flags that are set for the grid + + + + + + + + GridHeight - the height of the grid + + + + + + + Color to be used for GridLines + + + + + Style to be used for GridLines + + + + + Width (thickness) of GridLines + + + + + Width of the whole Grid + + + + + + HeaderHotZones - the zones of the header that are under the cursor, so are capable of being selected or pushed (or not!) + + + + + + + + HeaderPushZones - the zones of the header that have been selected by the cursor, or pushed + + + + + + + + + + Not used in the current implementation. ??? + + + + + + + + + Not used in the current implementation. ??? + + + + + Stores the behavior for Tab navigation used in the grid control + +

+ TabAdvance is a TAutoAdvance used to determine the behavior for Tab navigation is used in the grid control. The default value for the is aaRightDown. See TAutoAdvance for the values and their usage. +

+

+ TabAdvance is used in the implementation of the KeyDown method in TCustomGrid. +

+
+ + + + +
+ + + + TitleImageList - the list of images to be used with the titles + + + + + + + + Stores the default width for images used in the title area for fixed cells + + +

+ TitleImageListWidth is an Integer which stores the default width for images used in the title area for fixed cells. The default value for the is 0. Changing the value in TitleImageListWidth causes the VisualChange method to be called to update the grid control. +

+

+ The value in TitleImageListWidth is used in methods which draw fixed cells in the grid, such as: +

+
    +
  • DrawColumnTitleImage
  • +
  • GetSortTitleImageInfo
  • +
  • AutoAdjustColumn
  • +
+
+ + + + + +
+ + + + + InplaceEditor - the editor to be used in-place, i.e. in the cell itself instead of outside the grid + + + + + + + + IsCellSelected - is the cell specified by + aCol, aRow selected? + + + + + + + + + + + + + + + + + + + + LeftCol - the left-most column + + + + + + Sets the mouse wheel behavior for the grid control + +

+ MouseWheelOption is a TMouseWheelOption used to set the mouse wheel behavior for the grid control. The default value for the is mwCursor, and indicates that mouse wheel movements change the cursor position on the screen. Use mwGrid to cause mouse wheel movements to change the active selection in the grid control. +

+
+ + + + +
+ + + + + Contains the set of optional features and/or behaviors enabled for the grid + + +

+ Options is a TGridOptions used to store the options enabled for the grid control. Values from the TGridOptions enumeration are included in the set type to enable the features or behaviors. For a list of available options and their usage, see. +

+

+ The default value for the Options is the DefaultGridOptions set. +

+

+ Use Options2 to set scrolling behaviors enabled for the grid control. +

+
+ + + + + +
+ + + Contains additional options enabled for the grid control + + + + + + Controls the range selection mode used for the grid + +

+ RangeSelectMode is a TRangeSelectMode that controls the range selection mode used for the grid. The default value for the is rsmSingle, and allows selection of a single cell in a range. Use rsmMulti to select multiple cells in a range selection. +

+

+ Changing the value in RangeSelectMode causes the ClearSelections method be called to remove existing selection(s) in the grid control. +

+

+ RangeSelectMode is used in the implementation of methods like: +

+
    +
  • AddSelectedRange
  • +
  • GetIsCellSelected
  • +
  • MouseDown
  • +
  • InvalidateCell
  • +
+
+ + + + + + + + +
+ + + + The current Row (record) within the grid + + + + + + + Number of rows in the grid + This is the number of rows in the grid, including fixed and normal rows. + + + + + + + + + Cursor shape displayed when the row height is changed + + + + + + + The row heights for the grid. + +

+ The row is specified with the aRow parameter. The aRow parameter must fall within the valid index range of 0 to RowCount-1. +

+

+ The return value of the is the height of this row, measured in pixels. +

+

+ The initial height of a newly created row is specified with the DefaultRowHeight property. After that the user may redefine this value. If the Options includes the appropriate value, the row height may also be changed by the user at run-time. +

+
+ + + + + +
+ + + Row number affected in the method + + + + + + The set of options for saving information from the grid (design, attributes, content or position) + + + These options are used when saving grid information, but also when loading grid information. + + + + + + + + + + + SelectActive - if True, the current active cell is selected + + + + + + + Color to be used for selected cells + + + + + The column (field) currently selected + + + + + + + The current selection (rows and columns) in the grid + + + + + + + The ScrollBars to be used with this grid + + + + + + + + StrictSort - is strict sorting to be used? + + + + + + + The font to be used in the grid's title + + + + + + + The style to be used for the grid's title + + + + + + + The first row (record) in the grid + + + + + + + + UseXORFeatures: When True, the dotted focus rectangle is painted using the XOR raster operation + + +

+ This controls how the dotted focus rectangle appears in the grid. When True, the rectangle is painted using an XOR raster operation. This allows the focus rectangle to be seen regardless of the cell background color. When False, the user can control the color of the dotted focus rectangle using the FocusColor property. +

+

+ It also controls the look of column/row resizing operations. When True, a line shows visually the size that the the column or row will have if the user ends the operation. When False, the column or row resizing takes effect as the user drags the mouse. +

+
+ +
+ + + + Controls whether validation is performed when the text for the selected cell is changed + + +

+ ValidateOnSetSelection is a Boolean property used to control validation performed when the text for the selected cell is changed in the grid. The default value for ValidateOnSetSelection is False, as assigned in the constructor for the class. +

+

+ ValidateOnSetSelection is used in the SelectionSetText method to determine if the ValidateEntry method is called to validate the content in the cell. +

+
+ + + + + +
+ + + + The number of visible columns + + + + + + + The number of visible rows + + + + + + Event handler signalled after a new cell has been selected in the grid + + + + + + + + OnBeforeSelection - event handler for use before a selection is made + + + + + + Event handler signalled when the value for a Checkbox cell is toggled + + + + + + + Event handler for comparing the contents of grid cells + + + + + + + Event handler to prepare the Canvas for drawing + + + + + + + Event handler for drawing a cell + + + + + + + Event handler for when the Edit button is clicked + + + + + + Event handler signalled when a button for a column is clicked in the grid + + + + + + + Event handler for selecting an item from a picklist (e.g. drop-down list in TComboBox) + + + + + + + + Event handler for when an area of a grid (one or a group of cells) is selected + + +

+ The Col and Row parameters contain the column and the row of the highlighted cell. +

+

+ Application developers can use the OnSelection and OnBeforeSelection events to react to focus changes. Component developers should use the ??? method instead. +

+
+
+ + + + Event handler signalled to select a cell editor + + + + + + + + Event handler signalled when the top left cell is changed (i.e. the grid has been scrolled so that a different cell occupies top left) + + + + + + + + OnUserCheckboxBitmap - event handler for a user accessing a checkbox bitmap + + + + + + + + Event handler signalled to get an image from an image list used for Checkbox cells + + + + + + + + Event handler used to perform validation for cells + +

+ OnValidateEntry is a TValidateEntryEvent which implements the event handler signalled to perform validation for cells in the ValidateEntry method. +

+
+ + + +
+ + + Flips coordinates in the rectangle when BiDi or RTL alignment is used + + + + + + + + + + + + Flips coordinates in the point when BiDi or RTL alignment is used + + + + + + + + + + + + + Flips the horizontal position in the client rectangle when BiDi or RTL alignment is used + + + + + + + + + + + + + Gets the individual hint for each cell + + OnGetCellHint is a TGetCellHintEvent with the event handler signalled to get the hint for cells in the grid control. OnGetCellHint is signalled when the enumeration value is included in the property. + + + + + + + + + Event handler signalled when a column is saved + + + + + + + + Event handler signalled when a column is loaded + + + + + + + + Constructor for the class instance + + +

+ Create is the constructor for TCustomGrid. Create calls the inherited Create method, allocates the lists with columns and rows, initializes many visual properties and options, creates the various cell editors, and loads any bitmaps required for the display. +

+ + The inherited method calls SetBounds and VisualChange, so the grid needs to be fully instantiated before it is called. + +
+ + TCustomControl.Create + +
+ + + + + + + + + Destructor for the class instance + + +

+ Destroy is the destructor for TCustomGrid. Destroy frees various resources including editors, columns, rows, and fonts. It calls the inherited Destroy method. +

+
+ + TCustomControl.Destroy + +
+ + + + + + + + Adjusts the cell rectangle to account for lines drawn around a cell + + + + + + Cell rectangle adjusted in the method + + + + + + AutoAdjustColumns - automatically adjust the columns according to the size of their contents. + + + + + + + + Begins an update to the grid + +

+ BeginUpdate is a procedure used to start an update to the layout or content in a grid control. BeginUpdate increments an internal member used to prevent nested calls to the method. The protection remains in effect until the EndUpdate method is called. BeginUpdate is used in the implementation of methods that alter the physical appearance of the grid. +

+
+ + + + +
+ + + + + The coordinates for the current cell (column, row) expressed as a standard rectangle (TRect) + + + + + + + + + + + + + + + + + + + + Convert the coordinates of the current cell (col, row) to a grid zone + + + + + + + + + + + + + + + + + + + Check the position of the cursor + + + + + + Clears the cached fixed columns and column count in the grid control + + + + + + + + + + + Clears the cached fixed rows and row count in the grid control + + + + + + + + + + + + + Clear all cells from the grid. + +

+ Reset Column and Row counts to 0. Grid is completely emptied. +

+

+ Compatibility: This applies to Lazarus grids only , under Delphi/Kylix a grid can't be completely emptied. +

+
+
+ + + + Clears the current range selection(s) and invalidates the grid control + + + + + + + + + + + Select a cell editor control with the specified style + + + + + + + + + + + + + + + Emulate the OnKeyDown event handler in the cell editor + + + + + + + + + + + + + + + + + + + Emulate the OnKeyPress event handler in the cell editor + + + + + + + + + + + + + + + Emulate the OnKeyUp event handler in the cell editor + + + + + + + + + + + + + + + + + + Updates the grid control when the value in a cell editor is changed + + + + + + + + + + Column number for the modified cell + + + Row number for the modified cell + + + New value for the cell + + + + + + EndUpdate - Finish updating the grid + + + + + + + + + + + + + + + Clear the background for the grid control + + + + + + Device context for the drawing operation + + + + + Indicates if the grid is focused or has an active focused cell editor + + + + + + + + + + + Indicates if multi-select range selection mode is enabled and in use for the grid + + +

+ HasMultiSelection is a Boolean function used to determine if multi-select range selection mode is enabled and in use for the grid. The return value is True when Options includes the value goRangeSelect, RangeSelectMode contains rsmMulti, and Selections contains selection cell rectangles. +

+
+ + + + + + + +
+ + + True when multi-select range selection mode is enabled and in use for the grid + + + + + + + InvalidateCell - renders a cell invalid, and redraws if required + + + + + + + + + + + + + + + + + + + + InvalidateFromCol - renders the grid invalid from the specified column onwards + + + + + + + + + + + + + InvalidateRange - renders a range of the grid invalid + + + + + + + + + + + Invalidates the drawing rectangle for the specified row number + + + + + Row number affected in the method + + + + + Finds out whether a particular cell is visible + + + + + + + + + + + + + + + + + + Determines if the specified cell is a visible fixed cell in the grid + + + + + + + + + + + + + + + + Load the grid data from a file with the specified name + Note that the SaveOptions determines what information is loaded. + + + + + + + + File name with the content loaded in the method + + + + Loads the content for the grid from the specified stream + + + + + TStream instance with values loaded in the method + + + + + Find the mouse coordinates relative to the grid origin + + + + + + + + + + + + + + + + + + + Convert mouse coordinates to the position of a cell in the grid + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Convert mouse coordinates to the position of a logical cell in the grid + + + + + + + + + + + + + + + + MouseToGridZone - convert mouse coordinates to a grid zone + + + + + + + + + + + + + + + + + + + + + + + Save the data in the grid to a file with specified name + Note that the SaveOptions determines what information is saved. + + + + + + + + + + + + Saves information for the grid to the specified stream + +

+ SaveToStream is a virtual procedure used to store information for the grid control in the TStream instance specified in AStream. SaveToStream creates a TXMLConfig class instance that is used to capture the layout, cell display settings, grid options, and range selections for the control. +

+

+ SaveToStream calls the SaveContent method to generate the XML content for the grid control. The XML content is written to AStream using the WriteToStream method in TXMLConfig. +

+

+ Use LoadFromStream to read the grid information stored in the stream. +

+
+ + + + + + + + + +
+ + TStream instance where grid information is stored + + + + + Sets focus to the grid control + +

+ SetFocus is an overridden procedure used to make the grid control the currently focused control. SetFocus ensures that pending Tab key navigation for an active cell editor is handled properly. If an Editor is both available and visible, it calls its SetFocus method. Otherwise, the grid control becomes the focused control. +

+
+ +
+ + + Current cursor state for the grid control + +

+ CursorState is a read-only TGridCursorState property which contains the current cursor state or shape for the grid control. The value in CursorState is updated when methods are called which perform resizing or moving/dragging for columns and rows. +

+

+ Use the ColRowDraggingCursor, ColSizingCursor, or RowSizingCursor properties to read or write the cursor shapes used for the corresponding actions. +

+

+ Use RestoreCursor to set the cursor to its default value. +

+
+ + + +
+ + + + Provides indexed access to TGridRect values in the currently selected range + + +

+ SelectedRange is a read-only indexed TGridRect property used to get the cell rectangles in Selections for the grid control. SelectedRange is applicable when multi-select range mode has been enabled in the RangeSelectMode property. Otherwise, the current cell selection at Col and Row is returned as the selected range value. +

+

+ Use SelectedRangeCount to get the number TGridRect instances in SelectedRange. +

+

+ Use AddSelectedRange to add the current cell selection to the multi-select range in Selections. +

+

+ Use ClearSelections to remove the cell rectangles stored in Selections. +

+
+ + + + + + + + + +
+ + + Number of cell rectangles in the current selected range + + + + + + + + + + + Order of sorting - ascending or descending + + + + + + + + Column position used to sort the rows in the grid + +

+ SortColumn is a read-only Integer that contains the column position used to sort content rows in the grid. SortColumn is used in the HeaderClick method to determine if the click occurred on the fixed header cell represented by the property. It is also used in the DrawColumnTitleImage method if the header cell needs to render an image representing the current sort order. +

+
+ + + + +
+ + + + Handles IME Composition start messages + Defined for Windows platforms only. + + + + + + + + Handles IME Composition messages + Defined for Windows platforms only. + + + + + + + + + Specifies an event handler used to get edit values or masks in a grid + + TGetEditEvent is an object procedure type used for event handlers which get edit values or masks in a grid control. TGetEditEvent is the type used for the OnGetEditMask and OnGetEditText event handlers in TCustomDrawGrid. + + + + + + + + + Object for the event notification + + + + Column number for the notification + + + + Row number for the notification + + + + Value returned from the event handler + + + + + Specifies an event handler used to set the value for edit text in a grid + + + + + + Object for the event notification + + + + Column number for the notification + + + + Row number for the notification + + + + Value applied to the specified cell in the event handler + + + + + Specifies an event handler signalled to get the state for a Checkbox cell in a grid + + + + + + + + + + + + + + + + + + + + Specifies an event handler signalled to set the state for a Checkbox cell in a grid + + + + + + + + + + + + + + + + + + + + + Base class for custom drawn grids + + +

+ TCustomDrawGrid is a TCustomGrid descendant used as the base class for custom drawn grids including TDrawGrid and TStringGrid. TCustomDrawGrid provides overridden methods needed to work with cells using the TVirtualGrid class instance in the Grid property. Applications should not create instance of TCustomDrawGrid; use of the descendent classes like TDrawGrid or TStringGrid. +

+
+ + + +
+ + + + + + + + + + + + + + + FGrid - local variable holding a virtual grid on which to work + + + + + + + + + CalcCellExtent - calculate the dimensions required for the cell specified by the aCol and aRow arguments + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CreateVirtualGrid - returns the created virtual grid + + + + + + + + + + + + + + + + + + + + + + + + + + + DrawCellAutonumbering - draws a cell using auto numbering + + + + + + + + + + + + + + + + + + + + + + + + DrawFocusRect - draws the rectangle currently receiving focus + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + NotifyColRowChange tells the system that a column or row has been changed (determined by IsColumn) and whether this was an Insert + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create - constructor for TCustomDrawGrid. Attaches a virtual grid then calls inherited Create + + + + TCustomGrid.Create + + + + + Owner of the grid control + + + + + + Destroy - destructor for TCustomDrawGrid. Frees the grid then calls inherited Destroy + + + + TCustomGrid.Destroy + + + + + + + Delete either a column or a row (specified by index), depending on the value of the Boolean IsColumn + + + + + + + + + + + + + + + + + Exchange either a column or a row, specified by index, with the col or row specified by WithIndex; Boolean IsColumn determines whether rows or columns are to be exchanged + + + + + + + + + + + + + + + + + + + + + InsertColRow inserts a column or row (specified by + Iscolumn) at the stated index location + + + + + + + + + + + + + + + + + Move column or row from FromIndex to ToIndex; Boolean IsColumn specifies whether col or row is to be moved + + + + + + + + + + + + + + + + + + + + + Sort column or row specified by index and optionally by FromIndex and ToIndex; IsColumn specifies whether col or row is to be sorted + + + + + + + + + + + + + + + + + + + + + + + + Use the default method for drawing a cell specified by aCol, aRow, at location aRect with state aState + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Event handler signalled when a grid column or row is deleted + + + + + + + + Event handler signalled when a grid column or row has its position exchanged with another + + + + + + + + Event handler signalled when a column or row is inserted into the grid + + + + + + + Event handler signalled when a grid column or row is moved + + + + + + + Event handler signalled to compare the contents of cells + + + + + + + + + + + + + Event handler signalled to get the edit mask while editing a grid cell + + + + + + + Event handler signalled to get the text to be edited in a grid cell + + + + + + + Event handler signalled when a column or row header is clicked + + + + + + + Event handler signalled when a column or row header is re-sized + + + + + + + + + + + + + + + + + + + + Event handler signalled when a grid cell is selected + + + + + + + Event handler signalled to store the text that has been edited in a cell + + + + + + + + + + + + + Event handler signalled to validate the content in a cell + + + + @@ -12879,115 +12323,1758 @@ The range is defined based on optional AUseSelection parameter which + - - - - - - - - TitleImageList - the list of images to be used with the titles - - - - - - - - - - - - - - - - - - - - - - - - GetValueChecked - returns a checked value as a string - - - - GetValueUnchecked - returns an unchecked value as a string - - - - ValueChecked - a string value of a checked item - - - - ValueUnchecked - a string value of an unchecked item - - - - DrawGridCheckboxBitmaps - draws checkbox bitmaps in the nominated rectangle with the specified checkbox state - - - - OnUserCheckboxBitmap - event handler for a user accessing a checkbox bitmap - + GetCheckBoxState - returns the state of the checkbox at the specified position + - SetCheckboxState - specifies the state of the checkbox in the nominated cell + + SetCheckboxState - specifies the state of the checkbox in the nominated cell +
+ - ToggleCheckbox - toggles checkbox state between checked and unchecked + ToggleCheckbox - toggles checkbox state between checked and unchecked +
+ - OnGetCheckboxState - event handler for finding checkbox state + OnGetCheckboxState - event handler for finding checkbox state +
+ - OnSetCheckboxState - event handler for specifying checkbox state + OnSetCheckboxState - event handler for specifying checkbox state +
- - - - GetDefaultValueChecked - returns the default value for a checked column - - - - GetDefaultValueUnchecked - returns the default value for an unchecked column - - - - Automatically add new rows - Does not add rows if the last cell is empty and goAutoAddRowsSkipContentCheck is not set. - Highlight the current Row - Setting grid.Selection moves also cell cursor - - Allow to resize fixed columns - - Clicking partially visible cells will not scroll - Show individual cell hints - Requires the ShowHint property to be set to TRUE. -If set, the Hint property will be ignored. Instead the OnGetCellHint event will be called for each cell. - Show cell hints if cell text is too long - Show "..." if cell text is too long - Also add a row if last row is empty - goAutoAddRows must also be set. Otherwise this option does not take effect at all. - Get individual hint for each cellOnly called if is set. + + + + TDrawGrid - a custom drawn grid. May contain images in its cells. + + + + + + - Event for cell hints - The grid - column index - row index - Hint textThis text will be displayed as hint. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Repesents strings used as the cell values in TStringGrid + + + TStringGridStrings is a TStrings descendant that represents the strings used to populate the cells of a TStringGrid. + + + + + + + + + + + + + Converts an index position to line and column numbers for Cells in the grid + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Gets the string at the specified index position + + + + + + + + + + + + + Gets the number of strings in the class instance + + + + + + + + + + + + Gets the object stored at the specified index position + + + + + + + + + + + + + + + Stores a string at the specified index position + + + + + + + + + + + + + + + Stores an Object at the specified index position + + + + + + + + + + + + + + + + Create - constructor for TStringGridStrings: calls inherited Create and initializes some local variables + + + + TObject.Create + + + + + Grid for the string values + + + + + + + + + + + + + + + + + Destructor for the class instance + + + + + + + + Adds the specified string to the class instance + + + + + + + + + + + + + + + Stores values from Source in the current class instance + + + + + + + + + + + + + Removes all values for the column or row represented by he class instance + + + + + + + + + + Deletes a value stored in the class instance + + Raises an EGridException exception with the message 'Cannot delete value.' + + + + + + + + + + + + Inserts a value in the class instance + + Raises an EGridException exception with the message 'Cannot insert value.' + + + + + + + + + + + + + + + + TCustomStringGrid - base class for TStringGrid + + + + + + + + + + + + + + + + + Gets the values in the specified column number as a TStrings instance + + + GetCols is the read access specifier for the indexed Cols property. + + + + + + + + TStrings with row values for the specified column number + + + + Column number retrieved in the method + + + + + Gets the value for the indexed Objects property + + + + + + Value for the property + + + + + + + + + + + + + Gets the value for the indexed Rows property + + + + + + Value for the property + + + + Ordinal position for the requested row + + + + + Frees the TStringGridStrings instances in the spefied Map + + + + + + TMap instance examined and updated in the method + + + + + Gets the column or row at the specified index fom the map instance + + + + + + + + + + + + + + + + + + + + + + + Reads string values for the Cells property using a TReader instance + + + + + + TReader instance used to read values during LCL streaming + + + + + Sets the value for the indexed Cols property + + + + + + Ordinal position for the affected column + + + + New value for the property + + + + + Sets the value for the indexed Objects property + + + + + + Ordinal position for the column + + + + Ordinal position for the row + + + + New value for the property + + + + + Sets the value for the indexed Rows property + + + + + + Ordinal position for the row affected + + + + New value for the property + + + + + + Writes string values in the Cells property using the specified TWriter instance + + + + + + + + + + + + Copies the content from cell(s) in the specied selection rectangle to the clipboard + + + + Only visible cells in the selection rectangle are included in the copied values. Others are quietly discarded. HTML TABLE formatting is used to gather the cell values. Line Ending and HTML reserve characters are translated in to HTML-safe tags or character entities. + + + + + + + + + + + Assigns values from the current class instance, including Cells, to the target class instance + + + + + + + + + + + Adjusts and renders the font, text and images for the specified column + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Defines the Cells property for the TFiler instance used in LCL streaming + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Signals the OnCellProcess event handler when assigned + + + + + + + + + + + + + + + + + + Draws the title image and cell content for the specified column and row + + + + + + + + + + + + + + + + + + Calls DrawCellText using the specified arguments + + + + + + + + + + + + + + + + + + Performs auto-numbering for non-empty cells in the grid + + + + + + + + + + + + + + + + + + Gets the value for the indexed Cells property + + + + + Value for the indexed property + + + Column number for the cell + + + Row number for the cell + + + + Gets the state for a cell displayed as a Checkbox + + + + + Column number for the cell + + + Row number for the cell + + + Checkbox state derived for the specified cell + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SelectionSetText - stores the text in the selection + + + + + + + + + + + + + + + + + + + + + + Sets the value for the current Selection to the specified HTML content + + + + + HTML stored in the current selection + + + Textual representation for the HTML content + + + + Sets the value for the indexed Cells property + + + + + Column number for the affected cell + + + Row number for the affected cell + + + New value for the indexed property + + + + Sets the state for a Checkbox in the specified cell + + + + + + + + + + + + + + + + Locks, updates, and unlocks the editor and text for a cell at the specified coordinates + + + + + + + + + + + + + + + + + + Indicates if the content in the grid cells has been changed + + + The value in Modified is set to False when Loaded using the LCL streaming mechanism. The value in Modified is changed to True when a cell is updated in the SetCells method, or when the Cells property is updated. + + + + + + + + + + Event handler signalled when copying or pasting content for Cells in the grid + + + + + + + + + Create - constructor for TCustomStringGrid: calls inherited Create then sets up default styles, layout and alignment + + + + TCustomDrawGrid.Create + + + + + Owner of the class instance + + + + + + Destroy - destructor for TCustomStringGrid: frees maps of columns and rows, then calls inherited Destroy + + + + + + + + + + + AutoSizeColumn - automatically adjust width of column to accommodate widest text + + +

+ This procedure sets the column width to the size of the widest text it finds in all rows for the column aCol. +

+

+ Tip: see the goDblClickAutoSize option to allow columns to be automatically resized when doubleClicking the column border. +

+
+ +
+ + + + + + + + + AutoSizeColumns - automatically resizes all columns by adjusting them to fit in the longest text in each column + + + Automatically resizes all columns by adjusting them to fit in the longest text in each column. This is a quick method of applying the AutoSizeColumn method for every column in the grid. + + + + + + + + Cleans all cells in the grid using the specified CleanOptions + + +

+ Cleans all cells in the grid subject to the given CleanOptions, optionally specifying a range of cells or a rectangular region. See for more information. +

+

+ The cleaning operation does not change the number of rows and columns. +

+

+ Some examples: +

+
    +
  • Clean all cells: grid.Clean([]); (the same as grid.clean)
  • +
  • Clean all non fixed cells: grid.Clean([gzNormal]);
  • +
  • Clean all cells but don't touch grid column headers: Grid.Clean([gzNormal, gzFixedRows]);
  • +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + CopyToClipboard - copy a range of cells to clipboard + + +

+ CopyToClipboard will copy a range of cells into the clipboard; the cells values are TAB separated. The range is defined based on optional AUseSelection parameter (which is False by default) and indicates the range is set to the whole grid, including fixed cols/rows. If AUseSelection is True, the range of cells is set to the current . +

+
+ + + +
+ + + + Inserts a row at the specified position with the specified cell values + + + + + + + + + + + + + Loads the content in the grid from the comma-separated values in AStream + + + + + Stream with the content loaded in the method + + + Delimiter between cell data in the stream; default is Comma (',') + + + Indicates if Column captions are loaded from values in the stream + + + Initial line number in the stream included in the grid content; default is 0 + + + Indicates if empty lines in the stream are ignored in the method + + + + Loads the grid from a file using comma-separated value format + + + + + File name with the content loaded in the method + + + Delimiter between cell values in the file; default is Comma (',') + + + Indicates if column captions are loaded from values in the file + + + Initial line number from the file loaded in the method + + + Indicates if empty lines in the file are ignored in the method + + + + + Saves content in the grid as comma-separated values to the specified stream instance + + + + + + Stream where grid content is stored + + + Delimiter between cell values; default is Comma (',') + + + Indicates that column captions are stored as the first row of CSV data + + + + Indicates if only visible columns are included in the CSV output + + + + + + Saves grid content as comma-separated values to the specified file name + + + + + + File name (with optional path) where CSV data is stored + + + + Delimiter used between cell values in CSV output; default is Comma (',') + + + + + Indicates if column captions are written as the first row of CSV data in the file + + + + Indicates if only visible columns are included in the CSV output + + + + + Cells - the text content of a cell or cells, indexed by + aCol, aRow + + +

+ Cells is an indexed String property used to read or write the content for a cell in the grid. The ACol and ARow indexes are used the access a value stored at the requested column and row position. +

+

+ Reading the value causes the pointer to the cell in Celda to return its Text value. +

+

+ Setting the value causes the pointer to the cell in Celda to be updated at the specified coordinates. An active cell editor will be cancelled if it is not locked, and the value in Modified is reset to False. +

+
+ + + + +
+ + + Column number for the cell value + + + + Row number for the cell value + + + + + + Cols - get or set a list of strings for column names as specified by the + index + + + + + + + + + + + + + + + + + + The Objects present in the specified cell + + + + + + + + + + + + + + + + Rows - gets or sets a list of strings for row names as specified by + index + + + + + + + + + + + + + + + + + + + + + TStringGrid - a specialized grid for displaying strings (textual content) in a matrix of columns and rows + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Deprecated + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Draw rubberband rectangle + +

+ Draws a dotted rubberbanding rectangle around the provided cell rectangle. +

+

+ DrawBits contains a Byte value that indicates the rectangle sides drawn in the routine. By default, all sides for the rectangle are drawn. Use the following byte values or-ed together in DrawBits to specify the sides drawn: +

+
+
BF_LEFT
+
Draws the left side of the rectangle.
+
BF_RIGHT
+
Draws the right side of the rectangle.
+
BF_TOP
+
Draws the top of the rectangle.
+
BF_BOTTOM
+
Draws the bottom of the rectangle.
+
+
+ + +
+ + + Canvas where the rubberband rectangle is drawn + + + + Coordinates for the rubberband rectangle + + + + Color for the rubberband rectangle + + + + Sides drawn for the rubberband rectangle + + + + Ensures that a valid handle for a device context exists for the canvas + + + + + The canvas instance with a valid handle + + + Canvas examined in the routine + + + + Ensures a canvas handle for a device context is freed + + + + + Canvas examined in the routine + + + + + Registers components in the Lazarus IDE + + + + + + + How to use Grids including StringGrids, DrawGrids and DbGrids + + +

+ Customizing Grids +

+

+ Grids are components derived from the TCustomControl class and do not have a native widget associated with them. So they are not restricted by the look of the current interface theme. This can be both an advantage and a disadvantage: usually programmers want to create a uniform-look application. Lazarus grids are flexible enough to allow programmers to make them look similar to other native controls; alternatively they can customize the grid to obtain almost the same look in any platform or widget interface (with the exception of scrollbars, whose look is still determined by the current theme). +

+

+ Some properties can affect the way the grid looks by acting when the cell is about to be painted in PrepareCanvas/OnPrepareCanvas by changing default canvas properties like brush color or font. Following is a list of such properties: +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Properties and Events for Customizing Grids
+ PropertyMeaning
AlternateColorThe user can change the background color that appears on alternate rows. This is to allow easy reading of grid rows data.
ColorSets the primary color used to draw non fixed cells' background.
FixedColorThe color used to draw fixed cells' background.
FlatEliminates the 3d look of fixed cells.
TitleFontFont used to draw the text in fixed cells.
TitleStyle +

Changes the 3D look of fixed cells. There are 3 settings:

+
+
tsLazarus
+
The default look
+
tsNative
+
Tries to use an appearance that is in concordance with the current widgetset theme
+
tsStandard
+
A more contrasted look, like Delphi grids
+
+
AltColorStartNormal + If true, alternate color is always in the second row after fixed rows; the first row after fixed rows will always be the default color. If false, default color is set to the first row as if there were no fixed rows. +
BorderColor + Sets the grid's border color used when Flat=True and BorderStyle=bsSingle; +
EditorBorderStyle + If set to bsNone under Windows the cell editors will not have the border, like in Delphi; set to bsSingle by default because the border can be theme specific in some widgetsets and to allow a uniform look. +
FocusColorThe color used to draw the current focused cell if UseXORFeatures is not set; by default this is clRed.
FocusRectVisibleTurns on/off the drawing of focused cell.
GridLineColorColor of grid lines in non fixed area.
GridLineStyle + Pen style used to draw lines in non fixed area, possible choices are: psSolid, psDash, psDot, psDashDot, psDashDotDot, psinsideFrame, psPattern, psClear; default is psSolid. +
SelectedColorColor used to draw cell background on selected cells.
UseXORFeaturesIf set, focus rect is drawn using XOR mode so it should make visible the focus rect in combination with any cell color background. It also affects the way that moving columns look.
DefaultDrawing + Normally the grid prepares its grid canvas using properties according to the kind of cell that is being painted. If the user has written an OnDrawCell event handler, DefaultDrawing (if set) also paints the cell background; if the user is taking full responsibility for drawing the cell it is better to turn off this so painting is not duplicated. In a StringGrid, if DefaultDrawing is set it draws the text in each cell. +
AutoAdvanceWhere the cell cursor will go when pressing enter or tab/shift tab, or after editing.
ExtendedColSizingIf true, the user can resize columns, not just at the headers, but anywhere along the column's height.
+

+ Other Properties that Affect Grid Appearance: +

+

+ Options +

+

+ This is a set of zero or more choices, with some elements that enable diverse functionality but others that are related directly with grid's look. Options can be set at design-time or run-time. +

+
+
+ goFixedVertLine, goFixedHorzLine +
+
+ Draws a vertical or horizontal line respectively, delimiting cells or columns in the fixed area; active by default. +
+
+ goVertLine, goHorzLine +
+
+ The same as previous, but for the normal browseable area. A grid can be made to simulate a listbox by unsetting both of these options. +
+
+ goDrawFocusSelected +
+
+ If this option is enabled, a selection background is painted in the focused cell in addition to the focused dotted rectangle. Please note: this doesn't work when the goRowSelect option is set; in such case the row is always painted as if goDrawFocusSelected is set. +
+
+ goRowSelect +
+
+ Selects the full row instead of individual cells. +
+
+ goFixedRowNumbering +
+
+ If set, grid will do numbering of rows in first fixed column. +
+
+ goHeaderHotTracking +
+
+ If set, the grid will try to show a different look when the mouse cursor is over any fixed cell. In order for this to work, desired cell zone needs to be enabled with the HeaderHotZones. Try combining this option with TitleStyle= tsNative to get themed hot tracking look. +
+
+ goHeaderPushedLook +
+
+ If set, this option enables a pushed look when clicking any fixed cell. The zone of "pushable" cells is enabled using HeaderPushedZones property. +
+
+

+ Description of the Grid Drawing Process +

+

+ Like other custom controls, the grid is drawn using the paint method. In general terms the grid is drawn by painting all rows, and each row by painting its individual cells. The process is as follows: +

+
    +
  • First, the visible cells area is determined: each row is tested to see if it intersects the canvas clipping region; if it's OK, then the visible area is painted by drawing columns of each row. +
  • +
  • + The column and row values are used to identify the cell that is about to be painted and again each column is tested for intersection with the clipping region; if everything is OK, some additional properties like the cell's rectangular extent and visual state are passed as arguments to the DrawCell method. +
  • +
  • +

    + As the drawing process is running, the visual state of each cell is adjusted according to grid options and position within grid. The visual state is retained in a variable of type TGridDrawState which is a set with following elements: +

    + + + + + + + + + + + + + + + + + + + + + +
    gdSelectedThe cell will have a selected look.
    gdFocusedThe cell will have a focused look.
    gdFixedCell have to be painted with fixed cell look.
    gdHotthe mouse is over this cell, so paint it with hot tracking look
    gdPushedthe cell is being clicked, paint it with pushed look
    +
  • +
  • +

    + DrawCell - The DrawCell method is virtual and may be overridden in descendent grids to do custom drawing. The information passed to DrawCell helps to identify which particular cell is being painted, the physical area occupied on the screen and its visible status. See DrawCell reference for details. For each cell the following occurs: +

    +
      +
    • + PrepareCanvas - If the DefaultDrawing is set, the grid canvas is setup with default properties for brush and font based on current visual state. For several design and run-time properties, the text alignment is set to match programmer selection in custom columns if they exists. If DefaultDrawing is false, brush color is set to clWindow and Font color to clWindowText, the text alignment is set with grids defaultTextStyle value. +
    • +
    • + OnPrepareCanvas - If the programmer wrote an event handler for the + OnPrepareCanvas event, it is called at this point. This event can be used for doing simple customization like changing a cell's background color, font's properties like color, font face and style, Text layout like different combinations of left, center, top, bottom, right alignment, etc. Any change made to the canvas for a particular cell in this event would be lost, because the next cell drawing will reset canvas again to a default state. So it's safe doing changes only for a particular cell or cells and forget about it for the rest. Using this event sometimes helps to avoid using the OnDrawCell grid event, where users would be forced to duplicate the grid's drawing code. +
    • +
    • + OnDrawCell - Next, if no handler for the OnDrawCell event was specified, the grid calls the DefaultDrawCell method which simply paints the cell background using the current canvas brush color and style. If the OnDrawCell handler exists, the grid first paints the cell background, but only if the DefaultDrawing was set; then it calls the OnDrawCell event to do custom cell painting. Usually programmers want to do custom drawing only for particular cells, but standard drawing for others: in this case, they can restrict custom operation to certain cell or cells by looking into ACol, ARow and AState arguments, and for other cells simply call the DefaultDrawCell method and let the grid to take care of it. +
    • +
    • + Text - At this point, if the DefaultDrawing is true, the cell's text content is painted (only for TStringGrid). +
    • +
    • + Grid lines - The last step for each cell is to paint the grid lines: if grid options goVertLine, goHorzLine, goFixedVertLine and + goFixedHorzLine are specified the cell grid is drawn at this point. Grids with only rows or only cols can be obtained by changing these options. If the programmer elected to have a "themed" look it is done at this point also (see TitleStyle). +
    • +
    • + FocusRect - When all columns of the current row have been painted it is time to draw the focus rectangle for the current selected cell or for the whole row if the goRowSelect option is set. +
    • +
    +
  • +
+

+ Grid Cell Selection +

+

+ The location of a grid's current (focused) cell (or row) can be changed using keyboard, mouse or through code. In order to change cell focus successfully to another position, we must test the target position to see if it is allowed to receive cell focus. When using the keyboard, AutoAdvance performs part of the process by finding what should be the next focused cell. When using mouse clicks or moving by code, focus will not move from the current cell unless the target cell is permitted to receive focus. +

+

+ The grid calls SelectCell to see if a cell is focusable: if this function returns true, then the target cell identified with arguments aCol and aRow is focusable (the current implementation of TCustomGrid simply returns true). TCustomDrawGrid and hence TDrawGrid and TStringGrid override this method and check first if a cell is any wider than 0; normally you don't want a 0 width cell selected so a cell with this characteristics is skipped automatically in the process of finding a suitable cell. The overridden method SelectCell also calls the user configurable event OnSelectCell: this event receives the cell coordinates as arguments and always returns a default result of True. +

+

+ Once a cell is known to be focusable and we are sure a movement will take place, the method BeforeMoveSelection is called; this in turns triggers the OnBeforeSelection event. This method's arguments are the coordinates for the new focused cell; at this point any visible editor is hidden too. The "before" word means that selection is not yet changed and current focused coordinates can be accessed with grid.Col and grid.Row properties. +

+

+ After that, the internal focused cell coordinates are changed and MoveSelection is called; this method's purpose (if set) is to trigger the OnSelection event (this is a notification that the focused cell has changed and the new cell coordinates are available through grid.row and grid.col properties). +

+

+ Note that is not good to use the OnSelectCell event to detect cell focus changes, as this event will be triggered several times even for the same cell in the process of finding a suitable cell. Is better to use OnBeforeSelection or OnSelection events for this purpose. +

+

+ Using Cell Editors +

+

+ Users can specify what editor will be used for a cell using one of two methods. +

+
    +
  1. + Using a custom column and selecting the ButtonStyle of the column. In this method the user can select the style of the editor that will be shown. Available values are: cbsAuto, cbsEllipsis, cbsNone, cbsPickList, cbsCheckboxColumn. +
  2. +
  3. +

    + Using the OnSelectEditor Grid Event +

    +

    + Here the user specifies in the Editor parameter which editor to use for a cell identified by aCol, ARow in a TCustomDrawGrid derived grid or TColumn in TCustomDBGrid. The public EditorByStyle() function takes as parameter one of the following values: cbsAuto, cbsEllipsis, cbsNone, cbsPickList, cbsCheckboxColumn. +

    +

    + This method takes precedence over the first one using custom columns. A Custom cell editor can be specified here, with values specific to the cell, row or column. +

    +
  4. +
+

+ Description of Editor Styles +

+

+ The following is a description of the editor styles. They are enumerated values of type TColumnButtonStyle and so they are prefixed by 'cbs'. This type was used to remain compatible with Delphi's DBGrid. +

+
    +
  • + cbsAuto - This is the default editor style for TCustomGrid derived grids. The TStringCellEditor derived from TCustomMaskEdit is specialized to edit single line strings and is used by default in TStringGrid and TDrawGrid. When using Custom Columns, if the programmer filled the Column's PickList property, this behaves as if cbsPickList editor style was set. For a TCustomDBGrid that has a field of type Boolean, it behaves as if cbsCheckBoxColumn editor style was specified. This is the recommended value for custom cell editors. TODO: related OnEditingDone. +
  • +
  • +

    + cbsEllipsis - This editor style is the most generic one. A button with ellipsis (...) appears in the editing cell and the programmer can use the OnEditButtonClick grid event to take any programmed action when the user presses the button. For example a calendar dialog could pop up to allow the user to select a specific date, a file open dialog could appear to find files, or a calculator could appear so the user could enter the numeric result of calculations, etc. +

    +
      +
    • + OnEditButtonClick is just a notification, to find out in which cell a button has been clicked by taking a look at the grid.Row and grid.Col properties. +
    • +
    • + A DBGrid has specific properties to retrieve the active column or field and because this event occurs in the active record, it could update the information in the active field. +
    • +
    • + This editor style is implemented using TButtonCellEditor, a direct descendant of TButton. +
    • +
    +
  • +
  • + cbsNone - This editor style instructs the grid not to use any editor for a specific cell or column; it behaves then, as if the grid were read-only for such a cell or column. +
  • +
  • +

    + cbsPickList - Used to present the user with a list of values that can be entered. This editor style is implemented using TPickListCellEditor, a component derived from TCustomComboBox. The list of values that are shown is filled in one of two ways depending on the method used to select the editor style. +

    +

    + When using custom columns, programmers can enter a list of values using the column's PickList property. [FOR BEGINNERS: TODO: exact procedure to edit the list] +

    +
  • +
  • +

    + cbsCheckboxColumn - This editor style is at the moment only available in TDBGrid. If a field's contents associated with the column are restricted to a pair of values, for example, yes-no, true-false, on-off, 1-0, etc then cbsCheckboxColumn is used to modify the appearance of a column by using a checkbox representation that the user can toggle by using a mouse click or pressing the SPACE key. +

    +
      +
    • + If a ButtonStyle for a column is set to cbsAuto and DBGrid detects that the field associated with the column is a Boolean field, then the grid uses this editor style automatically. This automatic selection can be disabled or enabled using DBGrid's OptionsExtra property; setting dgeCheckboxColumn element to false disables this feature. +
    • +
    • + The values that are used to recognize the checked or unchecked states are set in a column's properties ValueChecked and ValueUnchecked. +
    • +
    • + At any moment, the field value can be in one to three states: Unchecked, Checked or Grayed. +
    • +
    +
  • +
+
+ + ToDo: samples of what can be made and what to leave for OnDrawCell? + +
+