I have the following code
procedure TfrmJsApplications.colMaintStylesGetContentStyle(
Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
var
aColumn: TcxCustomGridTableItem;
aValue: Variant;
begin
inherited;
try
aColumn := Sender.FindItemByName('colApplication_Doc');
aValue := aRecord.Values[aColumn.Index];
if VarToStr(aValue) <> '' then
colMaint.Properties.Buttons[0].Caption := 'Redigere'
else
colMaint.Properties.Buttons[0].Caption := 'Opret'
except
on E:exception do
Logfile.Error('F_JsApplications.colMaintStylesGetContentStyle: ' + E.Message);
end;
running on a column in a cxGrid. But for some reason that I simply can't figure out the line
if VarToStr(aValue) <> '' then
makes the function crash. I know that it is when aValue becomes a Null value but as far as I can figure out the VarToStr should return '' in this case