Atozed Forums
Loop components questions - Printable Version

+- Atozed Forums (
+-- Forum: Atozed Software Products (
+--- Forum: IntraWeb (
+---- Forum: English (
+----- Forum: IntraWeb General Discussion (
+----- Thread: Loop components questions (/thread-1249.html)

Loop components questions - SorenJensen - 09-18-2019

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 ?


RE: Loop components questions - kudzu - 09-18-2019

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.

RE: Loop components questions - SorenJensen - 09-18-2019

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.