TCustomGrid class
Implements the base class for grid controls.
Declaration
TCustomGrid = class(TCustomControl)Inheritance
Descends from it: TCustomDBGrid TCustomDrawGrid
Description
A grid is a collection of cells that are organized in columns and rows. Grids are suitable for showing data that using a tabular layout. For example: tables in a database, or formulae and data in a spreadsheet.
Key properties:
The ColCount and RowCount properties contain the column and row count of the grid.
The FixedCols and FixedRows properties specify the count of fixed columns or rows that are used for headings.
The column widths and row heights of the grid are accessible with the ColWidths and RowHeights properties.
The DefaultColWidth and DefaultRowHeight properties are used to specify default column widths or row heights respectively.
The colors used for the cells and other grid elements are specified in the following properties:
The GridWidth and GridHeight properties contain the dimension of the entire grid.
The ScrollBars controls the creation of scroll bars for the grid.
The LeftCol, TopRow, VisibleColCount and VisibleRowCount properties contain information about the visible area of the grid.
The Options and Options2 control the options enabled for the grid.
Please note that most of these properties are declared as protected members. They are not accessible, by default, at design-time using the Object Inspector in the Lazarus IDE. They can, however, be elevated to public or published visibility in descendent classes.
Key methods and events:
If the user highlights a cell of the grid, the SelectCell method is called that triggers the OnSelectCell event. The position of the highlighted cell is stored within the Col and Row property.
The OnClick event is signalled when a mouse down event is handled for the control, and when cell navigation is performed using cursor keys on the keyboard. It is signalled when for fixed cells on the grid when the row or column features are enabled in Options2.
The MouseToCell method gets the column and row number for a grid cell at a given position on the screen. MouseToGridZone gets the grid area where the mouse down event occurred. CellToGridZone gets the grid area for the specified column and row number.
Huge changes to the grid should be encapsulated in calls to BeginUpdate and EndUpdate to speed up the application.
Component developers must override the DrawCell method in customized grid controls.
Grid cell selection
The location of the current (focused) cell (or row) can be changed using keyboard, mouse or through code. In order to change cell focus successfully to another position, we must test the target position to see if it is allowed to receive cell focus. When using keyboard, the property AutoAdvance performs part of the process by finding what should be the next focused cell. When using mouse clicks or moving by code, focus will not move from the current cell unless the target cell is permitted to receive focus.
The grid calls the SelectCell function to see if a cell is focusable: if this function returns true, then the target cell identified with arguments aCol and aRow is focusable (the current implementation of TCustomGrid simply returns true). TCustomDrawGrid and hence TDrawGrid and TStringGrid override this method to check first if cell is any wider than 0; normally you don't want a 0 width cell selected so a cell with these characteristics is skipped automatically in the process of finding a suitable cell. The other thing the overridden method SelectCell does is to call the user configurable event OnSelectCell: this event receives the cell coordinates as arguments and always returns a default result value of true.
Once a cell is known to be focusable and we are sure a movement will take place, first the method BeforeMoveSelection is called; this in turns triggers the OnBeforeSelection event. This method's arguments are the coordinates for the new focused cell. At this point any visible editor is hidden too. The "before" word means that selection is not yet changed and current focused coordinates can be accessed with grid.Col and grid.Row properties.
After that, the internal focused cell coordinates are changed and then MoveSelection method is called; this method's purpose is to trigger the OnSelection event if set (this is a notification that the focused cell has, by this time, already changed and cell coordinates are now available through grid.row and grid.col properties).
Note that is not good to use OnSelectCell event to detect cell focus changes, as this event will be triggered several times even for the same cell in the process of finding a suitable cell. Is better to use OnBeforeSelection or OnSelection events for this purpose.
Multi-selection
The Lazarus grids are able to extend the selection to multiple cells. The Option goRangeSelect must be active for this purpose: Now you can drag the mouse over a rectangle on the grid to select all the cells included or intersected by this rectangle. Or you can click on the cell in one corner, hold SHIFT down and either click on the opposite corner of the selection, or press the arrow keys to extend the selection in the corresponding direction.
In the default setting of the RangeSelectMode property, rsmSingle, only a single cell or cell range (rectangle of cells) can be selected, as described. The rsmMulti mode, however, allows selection of multiple and even discontiguous cells or ranges. After selecting the first cell/range as already described, hold the CTRL key down and click on the next cell or drag over the next range to be selected. Instead of dragging you can also select an additional range by pressing SHIFT (in addition to CTRL) and clicking on the opposite corner of the range or pressing the arrow keys.
The selected cells are highlighted by a different color. Note, however, that the currently focused cell has the default background color of the grid unless you set the Option goDrawFocusSelected.
Clicking somewhere on an unselected cell unselects the selected cell(s)/range( s).
If you need to access selections by code you can do this by using these TCustomGrid properties:
- SelectedRange[AIndex: Integer]: TGridRect:
- Returns the column/row coordinates of the corner cells of the selected range at the specified index (type TGridRect = TRect). A single selected cell is considered to be a block with equal Left and Right column and equal Top and Bottom row coordinates.
- SelectedRangeCount: Integer:
- The number of selected blocks.
Note that these are read-only properties, you can add and change selections only by user interaction. But you can call ClearSelections to unselect everything.
Your selection handling code must be prepared that a selected cell could be found in another selected block again. Normally this situation is prohibited in the user interface, but there are scenarios where a selection could be extended into another range so that the overlapping cells are "selected twice".
Additional information about grid usage is available on the Lazarus wiki in the following pages:
See also
Properties
AllowOutboundEvents | protected | Allows a mouse click on unused space in the control, and moves the cursor to the nearest valid cell. |
AlternateColor | protected | Color used for the background in alternate rows in the grid. |
AutoAdvance | protected | Direction used when automatically moving the selection to the next selectable cell. |
AutoEdit | protected | Indicates if edit mode is automatically entered when a cell is selected. |
AutoFillColumns | protected | Indicates whether columns are automatically resized to fill the visible area in the grid. |
BorderStyle | protected | Drawing style used for the borders on the control. |
BorderColor | protected | The color used for the border on the control. |
CellHintPriority | protected | Identifies how text is combined to form the Hint property. |
Col | protected | Column index for the selected grid cell. |
ColCount | protected | Number of columns in the grid. |
ColRow | protected | Provides access to current column and row numbers as a TPoint instance. |
ColRowDraggingCursor | protected | Cursor shape displayed when a column or row is dragged in the grid control. |
ColRowDragIndicatorColor | protected | Color used to render the drag cursor when a column or row is dragged in the grid. |
ColSizingCursor | protected | Cursor shape displayed when a column is resized. |
ColumnClickSorts | protected | Indicates if clicking a column header changes its sort order. |
Columns | protected | Definitions for the columns displayed the grid. |
ColWidths | protected | Provides indexed access to the Width for a column in the grid. |
DefaultColWidth | protected | Default width used for grid columns. |
DefaultRowHeight | protected | Default row height for newly created grid rows. |
DefaultDrawing | protected | Indicates if the default drawing mechanism is used to draw the background and text for cells. |
DefaultTextStyle | protected | Default style used to display text including alignment, layout, wrapping, et. al. |
DisabledFontColor | protected | Color used to draw text in the grid when Enabled is set to False. |
DragDx | protected | The amount (DeltaX) by which an object should be dragged. |
Editor | protected | The editor control used to modify the value in the current cell. |
EditorBorderStyle | protected | The border style for the Editor control. |
EditorMode | protected | True when the Editor is ready to modify the value for the current cell. |
EditorKey | protected | Indicates if the last key event was triggered by the cell Editor for the grid control. |
EditorOptions | protected | The option flags sent to the Editor control in the grid. |
EditorShowing | protected | True when the cell Editor for the grid control has been displayed. |
ExtendedColSizing | protected | Indicates if extended column sizing is enabled in the grid. |
ExtendedRowSizing | protected | Indicates if extended row sizing is enabled for rows in the grid. |
ExtendedSelect | protected | Controls whether extending the current cell selection(s) on the control is enabled. |
FastEditing | protected | Indicates if "Fast Editing" is enabled in the grid. |
AltColorStartNormal | protected | Indicates if alternate row coloring starts with the normal row color. |
FixedCols | protected | The number of fixed columns in the grid. |
FixedRows | protected | Number of the fixed rows in the grid. |
FixedColor | protected | The color used for the fixed cells in the grid. |
FixedGridLineColor | protected | Color used to draw the separator lines for fixed grid cells. |
FixedHotColor | protected | The color used for hot-lighted fixed cells in the grid. |
Flat | protected | Indicates if cells are displayed using a Flat appearance. |
FocusColor | protected | The color used to draw the focus rectangle when a cell has focus. |
FocusRectVisible | protected | Indicates if the focus rectangle is displayed for the control. |
GCache | protected | Contains cached data about the visual layout and state for the grid control. |
GridFlags | protected | Contains grid-specific state flags active for the control. |
GridHeight | protected | Total height for all of the rows in the grid control. |
GridLineColor | protected | Color used for the grid lines on the control. |
GridLineStyle | protected | Style used to draw the grid lines on the control. |
GridLineWidth | protected | Width (thickness) for grid lines drawn on the control. |
GridWidth | protected | Total width for all columns in the Grid including non-visible columns. |
HeaderHotZones | protected | Contains the grid zones which are hot-lighted (hovered) on the control. |
HeaderPushZones | protected | Contains the grid zones which are drawn in a "pushed" state on the control. |
ImageIndexSortAsc | protected | Ordinal position for the image used when a column is sorted in ascending order. |
ImageIndexSortDesc | protected | Ordinal position for the image used when a column is sorted in descending order. |
TabAdvance | protected | Controls the behavior for Tab navigation in the grid control. |
TitleImageList | protected | The list with images displayed in column titles. |
TitleImageListWidth | protected | Stores the default width for images used in the title area for fixed cells. |
InplaceEditor | protected | Cell editor for the grid control. |
IsCellSelected | protected | Provides indexed access to the selected state for a cell by its column and row number. |
LeftCol | protected | Column number for the first visible column on the left edge of the grid. |
MouseWheelOption | protected | Sets the mouse wheel behavior for the grid control. |
Options | protected | Contains the set of optional features and/or behaviors enabled for the grid control. |
Options2 | protected | Contains additional options for scrolling and editor behavior enabled in the grid control. |
RangeSelectMode | protected | Controls the range selection mode used for the grid. |
Row | protected | Row number for the selected grid cell. |
RowCount | protected | Number of rows in the grid. |
RowSizingCursor | protected | Cursor shape displayed when the row height is resized. |
RowHeights | protected | Provides indexed access to the height for each row in the grid. |
SaveOptions | protected | Options which control the information saved and loaded for the grid control. |
SelectActive | protected | Indicates if a Selection is active in the grid control. |
SelectedColor | protected | Color used for selected cells in the grid. |
FadeUnfocusedSelection | protected | Indicates if a special color is used for selected cells when the control loses focus. |
SelectedColumn | protected | The column instance for the currently selected cell in the grid control. |
Selection | protected | Rectangle with the current cell selections in the grid control. |
ScrollBars | protected | Scrollbars displayed for the grid control. |
StrictSort | protected | Indicates if strict sorting is used. |
TitleFont | protected | The font used for text in a column title. |
TitleStyle | protected | The drawing style used for the fixed column titles. |
TopRow | protected | The first visible row in the grid. |
UseXORFeatures | protected | When True, the dotted focus rectangle is painted using an XOR raster operation. |
ValidateOnSetSelection | protected | Controls validation when the text for the selected cell is changed. |
VisibleColCount | protected | The number of visible columns in the grid control. |
VisibleRowCount | protected | The number of visible rows in the grid control. |
CursorState | public | Current cursor state for the grid control. |
SelectedRange | public | Provides indexed access to TGridRect values in the currently selected range. |
SelectedRangeCount | public | Number of cell rectangles in the selected range for the grid. |
SortOrder | public | Controls the order used for the sort column (ascending or descending). |
SortColumn | public | Column number used to sort the rows in the grid. |
TabStop | public | Indicates if keyboard navigation to/from the control is enabled using the Tab or Shift+Tab keys. |
Methods
RTLSign | protected | Gets the positive or negative multiplier used to adjust scroll values for BiDi mode. |
WSRegisterClass | protected | Registers this component class with the current WidgetSet. |
AddSelectedRange | protected | Adds the current range selection to the array of selection rectangles for the control. |
AdjustClientRect | protected | Adjusts the client rectangle and sets a grid flag to reflect the change. |
AdjustEditorBounds | protected | Updates the selected cell and sets the bounds for the optional cell Editor. |
AfterMoveSelection | protected | Signals the OnAfterSelection event handler. |
AssignTo | protected | Stores properties from the current grid class instance to the specified target. |
AutoAdjustColumn | protected | Adjusts column properties to accommodate the largest value in the specified column. |
BeforeMoveSelection | protected | Performs actions needed before a selection is moved. |
BeginAutoDrag | protected | Starts an auto-drag operation in the grid control. |
BoxRect | protected | Gets the rectangle for the box around the cell at the given coordinates. |
CacheMouseDown | protected | Updates cached grid information when a mouse click occurs in the grid control. |
CalcAutoSizeColumn | protected | Calculates the size for an auto-sized column at the specified position. |
CalcCellExtent | protected | Deprecated. |
CalcFocusRect | protected | Calculates the bounds for a focus rectangle in the grid control. |
CalcMaxTopLeft | protected | Updates cached grid information for the visible area and scroll bars in the control. |
CalcScrollbarsRange | protected | Updates the range, page, and thumb position for visible scroll bars. |
CalculatePreferredSize | protected | Gets the preferred width and height for the control. |
CanEditShow | protected | Indicates whether the cell editor can be displayed and focused in the current column. |
CanGridAcceptKey | protected | Returns True if the grid is able to accept the given key. |
CellClick | protected | Processes a mouse click in the cell at the given coordinates. |
CellExtent | protected | Gets the last column number for the cell extent at the specified column and row. |
CheckLimits | protected | Checks column and row limits for the specified cell. |
CheckLimitsWithError | protected | Checks column and row limits for the specified cell, with error trapping. |
CMBiDiModeChanged | protected | Handles the CM_BIDIMODECHANGED control message for the grid control. |
CMMouseEnter | protected | Handles the control message posted when the mouse enters a cell in the grid. |
CMMouseLeave | protected | Handles the control message posted when a mouse leaves a cell. |
ColRowDeleted | protected | Performs actions when a column or a row is deleted from the control. |
ColRowExchanged | protected | Performs a notification when column or row data at the specified positions are exchanged in the grid control. |
ColRowInserted | protected | Performs actions needed when column or row data is inserted into the grid control. |
ColRowMoved | protected | Performs actions when a column or row is moved in the grid. |
ColRowToOffset | protected | Converts a column or row index to starting and ending pixels coordinates. |
ColumnIndexFromGridColumn | protected | Gets the position of the specified column relative to the first column in the grid. |
ColumnFromGridColumn | protected | Returns the grid column definition at the specified position in Columns. |
ColumnsChanged | protected | Performs actions needed when one or more columns in the grid are changed. |
ColWidthsChanged | protected | Performs actions needed when the widths for grid columns have been changed. |
CreateColumns | protected | Allocates and configures resources for the Columns collection. |
CheckNewCachedSizes | protected | Checks the values for cached column sizes when they have been reset in the grid. |
CreateWnd | protected | Creates and configures the widgetset handle for the grid control. |
CreateParams | protected | Initializes the window creation parameters with the settings for the control. |
Click | protected | Performs actions needed when a mouse click occurs in the grid control. |
DblClick | protected | Performs actions needed to handle mouse double click events in the control. |
DefaultColWidthIsStored | protected | Indicates if the DefaultColWidth property is available in component streaming. |
DefaultRowHeightIsStored | protected | Indicates if the DefaultRowHeight property is available in component streaming. |
DefineProperties | protected | Defines non-published properties included during LCL component streaming. |
DestroyHandle | protected | Destroys the handle for the control and all child controls. |
DialogChar | protected | Applies an accelerator key for a column in the grid. |
DoCompareCells | protected | Performs a comparison between the specified cells in the grid control. |
DoCopyToClipboard | protected | Performs actions needed to copy a cell or a text selection to the clipboard. |
DoCutToClipboard | protected | Performs actions needed to cut a cell or a text selection to the clipboard. |
DoEditButtonClick | protected | Performs actions needed when the button for the editor control is clicked. |
DoEditorHide | protected | Performs actions needed to hide the cell Editor in the grid control. |
DoEditorShow | protected | Performs actions needed to show the cell Editor for the grid control. |
DoExit | protected | Performs actions needed when the control loses focus. |
DoEnter | protected | Performs actions needed when the grid control receives focus. |
DoLoadColumn | protected | Signals the OnLoadColumn event handler for the grid control (when assigned). |
DoSaveColumn | protected | Signals the OnSaveColumn event handler for the grid control (when assigned). |
DoMouseWheel | protected | Handles a mouse wheel operation for the grid control. |
DoMouseWheelDown | protected | Handles a mouse wheel down movement for the grid control. |
DoMouseWheelUp | protected | Handles a mouse wheel up movement for the grid control. |
DoMouseWheelLeft | protected | Handles a mouse wheel scroll left message for the control. |
DoMouseWheelRight | protected | Handles a mouse wheel scroll right message for the control. |
DoAutoAdjustLayout | protected | Performs actions to automatically apply the layout policy with the specified scaling factors. |
DoOnChangeBounds | protected | Signals OnChangeBounds event handlers for the control. |
DoOPDeleteColRow | protected | Performs a delete operation for a column or a row. |
DoOPExchangeColRow | protected | Performs an exchange of values for the columns or rows with the specified indexes. |
DoOPInsertColRow | protected | Performs an insert operation for a column or a row at the specified position. |
DoOPMoveColRow | protected | Performs a move operation for the column or row at the specified position. |
DoPasteFromClipboard | protected | Pastes data from the clipboard into the grid control. |
DoPrepareCanvas | protected | Performs actions needed to prepare the canvas for a drawing operation. |
DoOnResize | protected | Performs actions needed when the grid control is resized. |
DoSetBounds | protected | Captures the current client width prior to setting the new bounds for the control. |
DoUTF8KeyPress | protected | Applies a UTF-8-encoded character to the active cell editor in the control. |
DrawBorder | protected | Draws the border for the grid control. |
DrawAllRows | protected | Draws all of the rows for the grid. |
DrawFillRect | protected | Draws the fill rectangle on the specified canvas. |
DrawCell | protected | Draws a cell using a given state at the specified grid location (Col, Row, rectangle). |
DrawCellGrid | protected | Draws cell grid lines for the control. |
DrawTextInCell | protected | Draws the text for a non-fixed cell in the grid. |
DrawThemedCell | protected | Draws a cell using the theme services for the specified grid drawing state. |
DrawCellText | protected | Draws the specified text in the given text rectangle. |
DrawGridCheckboxBitmaps | protected | Draws a check box bitmap which represents the given state in a cell. |
DrawButtonCell | protected | Draws a cell in a button-style column. |
DrawColRowMoving | protected | Draws a column or row when dragging is in effect. |
DrawColumnText | protected | Draws the text and image for a grid column title at the specified cell coordinates. |
DrawColumnTitleImage | protected | Draws the image(s) used in the column title at the specified index in the grid. |
DrawEdges | protected | Draws the edges (and filled background) of the client area for the control. |
DrawFocusRect | protected | Draws the focus rectangle for the specified cell. |
DrawRow | protected | Draws the columns for the specified row in the grid control. |
EditButtonClicked | protected | Signals the OnEditButtonClick or OnButtonClick event handler (when assigned). |
EditordoGetValue | protected | Gets the value for the cell Editor. |
EditordoResetValue | protected | Resets the value in the selected cell when a visible editor is cancelled or hidden. |
EditordoSetValue | protected | Sets the mask and value for a visible cell editor in the grid control. |
EditorCanAcceptKey | protected | Returns True if the Editor is able to accept the specified UTF-8 character. |
EditorIsReadOnly | protected | Determines if the current column number is defined as read-only. |
EditorHide | protected | Hides a visible cell editor in the grid control. |
EditorLocked | protected | Returns True if the Editor is locked, i.e. unable to accept input or make changes. |
EditingAllowed | protected | Indicates if the grid and specified column allow editing. |
EditorSelectAll | protected | Performs actions to select the entire content in the current cell. |
EditorShow | protected | Displays the Editor for the selected cell. |
EditorShowInCell | protected | Shows the cell content for the Editor in situ. |
EditorWidthChanged | protected | Performs actions needed when the width for a cell Editor has been changed. |
FirstGridColumn | protected | Gets the position of the first column after any fixed columns in the grid. |
FixedGrid | protected | Determines if all columns or all rows in the grid are fixed. |
FontChanged | protected | Performs actions needed when the font for the control is changed. |
GetAutoFillColumnInfo | protected | Gets auto-fill information for the specified column. |
GetCellHintText | protected | Gets the hint for the specified cell using the Options enabled in the grid control. |
GetCells | protected | Gets the cell content at the specified column and row numbers. |
GetColumnAlignment | protected | Gets the horizontal Alignment for the specified column. |
GetColumnColor | protected | Gets the Color used to render the background for the specified column number. |
GetColumnFont | protected | Gets the font used to render values for the specified column. |
GetColumnLayout | protected | Gets the vertical text Layout value for the specified column. |
GetColumnReadonly | protected | Returns True if the column is marked as ReadOnly. |
GetColumnTitle | protected | Gets the text displayed as the column title for the specified column number. |
GetColumnWidth | protected | Gets the width of the column at the specified column number. |
GetDeltaMoveNext | protected | Returns the relative cell coordinates for the next cell in the grid navigation order. |
GetDefaultColumnAlignment | protected | Gets the default horizontal alignment used for values in the grid control. |
GetDefaultColumnWidth | protected | Gets the default width used for the specified column. |
GetDefaultColumnLayout | protected | Gets the default vertical layout for text in the specified column. |
GetDefaultColumnReadOnly | protected | Gets the default setting for the ReadOnly flag in the specified column number. |
GetDefaultColumnTitle | protected | Gets the default text used as the column title for the specified column number. |
GetDefaultEditor | protected | Gets the default cell editor for the specified column. |
GetDefaultRowHeight | protected | Gets the default height for a row in the grid control. |
GetGridDrawState | protected | Gets the grid drawing state for the cell with the specified column and row numbers. |
GetImageForCheckBox | protected | Gets the bitmap used to draw check box columns in the grid. |
GetScrollBarPosition | protected | Gets the position for the specified scroll bar. |
GetSmoothScroll | protected | Gets the smooth scroll setting in the Options for the grid. |
GetSBVisibility | protected | Gets the values for the scroll bar visibility flags in the control. |
GetSBRanges | protected | Gets the range values for the scroll bars when visible. |
GetSelectedState | protected | Gets the effective selected state using the control Options and the grid draw state. |
GetEditMask | protected | Gets the edit mask for the specified cell. |
GetEditText | protected | Gets the text displayed in the Editor for the specified cell. |
GetFixedcolor | protected | Gets the value for the FixedColor property. |
GetFirstVisibleColumn | protected | Gets the column number for the first visible non-fixed column in the grid. |
GetFirstVisibleRow | protected | Gets the row number for the first visible non-fixed row in the grid. |
GetLastVisibleColumn | protected | Gets the column number for the last visible non-fixed column in the grid. |
GetLastVisibleRow | protected | Gets the row number for the last visible non-fixed row in the grid. |
GetSelectedColor | protected | Gets the value for the SelectedColor property. |
GetTitleShowPrefix | protected | Gets the prefix option for the title in the specified column number. |
GetPxTopLeft | protected | Gets a TPoint instance with the top and left coordinates for the first visible, non-fixed row in the grid control. |
GetTruncCellHintText | protected | Gets the truncated version of the hint for the cell at the specified position. |
GridColumnFromColumnIndex | protected | Gets the ordinal position in Columns for the visible column specified in ColumnIndex. |
GridMouseWheel | protected | Performs actions to apply a mouse wheel message to the grid control. |
HeaderClick | protected | Performs actions needed when a mouse click occurs in a fixed header for a grid column or row. |
HeaderSized | protected | Performs actions needed when a column or a row has been resized. |
HeaderSizing | protected | Performs actions to resize a column or row to the specified size. |
HideCellHintWindow | protected | Cancels the current hint display and restores the saved hint for the grid control. |
InternalSetColCount | protected | Performs actions needed to set the column count in the grid control. |
InvalidateCell | protected | Renders a cell invalid, and redraws the cell if required. |
InvalidateFromCol | protected | Invalidates cells starting at the specified column number; all rows from the start position are affected. |
InvalidateGrid | protected | Invalidates the client area for the grid control. |
InvalidateFocused | protected | Invalidates a focused or highlighted cell or row. |
IsColumnIndexValid | protected | Indicates if the specified index position is valid for the columns in the grid. |
IsRowIndexValid | protected | Indicates if the specified index position is valid for the rows in the grid. |
IsColumnIndexVariable | protected | True when the column index is in the range FixedCols..ColCount-1. |
IsRowIndexVariable | protected | Indicates if the specified row is a valid, non-fixed row in the grid control. |
GetIsCellTitle | protected | Indicates if the cell at the specified position is a fixed column header. |
GetIsCellSelected | protected | Gets the value for the indexed IsCellSelected property. |
IsEmptyRow | protected | Indicates if all non-fixed cells in the specified row are empty. |
IsMouseOverCellButton | protected | Indicates if the specified mouse position is over a cell defined with a button column cell editor. |
KeyDown | protected | Handles key down events for the grid control. |
KeyUp | protected | Signals the OnKeyUp event handler (when assigned). |
KeyPress | protected | Applies the specified key press character to the control. |
LoadContent | protected | Loads values for the grid control from the specified XML configuration file. |
LoadGridOptions | protected | Loads design-time values for the Options in a grid from an XML configuration file. |
Loaded | protected | Performs actions when the component has been loaded using LCL component streaming. |
LockEditor | protected | Locks the Editor so that it cannot accept input or changes. |
MouseButtonAllowed | protected | Indicates if the specified mouse button is a mouse down event used in the control. |
MouseDown | protected | Handles mouse down events for the grid control. |
MouseMove | protected | Applies a change in the mouse pointer position to the grid control. |
MouseUp | protected | Handles a mouse up event for the grid control. |
MoveExtend | protected | Moves the selected cell or extends a selection using the specified column and row values. |
MoveNextAuto | protected | Moves to the next cell in the auto-advance sequence. |
MoveNextSelectable | protected | Moves to the next selectable cell in the specified direction. |
MoveSelection | protected | Signals the OnSelection event handler for a new mouse selection. |
Notification | protected | Performs actions needed when the specified component is added to or removed from the control. |
OffsetToColRow | protected | Determines the index of a column or row for a the specified offset. |
Paint | protected | Draws the edges, borders, and rows in the grid control. |
PickListItemSelected | protected | Signals the OnPickListSelect event handler when a selection is made in a picklist. |
PrepareCanvas | protected | Prepares the canvas for drawing the cell at the specified location. |
PrepareCellHints | protected | Prepares the control to display hints for a cell. |
RangeContains | protected | Indicates whether the specified grid rectangle contains the specified cell coordinates. |
ResetDefaultColWidths | protected | Restores the default width for columns in the grid. |
ResetEditor | protected | Resets the value in the cell Editor, and optionally re-displays and selects it content. |
ResetLastMove | protected | Resets the member used to track the last row or column movement. |
ResetOffset | protected | Resets cached column (Top/Left) and row offsets. |
ResetSizes | protected | Resets the internal column sizes. |
ResizeColumn | protected | Resizes the specified column number to the given width. |
ResizeRow | protected | Resizes the specified row number to the given height. |
RowHeightsChanged | protected | Performs actions needed when the values in RowHeights have been changed. |
SaveContent | protected | Saves design-time configuration, column and row settings, and data to the specified XML configuration file. |
SaveGridOptions | protected | Saves grid options to the specified XML configuration file. |
ScrollBarRange | protected | Sets range information for the specified scroll bar. |
ScrollBarPosition | protected | Sets the position for the specified scroll bar to the given value. |
ScrollBarIsVisible | protected | Returns True if the specified scroll bar is visible. |
ScrollBarPage | protected | Updates the page size for the specified scroll bar. |
ScrollBarShow | protected | Displays or hides scroll bar(s) for the grid control. |
ScrollBarAutomatic | protected | Indicates whether an automatic scroll bar of the given type is used on the grid control. |
ScrollBy | protected | Scrolls the non-fixed area for the control by the specified delta values. |
SelectEditor | protected | Gets the cell editor for the current cell, and sets its PopupMenu. |
SelectCell | protected | Determines whether the specified cell can be selected in the grid control. |
SetCanvasFont | protected | Sets the Canvas font to the specified value. |
SetColCount | protected | Sets the value in the ColCount property. |
SetColor | protected | Sets the value in the Color property. |
SetColRow | protected | Makes the specified column and row a selected cell in the grid control. |
SetCursor | protected | Changes the cursor shape in the grid to the specified value. |
SetEditText | protected | Sets the value used in the cell Editor to the specified text. |
SetBorderStyle | protected | Sets the value for the BorderStyle property. |
SetFixedcolor | protected | Sets the value for the FixedColor property. |
SetFixedCols | protected | Sets the value for the FixedCols property. |
SetFixedRows | protected | Sets the value for the FixedRows property. |
SetRawColWidths | protected | Sets the width for the specified column number in the internal list. |
SetSelectedColor | protected | Sets the value for the SelectedColor property. |
SetFadeUnfocusedSelection | protected | Sets the value for the FadeUnfocusedSelection property. |
ShowCellHintWindow | protected | Gets and displays the cell hint(s) for the current cell in the grid. |
SizeChanged | protected | Performs actions needed when the number of columns or rows has been changed. |
Sort | protected | Sorts rows or columns in the grid. |
StartPushCell | protected | Starts an operation to render a cell in its "pushed" state. |
TopLeftChanged | protected | Signals the OnTopLeftChanged event handler (when assigned) at run-time. |
TryMoveSelection | protected | Tries to move the cell selection by or to the specified column and row values. |
TrySmoothScrollBy | protected | Scrolls the grid origin by the specified relative amounts. |
UnLockEditor | protected | Decrements the lock count for the cell Editor following a call to LockEditor. |
UnprepareCellHints | protected | Re-implemented in descendent classes. |
UpdateHorzScrollBar | protected | Updates the horizontal scroll bar to use the specified range, page, and position. |
UpdateSelectionRange | protected | Updates the selection range when the current selection in the grid has changed. |
UpdateVertScrollbar | protected | Updates the vertical scroll bar to use the specified visibility, range, and page values. |
UpdateBorderStyle | protected | Updates the border style used for the control. |
ValidateEntry | protected | Validates the value for the specified cell. |
VisualChange | protected | Updates the grid after changes to the visual properties in the control. |
WMSize | protected | Handles a WM_SIZE window message for the control. |
WMHScroll | protected | Handles the system message for horizontal scrolling. |
WMVScroll | protected | Handles the system message for vertical scrolling. |
WMKillFocus | protected | Handles the LM_KILLFOCUS message for the control. |
WMSetFocus | protected | Handles the LM_KILLFOCUS message for the control. |
WndProc | protected | Extends the message processing loop for the grid control. |
FlipRect | protected | Flips coordinates for the specified cell rectangle when BiDiMode or RTL alignment is used. |
FlipPoint | protected | Flips cell coordinates for the specified point on the parent rectangle when BiDiMode or RTL alignment is used. |
FlipX | protected | Flips the horizontal position in the client when BiDiMode or RTL alignment is used. |
Create | public | Constructor for the class instance. |
Destroy | public | Destructor for the class instance. |
Invalidate | public | Performs a request to redraw the control. |
EditingDone | public | Signals the OnEditingDone event handler. |
AdjustInnerCellRect | public | Adjusts the cell rectangle to account for grid lines drawn around a cell. |
AutoAdjustColumns | public | Automatically adjusts columns sizes to the width of their content. |
BeginUpdate | public | Begins an update to the grid control. |
CellRect | public | The coordinates for the specified cell (ACol, ARow) as a standard rectangle (TRect). |
CellToGridZone | public | Determines the grid zone for the specified cell. |
CheckPosition | public | Determines if the cell can be selected, or finds a suitable position using auto-advance. |
ClearCols | public | Clears the values in the FixedCols and Cols properties. |
ClearRows | public | Clears the cached fixed rows and row count values for the grid control. |
Clear | public | Clears all cells in the grid control. |
ClearSelections | public | Clears the current range selection(s) and redraws the grid control. |
EditorByStyle | public | Selects a cell Editor control with the specified style. |
EditorKeyDown | public | Implements the OnKeyDown event handler for the cell editor. |
EditorKeyPress | public | Implements the OnKeyPress event handler for the cell editor. |
EditorUTF8KeyPress | public | Implements the UTF-8 key press handler for the editor in the grid control. |
EditorKeyUp | public | Implements the OnKeyUp event handler for the cell editor. |
EditorTextChanged | public | Updates the grid control when the value in a cell Editor is changed. |
EndUpdate | public | Finishes an active update to the grid control. |
EraseBackground | public | Clears the background for the grid control. |
FixDesignFontsPPI | public | Adjusts fonts in the control to the specified design-time PixelsPerInch. |
Focused | public | Indicates if the grid is focused or has an active focused cell Editor. |
HasMultiSelection | public | Indicates if multi-select range selection mode is enabled and in use for the grid. |
HideSortArrow | public | Hides the arrow drawn as the sort indicator for a column. |
InvalidateCol | public | Invalidates all cells in the specified column, and causes them to be redrawn. |
InvalidateRange | public | Invalidates a cell range in the grid and causes it to be redrawn. |
InvalidateRow | public | Invalidates the drawing rectangle for the specified row number. |
IsCellVisible | public | Determines whether the specified cell is visible. |
IsFixedCellVisible | public | Determines if the specified cell is a visible fixed header cell in the grid. |
LoadFromFile | public | Loads grid data from a file with the specified file name. |
LoadFromStream | public | Loads grid data from the specified stream. |
MouseCoord | public | Gets the cell coordinates for the specified mouse pointer position. |
MouseToCell | public | Converts the specified mouse screen coordinates to cell coordinates. |
MouseToLogcell | public | Converts mouse coordinates to logical cell coordinates on the grid. |
MouseToGridZone | public | Converts the specified mouse coordinates to the grid zone where the coordinates are located. |
SaveToFile | public | Saves grid information to a file with the specified name. |
SaveToStream | public | Saves grid information to the specified stream. |
ScaleFontsPPI | public | Resizes fonts using a target PPI and a scaling factor. |
SetFocus | public | Gives focus to the grid control. |
Events
OnAfterSelection | protected | Event handler signalled after a new Selection is made in the grid. |
OnBeforeSelection | protected | Event handler signalled before changing the Selection in the grid control. |
OnCheckboxToggled | protected | Event handler signalled when the value for a check box cell is toggled. |
OnCompareCells | protected | Event handler signalled to compare the content in grid cells. |
OnPrepareCanvas | protected | Event handler signalled to prepare the Canvas to draw the grid. |
OnDrawCell | protected | Event handler signalled to draw a cell in the grid control. |
OnEditButtonClick | protected | Event handler signalled when the button in a cell Editor is clicked. Deprecated. |
OnButtonClick | protected | Event handler signalled when a button-style cell Editor control is clicked. |
OnPickListSelect | protected | Event handler signalled when an item is selected from a pick list-style Editor control. |
OnSelection | protected | Event handler signalled when an area is selected in the grid control. |
OnSelectEditor | protected | Event handler signalled to select an Editor control for the current grid cell. |
OnTopLeftChanged | protected | Event handler signalled when the top left cell in the visible area of the control is changed. |
OnUserCheckboxBitmap | protected | Event handler signalled to get the user-defined bitmap used for a check box cell. |
OnUserCheckboxImage | protected | Event handler signalled to get the user-defined image used for a check box cell. |
OnValidateEntry | protected | Event handler signalled to perform validation for a cell value. |
OnGetCellHint | protected | Gets the hint text for a cell. |
OnSaveColumn | protected | Event handler signalled when an entry in Columns is saved to a configuration file using the SaveContent method. |
OnLoadColumn | protected | Event handler signalled when a column is loaded in the LoadColumns method. |
Fields
fGridState | protected | Member with the current state for the grid (edited, updated, etc.). |
Inherited
From TCustomControl (5)
From TWinControl (211)
AddControl AlignControls AllAutoSized AutoAdjustLayout AutoSizeDelayed AutoSizeDelayedHandle AutoSizeDelayedReport AutoSizePhases BeginUpdateBounds BorderWidth BoundsLockCount BroadCast Brush BrushCreated CachedClientHeight CachedClientWidth CanFocus CanSetFocus CanTab ChangeScale ChildClassAllowed ChildHandlesCreated ChildKey ChildSizing ClientRectNeedsInterfaceUpdate CMBorderChanged CMDoubleBufferedChanged CMEnabledChanged CMEnter CMExit CMParentDoubleBufferedChanged CMShowHintChanged CMShowingChanged CMVisibleChanged CNChar CNKeyDown CNKeyUp CNSysKeyDown CNSysKeyUp ContainsControl ControlAtPos ControlCount ControlKeyDown ControlKeyUp Controls ControlsAligned CreateBrush CreateDockManager CreateHandle CreateParented CreateParentedControl CreateSubClass CustomAlignInsertBefore CustomAlignPosition DefaultHandler DefWndProc DesignerDeleting DisableAlign DoAddDockClient DoAdjustClientRectChange DoAlignChildControls DoAllAutoSize DoAutoSize DoChildSizingChange DockClientCount DockClients DockDrop DockManager DockOver DockSite DoConstraintsChange DoDockClientMsg DoDockOver DoDragMsg DoFlipChildren DoFloatMsg DoGetDockCaption DoKeyDownBeforeInterface DoKeyPress DoKeyUpBeforeInterface DoRemainingKeyDown DoRemainingKeyUp DoRemoveDockClient DoSendBoundsToInterface DoSendShowHideToInterface DoubleBuffered DoUnDock DoUndockClientMsg EnableAlign EndUpdateBounds FinalizeWnd FindChildControl FindNextControl FixDesignFontsPPIWithChildren FixupTabList FlipChildren FormEndUpdated GetAdjustedLogicalClientRect GetBorderStyle GetChildren GetChildrenRect GetClientOrigin GetClientRect GetControlIndex GetControlOrigin GetDeviceContext GetDockCaption GetEnumeratorControls GetEnumeratorControlsReverse GetMouseCapture GetParentHandle GetPreferredSizeClientFrame GetSiteInfo GetTabOrderList GetTextLen GetTopParentHandle Handle HandleAllocated HandleNeeded InitializeWnd InsertControl IntfGetDropFilesTarget IntfUTF8KeyPress InvalidateBoundsRealized InvalidateClientRectCache InvalidatePreferredChildSizes IsClientHeightStored IsClientWidthStored IsControlMouseMsg IsFlipped IsResizing IsSpecialSubControl KeyDownAfterInterface KeyDownBeforeInterface KeyUpAfterInterface KeyUpBeforeInterface LockRealizeBounds MainWndProc NotifyControls OnAlignInsertBefore OnAlignPosition OnDockDrop OnDockOver OnEnter OnExit OnGetDockCaption OnGetSiteInfo OnKeyDown OnKeyPress OnKeyUp OnUnDock OnUTF8KeyPress PaintControls PaintHandler PaintTo ParentDoubleBuffered ParentFormHandleInitialized ParentHandlesAllocated ParentWindow PerformTab RealGetText ReAlign RealizeBounds RealizeBoundsRecursive RealSetText ReloadDockedControl RemoveControl RemoveFocus Repaint ScaleBy ScaleControls ScrollBy_WS SelectFirst SelectNext SendDialogChar SendMoveSizeMessages SetBounds SetChildZPosition SetControlIndex SetDockManager SetShape SetTempCursor ShowControl Showing TabOrder UnlockRealizeBounds Update UpdateControlState UpdateDockCaption UpdateShowing UseDockManager UTF8KeyPress VisibleDockClientCount WindowHandle WMChar WMContextMenu WMDestroy WMEnter WMEraseBkgnd WMExit WMKeyDown WMKeyUp WMMove WMNotify WMShowWindow WMSysChar WMSysKeyDown WMSysKeyUp WMWindowPosChanged WriteLayoutDebugReport WSSetText
From TControl (344)
AccessibleDescription AccessibleName AccessibleRole AccessibleValue Action ActionChange ActionLink ActiveDefaultControlChanged AddHandler AddHandlerOnBeforeDestruction AddHandlerOnChangeBounds AddHandlerOnEnabledChanged AddHandlerOnEnabledChanging AddHandlerOnKeyDown AddHandlerOnMouseWheel AddHandlerOnResize AddHandlerOnVisibleChanged AddHandlerOnVisibleChanging AdjustSize Align AnchorAsAlign AnchorClient AnchoredControlCount AnchoredControls AnchorHorizontalCenterTo AnchorParallel Anchors AnchorSame AnchorSide AnchorSideBottom AnchorSideChanged AnchorSideLeft AnchorSideRight AnchorSideTop AnchorToCompanion AnchorToNeighbour AnchorVerticalCenterTo AutoSize AutoSizing AutoSizingAll AutoSizingLockCount BaseBounds BaseParentClientSize BeforeDestruction BeforeDragStart BeginAutoSizing BeginDrag BiDiMode BorderSpacing BoundsChanged BoundsRect BoundsRectForNewParent BringToFront CalculateDockSizes CanAutoSize Caption CaptureChanged CaptureMouseButtons ChangeBounds Changed CheckChildClassAllowed CheckNewParent CheckOnChangeBounds ClientHeight ClientOrigin ClientRect ClientToParent ClientToScreen ClientWidth CMChanged CMCursorChanged CMHintShow CMHitTest CMParentBiDiModeChanged CMParentColorChanged CMParentFontChanged CMParentShowHintChanged CMSysFontChanged CMTextChanged CNPreferredSizeChanged Color ColorIsStored ConstrainedResize Constraints ControlFontClass ControlOrigin ControlState ControlStyle ControlToScreen CreateAccessibleObject CreateControlBorderSpacing CreateFloatingDockSite Cursor DesktopFont DisableAutoSizing DoBorderSpacingChange DoCallKeyEventHandler DoCallMouseWheelEventHandler DoCallNotifyHandler Dock Docked DockOrientation DockTrackNoTarget DoContextPopup DoDock DoEndDock DoEndDrag DoFixDesignFontPPI DoMouseDown DoMouseUp DoMouseWheelHorz DoOnParentHandleDestruction DoOnShowHint DoScaleFontPPI DoStartDock DoStartDrag DragCanceled DragCursor DragDrop Dragging DragKind DragMode DragOver EnableAutoSizing Enabled EnabledChanged EnabledChanging EndAutoSizing EndDrag ExecuteCancelAction ExecuteDefaultAction FindSubComponent Floating FloatingDockSiteClass Font ForeignAnchorSideChanged FormIsUpdating GetAccessibleObject GetAction GetActionLinkClass GetAnchorsDependingOnParent GetCachedText GetCanvasScaleFactor GetChildAccessibleObjectAtPos GetClientScrollOffset GetColorResolvingParent GetControlClassDefaultSize GetCursor GetDefaultColor GetDefaultDockCaption GetDefaultHeight GetDefaultWidth GetDockEdge GetDragImages GetEnabled GetFloating GetFloatingDockSiteClass GetLogicalClientRect GetMousePosFromMessage GetPalette GetParentBackground GetParentComponent GetPopupMenu GetPreferredSize GetRGBColorResolvingParent GetScrolledClientRect GetSelectedChildAccessibleObject GetSidePosition GetTextBuf GetTopParent HandleObjectShouldBeVisible HasHelp HasParent Height HeightIsAnchored HelpContext HelpKeyword HelpType Hide Hint HostDockSite InitiateAction InvalidateControl InvalidatePreferredSize IsAParentAligning IsBorderSpacingInnerBorderStored IsCaptionStored IsControl IsControlVisible IsEnabled IsParentColor IsParentFont IsParentOf IsProcessingPaintMsg IsRightToLeft IsVisible Left LMCaptureChanged LoadedAll LRDockWidth ManualDock ManualFloat MouseCapture MouseEnter MouseInClient MouseLeave OnChangeBounds OnClick OnConstrainedResize OnContextPopup OnDblClick OnDragDrop OnDragOver OnEditingDone OnEndDock OnEndDrag OnMouseDown OnMouseEnter OnMouseLeave OnMouseMove OnMouseUp OnMouseWheel OnMouseWheelDown OnMouseWheelHorz OnMouseWheelLeft OnMouseWheelRight OnMouseWheelUp OnQuadClick OnResize OnShowHint OnStartDock OnStartDrag OnTripleClick Parent ParentBackground ParentBiDiMode ParentColor ParentDestroyingHandle ParentFont ParentFontChanged ParentShowHint ParentToClient Perform PopupMenu PositionDockRect QuadClick ReadBounds ReadState Refresh RemoveAllHandlersOfObject RemoveHandler RemoveHandlerOnBeforeDestruction RemoveHandlerOnChangeBounds RemoveHandlerOnEnabledChanged RemoveHandlerOnEnabledChanging RemoveHandlerOnKeyDown RemoveHandlerOnMouseWheel RemoveHandlerOnResize RemoveHandlerOnVisibleChanged RemoveHandlerOnVisibleChanging ReplaceDockedControl RequestAlign Resize Scale96ToFont Scale96ToForm Scale96ToScreen ScaleConstraints ScaleDesignToForm ScaleFontTo96 ScaleFontToScreen ScaleFormTo96 ScaleFormToDesign ScaleScreenTo96 ScaleScreenToFont ScreenToClient ScreenToControl SendToBack SessionProperties SetAction SetAlign SetAnchors SetAutoSize SetBiDiMode SetBoundsKeepBase SetDragMode SetEnabled SetHint SetInitialBounds SetName SetParent SetParentBackground SetParentBiDiMode SetParentComponent SetTextBuf SetVisible SetZOrder ShouldAutoAdjust Show ShowHelp ShowHint TBDockHeight Text TextChanged Top TripleClick UndockHeight UndockWidth UpdateAnchorRules UpdateBaseBounds UpdateMouseCursor UpdateRolesForForm UseRightToLeftAlignment UseRightToLeftReading UseRightToLeftScrollBar Visible VisibleChanged VisibleChanging Width WidthIsAnchored WindowProc WMCancelMode WMLButtonDBLCLK WMLButtonDown WMLButtonQuadCLK WMLButtonTripleCLK WMLButtonUp WMMButtonDBLCLK WMMButtonDown WMMButtonQuadCLK WMMButtonTripleCLK WMMButtonUp WMMouseHWheel WMMouseMove WMMouseWheel WMRButtonDBLCLK WMRButtonDown WMRButtonQuadCLK WMRButtonTripleCLK WMRButtonUp WMXButtonDBLCLK WMXButtonDown WMXButtonQuadCLK WMXButtonTripleCLK WMXButtonUp
From TLCLComponent (6)
DecLCLRefCount GetWSComponentClass IncLCLRefCount LCLRefCount NewInstance WidgetSetClass
From TComponent (64)
_AddRef _Release CanObserve ChangeName ComObject ComponentCount ComponentIndex Components ComponentState ComponentStyle DesignInfo DestroyComponents Destroying ExecuteAction FindComponent FreeNotification FreeOnRelease GetChildOwner GetChildParent GetDeltaStreams GetEnumerator GetIDsOfNames GetNamePath GetObservers GetOwner GetTypeInfo GetTypeInfoCount iicrGetComponent InsertComponent Invoke IsImplementorOf Loading Name ObserverAdded Observers OnGetDeltaStreams Owner PaletteCreated QueryInterface ReadDeltaState ReadDeltaStream ReferenceInterface RemoveComponent RemoveFreeNotification RemoveFreeNotifications SafeCallException SetAncestor SetChildOrder SetDesigning SetDesignInstance SetInline SetSubComponent Tag ToString TToStringNameMode UpdateAction Updated UpdateRegistry Updating ValidateContainer ValidateInsert ValidateRename VCLComObject WriteState
From TPersistent (4)
Assign FPOAttachObserver FPODetachObserver FPONotifyObservers
From TObject (35)
AfterConstruction CheckDisposed ClassInfo ClassName ClassNameIs ClassParent ClassType CleanupInstance DefaultHandlerStr Dispatch DispatchStr Disposed DisposeOf Equals FieldAddress Free FreeInstance GetDisposed GetHashCode GetInterface GetInterfaceByStr GetInterfaceEntry GetInterfaceEntryByStr GetInterfaceTable GetInterfaceWeak GetLastCastErrorInfo InheritsFrom InitInstance InstanceSize MethodAddress MethodName QualifiedClassName StringMessageTable SystemHasExtendedRTTI UnitName
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
