really basic question. how to use the checkbox?

Hello,
Sorry but I am new to fast report.

I have a firebird3 query with IBX and some boolean fields. the database recognize the boolean type and display checkbox correctly.

in my report, the text fields are print fine but the checkbox are always empty. I have tried to use the OnBeforePrint event to force the value to true, but it is still blank

what can go wrong?

procedure CheckBox1OnBeforePrint(Sender: TfrxComponent);
begin
Checkbox1.Checked:=true;
end;

Thanks.

Comments

  • edited March 2018
    Hello,

    You dont have to check the Checkbox manually. Try to use Checkbox's Dataset and Datafield option in Checkbox properties or from code section like :

    Checkbox1.DataSet
    Checkbox1.DataField


    and use report start event from tfrxreport.

    Pictures attached.

    Regards,
    boakoms.
    kccheng wrote: »
    Hello,
    Sorry but I am new to fast report.

    I have a firebird3 query with IBX and some boolean fields. the database recognize the boolean type and display checkbox correctly.

    in my report, the text fields are print fine but the checkbox are always empty. I have tried to use the OnBeforePrint event to force the value to true, but it is still blank

    what can go wrong?

    procedure CheckBox1OnBeforePrint(Sender: TfrxComponent);
    begin
    Checkbox1.Checked:=true;
    end;

    Thanks.
  • edited 11:39AM
    Thanks for your information.
    But I found the problem. in CheckStyle, only csLineCross and csPlus are actually printing. csCheck and csCross are printing as empty.
    I am using Lazarus, maybe it is a bug.
  • edited 11:39AM
    please check the attachment. 4 different checkbox with 4 different checkstyle.
    only csLineCross and csPlus is printing.
  • edited 11:39AM
    I found the problem.

    I changed variable S to widestring and use TextOut() instead of ExtTextOut() to draw for both checked and unchecked handler.

    The API ExtTextOut() doesn't support unicode. The value 251 and 252 is above 0x7F and they conflicts with DBCS. I don't know how to access ExtTextOutW() in Lazarus so I replaced it with TextOut() instead.

    the code is in frxChBox.pas, function procedure TfrxCheckBoxView.DrawCheck(ARect: TRect);

Leave a Comment