Script not working
theodore
Greece
I experience a problem when running a script on an OnBeforePrint event.
I have a Memo Object and i make it invisible just before band print but sometimes i have to make it visible.
Looks like it works ok when i print the report just one time (hides and shows correctly).
If i print the report multiple times (by calling every time the report again) the memo does not reset to invisible and is always visible. I tried to catch any logic or syntax error, but everything looks ok and some debug messageboxes i defined report the values and the script logic ok. The solution i gave was to send the object back and fill the above memos but i can not do it everytime.
Any suggestions?
Fastereport Rocks!!!
I have a Memo Object and i make it invisible just before band print but sometimes i have to make it visible.
Looks like it works ok when i print the report just one time (hides and shows correctly).
If i print the report multiple times (by calling every time the report again) the memo does not reset to invisible and is always visible. I tried to catch any logic or syntax error, but everything looks ok and some debug messageboxes i defined report the values and the script logic ok. The solution i gave was to send the object back and fill the above memos but i can not do it everytime.
Any suggestions?
Fastereport Rocks!!!
Comments
when you have a problem it would be good to show the code snippet/s in question, we cant't read your mind.
Are you in the obp event of a band in a report or an obp event of the report component?
regards
begin
ExamName.Visible:=false;
BackGround.Visible:=false;
ExamNameFollow.Visible:=false;
NameTitler.Visible:=false;
LabelExamName.Visible:=false;
ResultAsTitle.Visible:=false;
RestResult.Visible:=false;
Result.Visible:=true;
Seperator.Visible:=false;
FullLineResult.Visible:=false;
if [QueryFindVisitPageExamFields."reporttype"] = 1 then ExamName.Visible:=true;
if [QueryFindVisitPageExamFields."reporttype"] = 2 then
begin
ExamName.Visible:=true;
ExamNameFollow.Visible:=true;
RestResult.Visible:=true;
Result.Visible:=false;
end;
if [QueryFindVisitPageExamFields."reporttype"] = 4 then LabelExamName.Visible:=true;
if [QueryFindVisitPageExamFields."reporttype"] = 5 then
begin
if [QueryFindVisitPageExamFields."resulttype"] <> 8 then
begin
ResultAsTitle.Visible:=true;
Result.Visible:=false;
BackGround.Visible:=true;
end;
if [QueryFindVisitPageExamFields."resulttype"] = 8 then
begin
NameTitler.Visible:=true;
ExamName.Visible:=false;
ExamNameFollow.Visible:=false;
BackGround.Visible:=true;
end;
end;
if [QueryFindVisitPageExamFields."reporttype"] = 6 then
begin
FullLineResult.Visible:=true;
Result.Visible:=false;
end;
if [QueryFindVisitPageExamFields."reporttype"] = 7 then Seperator.Visible:=true;
if [QueryFindVisitPageExamFields."printtext"]= true then
Begin
RichNormalValue.Visible := true;
PlainNormalValue.Visible := false;
end;
if [QueryFindVisitPageExamFields."printtext"]= false then
Begin
RichNormalValue.Visible := false;
PlainNormalValue.Visible := true;
end;
if [QueryFindVisitPageExamFields."ViewLimitCheckResult"] = 0 then
begin
Result.Font.Style:=0;
Result.Font.Color:=clBlack;
end;
if [QueryFindVisitPageExamFields."ViewLimitCheckResult"] = -1 then
Begin
Result.Font.Style:=2;
Result.Font.Color:=clBlue;
end;
if [QueryFindVisitPageExamFields."ViewLimitCheckResult"] = 1 then
Begin
Result.Font.Style:=2;
Result.Font.Color:=clRed;
end;
if Trim([QueryFindVisitPageExamFields."PrintName"])='' then
begin
ExamName.Visible:=false;
ExamNameFollow.Visible:=false;
end;
end
LabelExamName is the problem...
The obp event exists in detail data band
But since yesterday i had another printing problem: When in a report which is almost full page with many fields on it, again in detail data, i placed 3 memos.
By running the query, i can see the three values on screen, but not in the place i
first had, them. They are printed after the band!!!. After that i cutted (ctrl-x) the memos and pasted (ctrl-v) them back. Everything now works!!!
Bye
regards
I discovered the problem (maybe a bug but obviously something not covered elsewhere) and reported to support.
The problem is that:
When you use a report object to print diffirent frf's, if at least one frf has an error on onbeforeprint, then the onbeforeprint event an all the other (with correct obp) reports looks like running but has no effect (does not actually work e.g. does not change visible properties).
You must close and restart the application to make again the obp event run...
typically
frreport1.clear; // obvious
frreport1.loadfromfile('path&filename.frf');
if not frreport1.prepare report then
exit
else
frreport1.showpreparedreport;
regards