Can't seem to hide memos!!
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
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
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
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
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?
I still can't get around this problem...
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.
same test in obp event of colum header works ok for me
d7 fr2.51 with updates posted by samuray
regards
look back a few pages
regards
regards
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?!
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