Problem with changing font style

edited 6:57PM 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 6:57PM
    works fine for me 4.7.184
  • edited 6:57PM
    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 6:57PM
    it works fine for me in that version also
    correct syntax no []
    if value = 1 then Memo.Font.Style := fsBold;
  • edited 6:57PM
    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 6:57PM
    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 6:57PM
    mcinwg wrote: »
    mcinwg 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.
    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

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.