These events run in the current Extended Grid cell and record context. In addition to their named arguments, the current row, column and entry values can be available in the formula environment.
Common argument limitation: Argument_SenderName and Argument_SenderID are populated, but Argument_EventName is empty for all Extended Grid events because the component does not provide its current formula name to the common argument registration.
OnInit runs at the beginning of a full grid refresh, before the grid data is processed. It has no event-specific arguments, and its Result is ignored.
OnBeforeInsertRecord runs before a standard cell inserts a new database record as part of saving its value. The Result is ignored. The current cell is described by Argument_CellX, Argument_CellY, Argument_CellValue, Argument_CellType and Argument_CurrentValueEntryName.
OnBeforePopup runs before an Extended Grid popup-menu item is shown. It receives the popup name, current cell and record data, the value array and applicable dynamic column-entry values. The declared Argument_Level is not populated.
Result and outputs: Result is ignored. Set Out_Visible to show or hide the item and Out_Caption to replace its caption.
Example: Hide a popup item named Delete.
if Argument_PopupName = "Delete" then
Out_Visible := False;
OnButtonClick runs when a cell button is clicked. The Result is ignored. Argument_DataIDArray contains the available row record identifiers and Argument_DataIDCount gives their count. Set Out_RefreshGrid to TRUE to reload the complete grid after the formula.
OnCalculateDataCell handles multiple source values assigned to one basic data cell. It receives Argument_CellX, Argument_CellY, Argument_CurrentValueEntryName, Argument_ValueCount and Argument_ValueArray. The runtime also sets the undeclared Argument_CellType and applicable dynamic aggregation values.
Result: Becomes the cell's new value. Configuring a valid formula also makes the entire grid read-only and causes SaveGrid to return without saving.
Example: Display the number of source values in the cell.
Result := Argument_ValueCount;
OnGetCellFormula is defined with cell coordinates, value, type and current entry name, and its metadata requests a Result. The processing code reads the formula object but never executes it: there is no corresponding CalcFormula call. It currently has no working runtime or Result contract.
Example after a future implementation is connected: Preserve the current cell value.
Result := Argument_CellValue;
OnCellEditFinished runs after a cell edit has been accepted and its value has been updated, before the following grid recalculation. Its Result is ignored. Argument_CellX and Argument_CellY identify the edited data cell, Argument_CellValue contains its new value, Argument_CurrentValueEntryName contains the associated entry name and Argument_DataID identifies the current record. The current record's entry values are also available in the formula environment.
OnSaveCalculatedCell runs while saving a changed, non-standard calculated, header or footer cell. It receives Argument_CellX, Argument_CellY, Argument_CellValue, Argument_CellType, Argument_CurrentValueEntryName and Argument_FormulaName, together with the applicable dynamic aggregation values. Its Result is ignored. After the script completes successfully, the cell is marked as saved; if the script fails, the cell remains changed.
OnSaveStateChanged runs when the grid's internal save-required state changes. Its Result is ignored. The declared Argument_NeedToSave should describe the new state, but the current implementation always passes False, including transitions that actually require saving.
Example: Store the reported state. Until the implementation is corrected, this always stores False.
CIP_SetRuntimeVariable("ExtendedGridNeedsSave", Argument_NeedToSave);
OnGetCellColor runs for each normal grid cell. Its Result is the cell background color as a Delphi TColor value. Argument_Color contains the original color. Set Out_FontBold and Out_FontItalic to change the font style.
OnGetFixedCellColor runs for fixed header and row-header cells. It receives Argument_CellType, Argument_CellValue, Argument_AggregationName and Argument_Level. The runtime also sets the undeclared Argument_Color to the original background color.
Result: Becomes the fixed cell's background color as a Delphi TColor.
Example: Keep the original color except at hierarchy level zero.
if Argument_Level = 0 then
Result := 255
else
Result := Argument_Color;
OnGetHeaderColor, OnGetFooterColor, OnGetGroupHeaderColor and OnGetGroupFooterColor use the same contract for their respective cell types. The Result is the background color as a Delphi TColor value. Argument_Color contains the original color, while Out_FontBold and Out_FontItalic control the font style.
OnGetCellReadOnly runs for each applicable grid cell. Its Boolean Result becomes the cell's read-only state. The formula receives Argument_CellX, Argument_CellY, Argument_CellValue, Argument_CurrentValueEntryName, Argument_CellReadOnly, Argument_CellType, Argument_DataID and Argument_RowExists. Dynamic entry and aggregation values can also be available. Non-primary merged cells and cells with fixed DataText are skipped.
OnGetCellTooltip returns the text shown as the current cell's tooltip. It receives the cell coordinates, value, entry name, type, record ID and row-exists flag. The declared Argument_CellReadOnly is not populated. If the cell has a non-empty fixed DataText, the method returns an empty tooltip without executing the formula.
Example: Show the cell's associated entry name.
Result := Argument_CurrentValueEntryName;
OnGetColumnWidth runs for every data column. Argument_CellX is the zero-based data-column index, Argument_ColumnWidth is its current width and Argument_CurrentValueEntryName is the associated entry name. Applicable column aggregation values are exposed as Argument_Col_<EntryName>. The numeric Result becomes the column width.
OnGetAggregationColumnWidth runs for every aggregation column in the left header. Argument_ColumnIndex contains its zero-based index and Argument_ColumnWidth contains its current width. The numeric Result becomes the aggregation-column width.
OnGetRowHeight runs for each row with Argument_RowIndex, Argument_RowHeight, Argument_RowType and Argument_RowVisible. Its Result becomes the row height. The declared Argument_CurrentValueEntryName remains empty because the implementation checks the grid cell itself for an aggregation-node type instead of checking the cell's Data object.
Example: Add four pixels to the current row height.
Result := Argument_RowHeight + 4;
OnGetComponentValue runs when CIP_GetComponentValueByName requests the Extended Grid's value. It receives current cell coordinates, value, entry name, cell type and aggregation name. The declared Argument_DataID assignment is commented out in the implementation and is not reliable.
Result: Becomes the component value returned to the calling formula.
Example: Return the current cell value.
Result := Argument_CellValue;
OnSetColumnHeader runs for every column-header cell. It receives coordinates, colors, values, type and aggregation name. The declared Argument_CurrentValueEntryName and Argument_CellReadOnly are not populated; the runtime instead adds the undeclared Argument_Level.
Result and outputs: Result is ignored. Out_FontBold, Out_FontItalic, Out_CellText, Out_CellColor and Out_TextColor modify the header.
Example: Make top-level column headers bold.
if Argument_Level = 0 then
Out_FontBold := True;
OnSetRowHeader applies the same five output variables to row-header cells. As with column headers, Argument_CurrentValueEntryName and Argument_CellReadOnly are declared but not populated, while the undeclared Argument_Level is available.
Result: Ignored; use the Out_ variables for formatting.
Example: Italicize nested row headers.
if Argument_Level > 0 then
Out_FontItalic := True;
OnGetTitle customizes a formula's displayed title. It receives Argument_FormulaName, Argument_FormulaTitle, Argument_FormulaType and Argument_FormulaIndex. Its Result, converted to text, becomes the displayed title. If the result is Null, the original formula caption is retained.
// Make the Quantity column wider while preserving other widths.
if Argument_CurrentValueEntryName = "Quantity" then
Result := 120
else
Result := Argument_ColumnWidth;
// Make Total cells read-only without removing an existing restriction.
Result := Argument_CellReadOnly or
(Argument_CurrentValueEntryName = "Total");
// Add a suffix to a displayed formula title.
Result := Argument_FormulaTitle + " (calculated)";