I am trying to convert a comple TDBGrid to a TDBAdvGrid. I am using OnDrawColumnCell to perform some color changes on particular cells based on user change of cell value and also a dataset connected. I cannot find an event to mimic this in DBADVGrid. The code is simple but effective need to know what event and similar parameters I can use with TDBAdvGrid. Your help would be GREATLY appreciated.
CODE SAMPLE:
procedure TfrmInvoiceSalesOrders.DBGrid1DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);
var
Field: TField;
begin
Field := Column.Field;
if Assigned(Field) and SameText(Field.FieldName, 'OpenQty') then
begin
if Field.AsInteger = cdsOpenOrders.FieldByName('SOD_TOSHP').Value then
DBGrid1.Canvas.Brush.Color := clAqua
end;
if Assigned(Field) and SameText(Field.FieldName, 'SOD_TOSHP') then
begin
if cdsOpenOrdersSOD_TOSHP.Value > 0 then
begin
DBGrid1.Canvas.Brush.Color := clMoneyGreen ;
DbGrid1.canvas.Font.Color := clBlack ;
end
else
begin
DBGrid1.Canvas.Brush.Color := clMedGray ;
DBGrid1.Canvas.Font.Color := clBlack ;
end;
// if (gdSelected in State) then
// begin
// Dbgrid1.Canvas.Brush.Color := $4bf92e ;
// dbGrid1.Canvas.Font.Style := font.Style + [ fsBold ] ;
// DBGrid1.Canvas.Font.Color := clHighlightText ;
//
// end;
end;
if Assigned(Field) and SameText(Field.FieldName, 'InvOnh') then
begin
if Field.AsInteger <= 0 then
DBGrid1.Canvas.Brush.Color := clRed
end;
if (gdSelected in State) then
begin
Dbgrid1.Canvas.Brush.Color := $4bf92e ;
dbGrid1.Canvas.Font.Style := font.Style + [ fsBold ] ;
DBGrid1.Canvas.Font.Color := clHighlightText ;
end;
if Assigned(Field) and SameText(Field.FieldName, 'SOD_CLOSE') then
begin
DrawCheckBoxes(Sender,Rect,Column);
end
else DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
end;