Can't seem to hide memos!!

edited February 2004 in FastReport 2.xx VCL
In my app, i set a variable to show or hide costs like so:
frReport1.Dictionary.Variables.Variable:=bShowCosts;

in my (2-pass) report I have tried all the following and none of them work:

1. in OnBeforePrint of MasterData band:
mmoUnitCost.Visible:=([varShowCosts]);
mmoTotalCost.Visible:=([varShowCosts]);

2. in each memo views' scripting box referering by name:
mmoUnitCost.Visible:=([varShowCosts]);

3. in each memo views' scripting box without referering by name:
Visible:=([varShowCosts]);

4. even hard coding:
mmoUnitCost.Visible:=False;

The memos STILL show...

In the OnBeforePrint of the Report Summary band, where I also need to hide the grand totals, this works:
Visible:=([varShowCosts]);
So I don't think it's the syntax - maybe something else?!

Help ... anyone... please....before I lose my mind!

Thanks
Azza

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 7:09AM
    AzzaAzza69 wrote:
    In my app, i set a variable to show or hide costs like so:
    frReport1.Dictionary.Variables.Variable:=bShowCosts;

    in my (2-pass) report I have tried all the following and none of them work:

    1. in OnBeforePrint of MasterData band:
    mmoUnitCost.Visible:=([varShowCosts]);
    mmoTotalCost.Visible:=([varShowCosts]);

    2. in each memo views' scripting box referering by name:
    mmoUnitCost.Visible:=([varShowCosts]);

    3. in each memo views' scripting box without referering by name:
    Visible:=([varShowCosts]);

    4. even hard coding:
    mmoUnitCost.Visible:=False;

    The memos STILL show...

    In the OnBeforePrint of the Report Summary band, where I also need to hide the grand totals, this works:
    Visible:=([varShowCosts]);
    So I don't think it's the syntax - maybe something else?!

    Help ... anyone... please....before I lose my mind!

    Thanks
    Azza
    hi
    try changing
    frReport1.Dictionary.Variables.Variable:=bShowCosts;
    to
    frReport1.Dictionary.Variables:=bShowCosts;
    when you work in obp of band you need set each memo
    if varshowcosts = true then
    begin
    memo1.visible := true
    memo2.visiblr := true;
    end
    else
    begin
    memo1.visible := false
    memo2.visible := false;
    end;

    if in memos script
    visible := varshowcosts;

    regards ;)
  • edited February 2004
    GordK...

    Thanks for the Variables tip (Dictionary.Variables instead of .Variable); I'll use this in the future.
    Another thing I noticed was the lack of [] around the variable name...are you saying I don't need them?

    But as I have tried a hard coded a False value in OBP events + memo scripts, I don't think either of the above is the problem. The main difference I see would be the 'long-hand' if (x=true) then hide else show end; way. I'll give it a try when I'm back @ work on Tuesday.

    Thanks for the help anyways,
    Azza ;)
  • edited 7:09AM
    GordK,

    change the OBP of my ColumnHeader band to read:

    begin
    if varShowCosts=True then begin
    mmoHUnitCost.Visible:=True;
    mmoHTotalCost.Visible:=True;
    mmoHVAT.Visible:=True;
    end else begin
    mmoHUnitCost.Visible:=False;
    mmoHTotalCost.Visible:=False;
    mmoHVAT.Visible:=False;
    end;
    end

    and it still doesn't hide the column headings (also tried with [] around the variable varShowCosts. no difference).

    In fact, I now think there is a bug in FR 2.51 as I removed all the code from the OBP of the columnheader and replaced it with:

    begin
    mmoHUnitCost.Visible:=False;
    mmoHTotalCost.Visible:=False;
    mmoHVAT.Visible:=False;
    end

    and they ARE STILL SHOWN!

    I tried going back to version 2.47 but it complains about incompatible report version so now I'm stuck. May be Alex can shed some light on this?
  • edited 7:09AM
    Bumped to move to top of list...

    I still can't get around this problem...
  • edited 7:09AM
    Alex, I still can't hide 4 memos (2 column headings and 2 Master Data). My project is nearing completion now so I could do with an anwer.

    In the simplest test, a report with 1 ColumnHeader band.

    I drop a memo into the ColumnHeader band and put in the text as "This is a test". I put the following code into the OnBeforePrint of the ColumnHeader band:
    begin
    Memo1.Visible:=False;
    end;

    and preview - it shows the test "This is a test".

    In fact, if I change the code to read "abc123.Visible:=False" and preview it doesn't complain, so I think it isn't even executing the code.
  • gordkgordk St.Catherines On. Canada.
    edited 7:09AM
    Hi Again
    same test in obp event of colum header works ok for me
    d7 fr2.51 with updates posted by samuray
    regards ;)
  • edited 7:09AM
    I'm running Delphi 6 and fr 2.51 - what and where are these "updates posted by samuray"?
  • gordkgordk St.Catherines On. Canada.
    edited 7:09AM
    they are in this forum
    look back a few pages
    regards ;)
  • edited February 2004
    I've already searched for all posts by Samuray - it reports the last post was 10-Dec - and I've already started looking at these - how far back do I go (or do you know the topic title) and what do the 'updates' fix (is it my specific problem)?
  • gordkgordk St.Catherines On. Canada.
    edited 7:09AM
    hi page 17 and page 15
    regards ;)
  • edited February 2004
    Have applied the 2 changes (1. moving InitGroups and 2. adding DocMode) and it is still not working.

    I have investigated and can now narrow it down a bit further...

    As per my post of 12:39 pm, if I do this in the IDE using a TfrReport and preview it, it does hide the memo but I have a report-builder unit that I use in the system to design the reports and save them to a table. Using the preview from this does not hide the memo (in fact, I can't even set Visible to False in the Designer, it just re-selects True).

    Any more ideas?

    PS. I have copied the report out of the table and dropped it on the form to test. I can set the Visible property to False when designing the report while within the IDE but when I run the application, the memo is shown. (Note: I can't preview the report from within the designer as I set up the datasets in code).

    Stepping thru code in:
    procedure TfrView.SetPropValue(Index: String; Value: Variant);

    and stopping on this line (1885):
    else if Index = 'VISIBLE' then <- debugger expression Visible=True and Value=False
    Visible := Value
    after the above line the value of Visible is still True?!

    From what I see from the source, Visible is a WordBool and not a property so I can only assume there is a problem somewhere along the line converting the Value variant into a WordBool?!
  • edited 7:09AM
    As I traced it to the storing of the variant False to a WordBool, I have done some updating...

    I've was running D6 SP1 because when SP2 came out, I installed it but it broke a project I was working on (95 variant support). I have never been back since.

    On looking on the borland site, it looks like they fixed the problem and I've since installed SP2 + PostSP2 Variant fixes and that has fixed my problem (whoopee!)...

    [Now to test existing projects and see if they still work!]

    Thanks a lot, GordK, for all your efforts.

    Regards,
    Azza

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.