Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why the ComponentCount property of my TGroupBox returns 0?

Tags:

delphi

I have a TGroupBox with several components inside, I'm trying to set the Enabled property of all the components which are inside of the GroupBox in this way

  for i := 0 to GroupBox1.ComponentCount -1 do
   if (GroupBox1.Components[i]) is TWinControl then
     TWinControl(GroupBox1.Components[i]).Enabled:=False;

but the ComponentCount returns always 0, what i'm missing?

like image 286
Salvador Avatar asked Mar 29 '12 01:03

Salvador


1 Answers

The ComponentCount property is for retrieve the number of components owned by a component, to iterate over all the children controls you must use the ControlCount and Controls properties.

like image 84
RRUZ Avatar answered Oct 06 '22 11:10

RRUZ