Skip to main content

Focusing Cells Programmatically

To determine the position of the focused cell, use the ViewData.FocusedCell property. This property’s value is represented by the TPoint record whose X and Y properties identify the column index and row index of the focused cell, respectively. These values can be used to get the summary information on the data cells displayed by the pivot grid via the pivot grid’s ViewData.Cells property. The display text of the cells can be obtained via the ViewData.CellsAsText property.

The focused cell is painted with a dotted rectangle around it. The appearance settings used to paint the focused cell are specified by the pivot grid’s Styles.Selected and Styles.Inactive properties, for the active and inactive states of the control (when it loses focus), respectively.

Since focusing a cell automatically selects it, you can handle the OnSelectionChanged event to perform specific actions after the focused cell has been changed.

See Also