Examples

Six worked examples, each built around one event and a small, realistic scenario. Every example shows a complete handler, not just a fragment, and explains the parts that are easy to get wrong (timing, what has already been resolved, what a handler is and is not responsible for).

These six were chosen to cover the event surface with the least overlap: most of TEgDBGridEx’s remaining click events (OnTitleCellClick, OnCellDblClick, OnCellRightClick/OnTitleCellRightClick) share the same simple procedure(Column: TColumn) shape already covered here; OnRowClick is a plain mouse event instead (Button, Shift, X, Y, no Column parameter), close enough to a standard OnMouseDown handler to need no separate example. The image-click family (OnTitleImageClick, OnCornerImageClick, OnBeforeDrawTitle) is a close variant of OnCellImageClick, noted briefly there rather than repeated as its own example.

Sub-chapters

Page Event Scenario
Example 1: Conditional formatting and a computed column OnBeforeDrawCell Highlight negative amounts; add a Custom Cell column with a value computed from other fields
Example 2: A per-row action icon OnCellImageClick A “delete this row” icon that reacts to a click without touching OnCellClick
Example 3: Reacting to a checkbox toggle OnCheckChange Keep a related field in sync when a boolean field is toggled
Example 4: Applying the sort to the dataset OnSortChange Reorder a table-type and a query-type dataset after a title click
Example 5: Synthetic placeholders in delete prompts OnGetVariableValue Resolve a <var> placeholder that is not a dataset field
Example 6: Logging a bad graphic cell OnGraphicError Report a decode failure instead of leaving it silent

See Also

(C) 2026 Easygate, Lda