Example 6: Logging a bad graphic cell

Uses OnGraphicError so a corrupt or unrecognized image is reported somewhere useful, instead of just being silently left blank in the grid.

Scenario

A Photo field declared as ftGraphic. Some rows have leftover data from a previous, unsupported image format. The cell should stay blank - there is no image to show - but the problem should be visible in the application log rather than only in the grid appearing empty.

Note: This only applies to a true ftGraphic field. A plain BLOB field opted in via DetectBlobImages that fails to decode is treated as an expected outcome, not a malfunction - the cell falls back to showing the field’s own display text, and OnGraphicError does not fire for it at all. See DetectBlobImages.

The handler

procedure TfrmOrders.GridGraphicError(Column: TColumn; const Msg: string);
begin
  AppLog.Warn(Format('Failed to decode image in %s, record %s: %s',
    [Column.FieldName, Table.FieldByName('ID').AsString, Msg]));
end;

Why it works this way

See Also

(C) 2026 Easygate, Lda