I use the event OnCustomDrawCell of TcxGridDBDataController to change the font row color of a DevExpress TcxGrid to red if a certain Field of the displayed record (e.g 'Debit' has value 1)
if Sender.DataController.GetValue(AViewInfo.GridRecord.RecordIndex, 15) = 1 then
begin
ACanvas.Font.Color := clRed;
end;
The above code works if field 'Debit' has recordIndex 15. But if I change the order of fields it stops working (because recordindex is not 15 anymore).
Instead of Recordindex I would like to use the fieldname 'Debit' in order to check the value.
I would be grateful of someone could help change the above code so that it works regardless of the position of field 'Debit'.
Thank you