Memo repeats in Summary band
I am populating a StringList in RAP which I want to display in the
Summary band. I placed a Memo in the Summary band, with the band set to
DynamicHeight and the Memo set to Stretch. In the Summary band's
BeforePrint event, I am loading the Memo from the StringList. Depending
on what method I use to load the Memo, if the number of lines exceeds a
single page, the Memo repeats in an infinite loop.
If I use the Text property, the Memo does not repeat:
Memo1.Text := gList.Text;
If I use the Lines property, the Memo repeats:
Memo1.Lines.AddStrings(gList);
If I use a loop to add lines to the Memo, the Memo repeats and each page
takes noticably longer to generate than the previous page:
for i := 0 to gList.Count-1 do
Memo1.Lines.Add(gList[i]);
If the Memo fits on one page, none of these methods causes the Memo to
repeat.
Can anyone explain why this happens? Should I be loading the Memo in a
different event? Or should I use something else to display the
StringList?
I am using RB 9.02 for Delphi 7.
Jim Shawver
Bell and Howell
Summary band. I placed a Memo in the Summary band, with the band set to
DynamicHeight and the Memo set to Stretch. In the Summary band's
BeforePrint event, I am loading the Memo from the StringList. Depending
on what method I use to load the Memo, if the number of lines exceeds a
single page, the Memo repeats in an infinite loop.
If I use the Text property, the Memo does not repeat:
Memo1.Text := gList.Text;
If I use the Lines property, the Memo repeats:
Memo1.Lines.AddStrings(gList);
If I use a loop to add lines to the Memo, the Memo repeats and each page
takes noticably longer to generate than the previous page:
for i := 0 to gList.Count-1 do
Memo1.Lines.Add(gList[i]);
If the Memo fits on one page, none of these methods causes the Memo to
repeat.
Can anyone explain why this happens? Should I be loading the Memo in a
different event? Or should I use something else to display the
StringList?
I am using RB 9.02 for Delphi 7.
Jim Shawver
Bell and Howell
This discussion has been closed.
Comments
When a page breaks, the Band.BeforePrint will fire again essentially
adding the text to the memo a second time. Note that there is no
guarantee that any ReportBuilder events (except for Variable.OnCalc)
will fire only once.
Perhaps try clearing the memo before adding lines or adding the memo
lines before the page starts. I also suggest getting this working in
Delphi so you can trace into the event code and see what is happening.
Once you get it working in Delphi, move the code to RAP.
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Jim Shawver
Bell and Howell