has a easy way to Disabled many QRLabel?

I have a report which has many QRDBText and QrLabel(almost 70), I want to Endabled/Disabled some at runtime. Has a easy way to do that?. such as some Loop Statement

Thanks
kelvinyuAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

florisbCommented:
Yes there is, have a meeting now, answer from somebody else, otherwise later....

Started with:

procedure TForm1.Button1Click(Sender: TObject);
var
l : tbutton;
x : integer;
s : string;
begin
l := tbutton.create(self);
for x := 1 to 3 do
  begin
  s := 'button'+inttostr(x);
  //get form1.buttonX and enable...
  end;

end;
0
rwilson032697Commented:
Try this:

var
  I : integer;

for I := 0 to ReportForm.ComponentCount do
  if ReportForm.Components[i] is TQRLabel then
    (ReportForm.Components[i] as TQRLabel).enabled := False; // or whatever

Cheers,

Raymond.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
florisbCommented:
rwilson added the component loop, you could group your components in groups with the tag property and use sets to enable / disable a group.

  TSomeInts = 1..250;
  TIntSet = set of TSomeInts;


Drop 10 buttons on form, give them different tags:

procedure TForm1.Button1Click(Sender: TObject);
var
l : tbutton;
x : integer;
s : string;
ToDisable : TIntSet;
begin
ToDisable := [0,1,2];

//not needed: l := tbutton.create(self);
for x := 1 to form1.componentcount -1 do
  begin
  if form1.components[x] is tbutton then
    begin
    l :=  form1.Components[x] as tbutton;
    if l.tag in ToDisable then
      l.enabled := false;
    end;
  end;
end;
0
kelvinyuAuthor Commented:
thank rwilson
you answer can solve my problem

But Florisb's procedure is more suitable my case, because my report is a year statistic report, I need to disabled a group of lable by current month. thanks
0
florisbCommented:
no problemo,
F.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.