Change color to a row
Hi,
I have a this db
01/01/2000
01/01/2000
02/01/2000
03/01/2000
I?¬d like to improve visibility of a single day changing color to the whole row in this way
01/01/2000 ->clBlue
01/01/2000 ->clBlue
02/01/2000 ->clBlack
03/01/2000 ->clBlue
03/01/2000 ->clBlue
Is that possible? And in wich way?
Thanks
miyomo
I have a this db
01/01/2000
01/01/2000
02/01/2000
03/01/2000
I?¬d like to improve visibility of a single day changing color to the whole row in this way
01/01/2000 ->clBlue
01/01/2000 ->clBlue
02/01/2000 ->clBlack
03/01/2000 ->clBlue
03/01/2000 ->clBlue
Is that possible? And in wich way?
Thanks
miyomo
Comments
add a blank memo to the band (memo10) size it to the size of the band and send it to the back. in on before printevent of band add code ie
if [tablename."fieldname"] = some value then memo10.fillcolor:= claqua;
multiple times for each value and color combination
if you just want alternating lines select the memo go to toolbar select conditional highlighting enter [line#] mod 2 you can see this in the first report of the reports demo.
regards
Thanks for the quick reply.
The problem is that I have to compare the current record field "date" with the previuos one to understand if the date has changed or not. If it has changed then color the row.
To do this I have to store the previous field "date" in a variable and compare with the curret value. More or less:
var i:integer;
NewDate,OldDate:TDateTime;
begin
if i:=0 then
OldDate :=NewDate; //only the first time in the cycle
NewData := [DM.dSetLogBook."Date"];
if OldData:=NewData then
Memo2.Fillcolor:=clSilver; //same day
else
begin
Memo2.Fillcolor:=clWindow; //day has changed
OldDate := NewDate;
end;
end;
end
--
The text editor doesn't allow to store variable like i:integer 'cause they are all variant. Where do I 've to store the previous value?
Thanks
(a simple Windows basic user!!) told me....
Why don't you color the odd days with a color
and the even with another?
GUESS WHAT????
It works...
Damn! :-|
Thanks to everybody!
Miyomo
don't declare just name and initialize
inobp of band
begin
if [Line#] = 1 then
begin
olddate:= [DM.dSetLogBook."Date"];
Memo2.Fillcolor:=clSilver;
end;
//sets on firstrecord
if [Line#]>1 then
begin
if [DM.dSetLogBook."Date"] = [olddate] then
begin
memo2.fillcolor := memo2.filcolor;
// if = leave as is
end
else
begin
memo2.fillcolor := clwindow;
olddate:= [DM.dSetLogBook."Date"];
// resets old date for next pass
end;
end;
end
regards
piece of code!
I didn't think about initializing
with [line#]=1...
I'm going to try it now!
miyomo