How to set the backcolor of the cells
Write the follow code into the frMemoView "Memo3" of a FastReport, to made the backcolor different of Memo3 when it's value less than 14, otherwise, made the backcolor white. But the code not work! The result show the backcolor are "clMenu" of the whole column of Memo3. Why? And, how to get the value of the field of the frMemoView by the code into frMemoView?
begin
S:= Memo3.Memo;
if S = '' then
S:= '0';
if StrToInt(S) < 14 then
Memo3.FillColor:= clMenu
else
Memo3.FillColor:= clWhite;
end
Grateful!
Cable Fan.
begin
S:= Memo3.Memo;
if S = '' then
S:= '0';
if StrToInt(S) < 14 then
Memo3.FillColor:= clMenu
else
Memo3.FillColor:= clWhite;
end
Grateful!
Cable Fan.
Comments
sorry for my english
best place is conditional highlight property of memo, since you can also modify font color to suit bgcolor.
just to explain what is happening with your script
begin
S:= Memo3.Memo;
if S = '' then
S:= '0';
s is probably always equal to 0
if StrToInt(S) < 14 then
so you always end up here
Memo3.FillColor:= clMenu
else
Memo3.FillColor:= clWhite;
end
first a memo's.memo has either a .text prperty which is all text in memo or
memo3.memo[0] indexed for each line.
also if your memo contains a datafield or variable which is already an integer or number, ie [tblname."fieldname"] you could use it directly in the conditional expression ie. [[tblname."fieldname"] < 14]