delphi - Why is this wrong -
i have next code
procedure tfrmjsapplications.colmaintstylesgetcontentstyle( sender: tcxcustomgridtableview; arecord: tcxcustomgridrecord; aitem: tcxcustomgridtableitem; out astyle: tcxstyle); var acolumn: tcxcustomgridtableitem; avalue: variant; begin inherited; seek acolumn := sender.finditembyname('colapplication_doc'); avalue := arecord.values[acolumn.index]; if vartostr(avalue) <> '' colmaint.properties.buttons[0].caption := 'redigere' else colmaint.properties.buttons[0].caption := 'opret' except on e:exception logfile.error('f_jsapplications.colmaintstylesgetcontentstyle: ' + e.message); end; running on column in cxgrid. reason can't figure out line
if vartostr(avalue) <> '' makes function crash. know when avalue becomes null value far can figure out vartostr should homecoming '' in case
the avalue not null empty. seek utilize check like
if(findvardata(avalue)^.vtype in [varnull, varempty])then ... instead. or
if varisempty(avalue) or varisnull(avalue) delphi devexpress variant tcxgrid
No comments:
Post a Comment