Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

hide-show Bands at runtime

edited November 2006 in General
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!

Comments

This discussion has been closed.