Recent

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

madref

  • Hero Member
  • *****
  • Posts: 700
  • ..... A day not Laughed is a day not Lived !!
    • 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 2.0.2 / FPC 3.0.4
Lazarus Trunc / FPC 3.0.4
Mac OS X Mojave

paweld

  • Full Member
  • ***
  • Posts: 187
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
paweld

madref

  • Hero Member
  • *****
  • Posts: 700
  • ..... A day not Laughed is a day not Lived !!
    • 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 2.0.2 / FPC 3.0.4
Lazarus Trunc / FPC 3.0.4
Mac OS X Mojave