![]() |
Loop components questions - Printable Version +- Atozed Forums (https://www.atozed.com/forums) +-- Forum: Atozed Software Products (https://www.atozed.com/forums/forum-1.html) +--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html) +---- Forum: English (https://www.atozed.com/forums/forum-16.html) +----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html) +----- 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 ? Regards Soren 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. Regards Soren |