Problem with changing font style

edited 10:24AM in FastReport 4.0
Hi, I've got DBCrossTab, and I check the value in order to change font style:
(in OnPrintCell event handler)
if value = 1 then Memo.Font.Style:=[fsBold];

I get the error: Could not convert variant of type (Array Variant) into type (Integer).

When I do:
if value = 1 then Memo.Font.Style:=Memo.Font.Style + [fsBold];

I get: Invalid variant operation.


But when I write:
if value = 1 then Memo.Font.Style:=fsBold;

I don't get any error, but of course the font isn't bolded.

When I write:
if value = 1 then Memo.Font.Color:=clBlue;

I don't get any error and font changes its color.

WTF with its style?

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 10:24AM
    works fine for me 4.7.184
  • edited 10:24AM
    gordk wrote: »
    works fine for me 4.7.184

    Damn, my version is: 4.7.138
    So I think, I found a bug.
  • gordkgordk St.Catherines On. Canada.
    edited 10:24AM
    it works fine for me in that version also
    correct syntax no []
    if value = 1 then Memo.Font.Style := fsBold;
  • edited 10:24AM
    gordk wrote: »
    it works fine for me in that version also
    correct syntax no []
    if value = 1 then Memo.Font.Style := fsBold;

    Somewhat non-Delphi syntax, but it does work.

    However, how do you remove the fsBold (ie: Font.Style := [] in Delphi) ?

    I'm stuck with using
    Memo.Font.Style := AnotherMemo.Font.Style;
    which isn't very elegant.

  • gpigpi
    edited 10:24AM
    Fast Script isn't a Delphi. FastScript doesn't support sets, so you should use
    if value = 1 then Memo.Font.Style := fsBold + fsItalic;
  • hsmhsm
    edited 10:24AM
    mcinwg wrote: »

    Somewhat non-Delphi syntax, but it does work.

    However, how do you remove the fsBold (ie: Font.Style := [] in Delphi) ?

    I'm stuck with using
    Memo.Font.Style := AnotherMemo.Font.Style;
    which isn't very elegant.
    Its probably a bit late now but I have found setting Memo.Font.Style := 0 seems to work to remove bolding (sometimes!)
  • Memo.Font.Style := 0;

  • I am currently fixing the cement patio and check your problem. Works perfectly fine with me. dude.

Leave a Comment