Recent

Author Topic: [SOLVED] LazReport changing background of a field  (Read 1011 times)

madref

  • Hero Member
  • *****
  • Posts: 949
  • ..... A day not Laughed is a day wasted !!
    • Nursing With Humour
[SOLVED] LazReport changing background of a field
« on: November 22, 2019, 06:51:58 am »
I hava a LazReport with the field Memo_Titel in it.
How can I change that specific field's background color?


P.s. i have looked at the example code, but that didn't make me any brighter.
« Last Edit: November 22, 2019, 03:42:13 pm by madref »
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Lazarus 3.99 (rev main_3_99-649-ge13451a5ab) FPC 3.3.1 x86_64-darwin-cocoa
Mac OS X Monterey

paweld

  • Hero Member
  • *****
  • Posts: 970
Re: LazReport changing background of a field
« Reply #1 on: November 22, 2019, 11:58:34 am »
if You know name of a report memofield then:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.frReport1EnterRect(Memo: TStringList; View: TfrView);
  2. begin
  3.   if view.Name='memo_name' then
  4.   view.FillColor:=clBlue;
  5. end;

if You want change background color depending on the db field value then check "script" on report memofield:
Code: Pascal  [Select][+][-]
  1. if pos('o', [SQLQuery1."name"])>0 then
  2. FillColor:=clRed
  3. else if pos('e', [SQLQuery1."name"])>0 then
  4. FillColor:=clYellow
  5. else
  6. FillColor:=clGreen
Best regards / Pozdrawiam
paweld

madref

  • Hero Member
  • *****
  • Posts: 949
  • ..... A day not Laughed is a day wasted !!
    • Nursing With Humour
Re: LazReport changing background of a field
« Reply #2 on: November 22, 2019, 03:42:03 pm »
Thanks !!
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Lazarus 3.99 (rev main_3_99-649-ge13451a5ab) FPC 3.3.1 x86_64-darwin-cocoa
Mac OS X Monterey

 

TinyPortal © 2005-2018