Recent

Author Topic: [SOLVED] LazReport change text color according to field value. How to do?  (Read 8573 times)

lazguy

  • Jr. Member
  • **
  • Posts: 78
Hello Everybody!!!!!

I tryed without success. So now i need help.

I have a database with a field called oscilation and another field called oscsign which tell me if the oscilation is positive, negative or equal (no oscilation).

I was able to make the report with all columns i need, but i am needing also that the oscilation column in my report is green if the oscsign text field contains '+', red if the oscsign field contains '-' and blue if the oscsign field contains '='.

I don't need to show the oscsign field in the report. It is only a reference field to set the proper color for the oscilation.

Can anyone help me?

Thank you very much in advance.
« Last Edit: February 08, 2012, 02:48:31 am by lazguy »

stonefull

  • Jr. Member
  • **
  • Posts: 54
Re: LazReport change text color according to field value. How to do?
« Reply #1 on: May 24, 2010, 10:08:26 pm »
See the example 'userds' on directory of lazreport

lazguy

  • Jr. Member
  • **
  • Posts: 78
Re: LazReport change text color according to field value. How to do?
« Reply #2 on: May 25, 2010, 09:17:14 am »
Thank you, stonefull,

but this example changes the background color, not the text color.

I tried canvas.font.color without success.

Anyone knows how can i change the text color?

Thank you very much in advance.

paweld

  • Hero Member
  • *****
  • Posts: 991
Re: LazReport change text color according to field value. How to do?
« Reply #3 on: May 25, 2010, 06:33:17 pm »
hi,
see in my example

best regards
paweld
« Last Edit: May 25, 2010, 10:47:25 pm by paweld »
Best regards / Pozdrawiam
paweld

lazguy

  • Jr. Member
  • **
  • Posts: 78
Re: LazReport change text color according to field value. How to do?
« Reply #4 on: May 25, 2010, 10:11:07 pm »
hi,
see in my example

best regards
paweld

Thank you paweld,

But... where is your example?

I read all your posts but i only found canvas.font.color:=clRed;
I already tryed this before but don't work. :-(

Who can help me?

Thank you very much in advance.

paweld

  • Hero Member
  • *****
  • Posts: 991
Re: LazReport change text color according to field value. How to do?
« Reply #5 on: May 25, 2010, 10:54:44 pm »
Under my post is the attachment. There is example. You want to get something like on atachement image?

Best regards
Paweł D.
« Last Edit: May 25, 2010, 10:56:54 pm by paweld »
Best regards / Pozdrawiam
paweld

lazguy

  • Jr. Member
  • **
  • Posts: 78
Re: LazReport change text color according to field value. How to do?
« Reply #6 on: May 27, 2010, 01:20:44 pm »
Thank you very much paweld!!!

Your example was very much valuable.

I was using font.color like in lazarus, but for LazReport according to your example the correct is fontcolor

PROBLEM SOLVED

thanks to paweld.

 

TinyPortal © 2005-2018