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.

Comments

  • guzialguzial Poland
    edited 11:42AM
    try to use property of Memo -> "highlight" there you give contidion, and you can change by that colour of background and font etc.

    sorry for my english
  • gordkgordk St.Catherines On. Canada.
    edited 11:42AM
    I agree with quizal
    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]
    ;)



Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.