hide-show Bands at runtime
Hi!
I'm using RBuilder Pro 10.04 and Delphi 7 Pro.
I need to let de user choose which bands to show or hide at runtime.
I use a CheckListBox to check/uncheck them, but I'm doing something wrong...
How can I know if the Loaded Template has a TitleBand, or FooterBand,
etc...?
Is there any HasTitle or HasFooter function?
This is what I do:
AFTER LOADING THE TEMPLATE FILE:
With Report Do
for i:=0 to BandCount-1 do
begin
if bands[i] is tppTitleBand then
begin
checklistbox1.items.Append('Title');
checklistbox1.Checked[checklistbox1.Items.IndexOf('Title')]
:= TitleBand.Visible;
end
end;
That works fine, BUT the following code, just to hide/show the bands,
doesn't work (are always printed):
IN CHECKLISTBOX.ONCLICKCHECK EVENT:
With Report Do
begin
for i:=0 to BandCount-1 do
begin
if bands[i] is TppTitleBand then
titleband.visible :=
checklistbox1.Checked[checklistbox1.Items.IndexOf('Title')]
end;
ppviewer1.Reset;
ppviewer1.report := Report;
ppviewer1.report.printtodevices;
Maybe the "Reset" procedure?
Thanks!
I'm using RBuilder Pro 10.04 and Delphi 7 Pro.
I need to let de user choose which bands to show or hide at runtime.
I use a CheckListBox to check/uncheck them, but I'm doing something wrong...
How can I know if the Loaded Template has a TitleBand, or FooterBand,
etc...?
Is there any HasTitle or HasFooter function?
This is what I do:
AFTER LOADING THE TEMPLATE FILE:
With Report Do
for i:=0 to BandCount-1 do
begin
if bands[i] is tppTitleBand then
begin
checklistbox1.items.Append('Title');
checklistbox1.Checked[checklistbox1.Items.IndexOf('Title')]
:= TitleBand.Visible;
end
end;
That works fine, BUT the following code, just to hide/show the bands,
doesn't work (are always printed):
IN CHECKLISTBOX.ONCLICKCHECK EVENT:
With Report Do
begin
for i:=0 to BandCount-1 do
begin
if bands[i] is TppTitleBand then
titleband.visible :=
checklistbox1.Checked[checklistbox1.Items.IndexOf('Title')]
end;
ppviewer1.Reset;
ppviewer1.report := Report;
ppviewer1.report.printtodevices;
Maybe the "Reset" procedure?
Thanks!
This discussion has been closed.
Comments
Reseting the viewer is probably not enough to completely regenerate the
report. Try also resetting the screen device (TppViewer.ScreenDevice) and
the report engine (Report.Engine).
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com