title: Is there any way to get all the controls on a container control?
body: <p>I've got a form with a bunch of controls on it, and I wanted to iterate through all the controls on a certain panel and enable/disable them.</p>
  
  <p>I tried this:</p>
  
  <pre><code>var component: TComponent;
  begin
    for component in myPanel do
      (component as TControl).Enabled := Value;
  end;
  </code></pre>
  
  <p>But that did nothing.  Turns out all components are in the form's component collection, not their parent object's.  So does anyone know if there's any way to get all the controls inside a control?  (Besides an ugly workaround like this, which is what I ended up having to do):</p>
  
  <pre><code>var component: TComponent;
  begin
    for component in myPanel do
      if (component is TControl) and (TControl(component).parent = myPanel) then
        TControl(component).Enabled := Value;
  end;
  </code></pre>
  
  <p>Someone please tell me there's a better way...</p>