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

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 11:13AM
    hi
    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 ;)
  • edited 11:13AM
    >if [tablename."fieldname"] = some value then memo10.fillcolor:= claqua;

    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
  • edited 11:13AM
    While I was getting crazy to find a solution, my wife
    (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

  • gordkgordk St.Catherines On. Canada.
    edited 11:13AM
    hi
    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 ;)

  • edited 11:13AM
    Thanks gordk, for the elegant
    piece of code!
    I didn't think about initializing
    with [line#]=1...
    I'm going to try it now!

    miyomo


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.