onCellPaint
Topic group Related topics Example
An event fired right after a grid cell is painted.
Parameters
<bSelectedRow>
bSelectedRow is true if the grid cell being painted is part of a selected row. Otherwise bSelectedRow is false
Property of
ColumnCheckBox, ColumnComboBox, ColumnEditor, ColumnEntryField, ColumnHeadingControl, ColumnSpinBox
Description
Use the onCellPaint event to change the settings of a GridColumn's editorControl or headingControl just after the control is used to paint a grid cell.
The onCellPaint event should be used after a beforeCellPaint event has changed the properties of a GridColumn's editorControl or headingControl. You must use the onCellPaint event to set the control back to its prior state or to its default state. Otherwise, the changes made in the beforeCellPaint event will affect the other cell's within the same grid column.
Using onCellPaint
In order to use onCellPaint, a grid must be created with explicitly defined GridColumn objects (accessible through the grid's columns property).
In an onCellPaint event handler, you can change an editorControl's or headingControl's properties based (optionally) on the current value of the cell. Within onCellPaint, the current cell value is contained in this.value.
Initializing a Grid that uses onCellPaint
When a form opens, a grid on the form is usually painted before the code setting up any onCellPaint( ) event handlers is executed. Therefore, you should call the grid's refresh( ) method from the form's onOpen event to ensure the grid is painted correctly when the form opens.
Warning: The grid's painting logic is optimized to only load an editorControl's value when it needs to paint it, or give it focus. This means the value loaded into other column's editorControls may not be from the same row as the one used for the currently executing onCellPaint event. You should, instead, use the values from the appropriate rowset field objects in order to ensure you are using values from the correct row.