Previously with the default DBGrid I could alter the value of a cell without altering the data in a database with the following code.
procedure TEMRForm.DBGridCDrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
if Column.FieldName = 'START_DATE' then
begin
DBGridC.Canvas.FillRect(Rect);
DBGridC.Canvas.TextOut(Rect.Left+2,Rect.Top+2,Column.Field.Text + ' *');
end;
end;
Which worked great, but I am having trouble implementing this same kind of functionality on a cxgrid. Here is my current code which shows no indication of the cell value being changed.
procedure TEMRForm.cxGridCDBTableView1CustomDrawCell(
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
var
ARect: Trect;
begin
ARect := AViewInfo.Bounds;
if AViewInfo.Item.Caption = 'Start Date' then
begin
ACanvas.FillRect(ARect);
ACanvas.TextOut(ARect.Left+2,ARect.Top+2,TableC.FieldByName('START_DATE').AsString+' *');
end;
end;