coloring text
Hedley
Peru
Please , how i can print diferent color text depending it's value
example
red if value is "NS"
green if value is "S"
and so on....
Thanks
Hedley
example
red if value is "NS"
green if value is "S"
and so on....
Thanks
Hedley
Comments
or set the the objects conditional highliting props.
see the user manual under formatting,highlight.
Hedley
Please, i tried but i obtained a box filled red with the text black instead of red text
on case the field value is NS,S,B,D or O, the color of text change
the fields is [alum1m."AS1"]
i need to obtain something like this
please.. help
alum1mAS1OnBeforePrint content is
begin
alum1mAS1.Font.Color:=clRed
end.
and its work
if alum1mAS1.Value ='B' then alum1mAS1.Font.Color:=clRed dont work
if [alum1mAS1.Value] ='B' then alum1mAS1.Font.Color:=clRed dont work
if (alum1mAS1.Value)='B' then alum1mAS1.Font.Color:=clRed dont work
if <alum1m."AS1">='B' then alum1mAS1.Font.Color:=clRed dont work
how is the correct sintaxt to compare
thanks
hedley
this should work when used in the obp event of either the band or memoview.
you will need an if statement for each possible value of the field alum1m."as1" note
either use an else portion as above or reset to a certain color in the oap event of the memo.
Dear gordk :
The Code for
alum1mAS1:TfrxMemoView
alum1mAS1OnBeforePrint
begin
if (<alum1m."AS1">)='NS' then alum1mAS1.Font.Color:=clRed else alum1mAS1.Font.Color:=clGreen
end.
but always its prints Green, like this image
but you can see that exist values "NS", then it must be in Red
i change the if statement for case
begin
case <alum1m."AS1"> of
'BB':alum1mAS1.Font.Color:=clBlack;
'DD':alum1mAS1.Font.Color:=clMaroon;
'NS':alum1mAS1.Font.Color:=clRed;
'OO':alum1mAS1.Font.Color:=clBlue;
'SS':alum1mAS1.Font.Color:=clGreen;
else alum1mAS1.Font.Color:=clYellow
end;
end.
but now all the text are black...
Hedley
Dear gordk :
The Code for
alum1mAS1:TfrxMemoView
alum1mAS1OnBeforePrint
begin
if (<alum1m."AS1">)='NS' then alum1mAS1.Font.Color:=clRed else alum1mAS1.Font.Color:=clGreen
end.
but always its prints Green, like this image
but you can see that exist values "NS", then it must be in Red
Hedley
then your datafield is not returning "NS' since you have centered the text in the memo object
it is possible that it may be returning something like ' NS' or 'NS ' that has leading or trailing blanks.
if (<alum1m."AS1">)='NS' this could be written
if <alum1m."AS1"> ='NS'
Dear gordk :
please explain to me something i dont understand
alum1mAS1:TfrxMemoView
alum1mAS1OnBeforePrint
begin
if <alume."AS1">='D' then alum1mAS1.Font.Color:=clBlue else alum1mAS1.Font.Color:=clFuchsia
end.
the values of de registers are
D
O
S
B
The first time i execute preview the report ( in design mode ) all are blue
after that, the next preview all are fuchsia... why ?
where are the problem....
I need D Blue, O Green, S Red and B Fuchsia
thanks
Hedley
you can reset it to a basic value in an "else" portion or use the oap event of the object.
you need multiple if statements to set up each possibile value of the datafield.
you could use a case statement if your test value was numeric.
i found the error ....
i dont know why, but it do not create the procedure
procedure alum1mAS1OnBeforePrint(Sender: TfrxComponent);
then all the sentences are in the wrong place...
i create a new form to test, and i see that the procedure was created...
wrote the sentences and it works...
this is the final
procedure alum1mAS1OnBeforePrint(Sender: TfrxComponent);
begin
if <alumE."AS1">='B' then alum1mAS1.font.color:=clBlack
else if <alumE."AS1">='D' then alum1mAS1.font.color:=clMaroon
else if <alumE."AS1">='NS' then alum1mAS1.font.color:=clRed
else if <alumE."AS1">='S' then alum1mAS1.font.color:=clGreen
else if <alumE."AS1">='O' then alum1mAS1.font.color:=clNavy
else alum1mAS1.font.color:=clNone
end;
i test the case sentence and it works too... but i finally do with if sentences....
thanks a lot, and i'm sorry for your time
Hedley