Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Loop components questions
Hi All,

Maybe my understanding of IWForms versus VCL forms lacks a lot, but could anyone please explain why it is that

"for i := 0 to self.componentcount -1 do" compiles ok and
"for i := 0 to TIWForm1.componentcount -1 do" fails with: Componentcount "inaccessible" here

Isn't self and tiwform1 one and the same in this case ?

TIWForm1 is a class not an instance. ComponentCount is not a static so it is not accessible via class reference.

What you have would fail in VCL Forms as well.
Hi Kudzu,

Thank you for the reply. And of curse you're right:

I checked the way I do it in VCL and there I use it with "(sender as TForm)"

So my call would be

getformprops(sender as tform);

and the procedure I call would be

procedure getformprops(f : tform); and then

f.componentcount is valid.


Forum Jump:

Users browsing this thread: 1 Guest(s)