Uses OnGraphicError
so a corrupt or unrecognized image is reported somewhere useful, instead
of just being silently left blank in the grid.
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
ftGraphicfield. A plain BLOB field opted in viaDetectBlobImagesthat fails to decode is treated as an expected outcome, not a malfunction - the cell falls back to showing the field’s own display text, andOnGraphicErrordoes not fire for it at all. SeeDetectBlobImages.
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;
Msg is short and not localized -
currently always the fixed text
'Unsupported graphic format', not something meant to be
shown to an end user directly. Still worth logging as-is rather than a
hardcoded string of your own, since a future version could make it more
specific without changing the handler’s signature. Show a separate,
translated message to the user if the application needs to say something
in the UI about it.