Memo.highlight fontname not changeing on runtime!

Hello I try change hightlight properties form delphi source:

procedure TForm96.frxReport1BeforePrint(Sender: TfrxReportComponent);
var
oMemo: TfrxMemoView;
begin
If Pos( 'MEMO',UpCase( Form96.frxReport1.CurObject ) ) <> 0 Then Begin
oMemo := TfrxMemoView( Form96.frxReport1.FindObject( Form96.frxReport1.CurObject ) );
oMemo.Highlight.Font.Name := Form3.aSystem[33]; <<<not work
oMemo.Highlight.Color := clRed; <<<not work
oMemo.Font.Name := Form3.aSystem[33]; <<<this work
End;
end;

why not happend? any ideas?
thanks.

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 6:23PM
    this event fires for every object in the report
    procedure TForm96.frxReport1BeforePrint(Sender: TfrxReportComponent);

    the typical syntax would be
    begin
    if sender.name = 'Memo1' then
    with tfrxmemoview(sender) do // cast sender
    begin
    set props here
    end;
    end;

    if you turn on auto code completion
    you will find all the props available and their required types when you pause after a dot.
    ;)
  • gordkgordk St.Catherines On. Canada.
    edited 6:23PM
    Ishould have said
    this event fires for every object in the report so you are better to doit where
    you load the report.
    sample
    procedure TForm1.Button7Click(Sender: TObject);
    var

    LFXMCOM:TfrxMemoView;

    begin
    frxReport4.Clear;
    frxreport4.LoadFromFile('testHighlight.fr3');
    lfxmcom := frxreport4.FindObject('Memo1') as tfrxmemoview;
    lfxmcom.Highlight.Condition := '<Line> mod 2';
    lfxmcom.Highlight.Font.Name := 'Arial Black';
    lfxmcom.Highlight.Font.Style := [fsBold];
    frxreport4.ShowReport;
    end;

Leave a Comment