Recent

Author Topic: FortesReport checkbox  (Read 2340 times)

JanRoza

  • Hero Member
  • *****
  • Posts: 672
    • http://www.silentwings.nl
FortesReport checkbox
« on: October 02, 2017, 12:56:43 pm »
I have a database (SQLite) with a boolean field and want to print that with FortesReport.
Now FortesReport prints "yes" or "no" in the report but I want this to be printed as a checkbox.
Is there a way to do this in FortesReport?
OS: Windows 10 (64 bit) / Linux Mint (64 bit)
       Lazarus 3.2 FPC 3.2.2
       CodeTyphon 8.40 FPC 3.3.1

balazsszekely

  • Guest
Re: FortesReport checkbox
« Reply #1 on: October 02, 2017, 01:34:59 pm »
You have bands and OnBeforePrint event in fortesreport. Place two image(TRLImage) on the band, overlapping each other. Load a checked checkbox image in the first and an unchecked checkbox image in the second TRLImage. Now toggle the visibility in function of your boolean field.

Code: Pascal  [Select][+][-]
  1. ImageChecked.Visible := SQLQuery.FieldByName('MyBooleanField').AsBoolean = True;
  2. ImageUnchecked.Visible := not ImageChecked.Visible;

JanRoza

  • Hero Member
  • *****
  • Posts: 672
    • http://www.silentwings.nl
Re: FortesReport checkbox
« Reply #2 on: October 02, 2017, 02:41:17 pm »
Thanks GetMem,

That's a neat solution that will do fine.
 
OS: Windows 10 (64 bit) / Linux Mint (64 bit)
       Lazarus 3.2 FPC 3.2.2
       CodeTyphon 8.40 FPC 3.3.1

 

TinyPortal © 2005-2018