<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2013/7/31 Hans-Peter Diettrich <span dir="ltr"><<a href="mailto:DrDiettrich1@aol.com" target="_blank">DrDiettrich1@aol.com</a>></span><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

Frederic Da Vitoria schrieb:<div class="im">
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
    This code disables all components owned by form:<br>
<br>
    for i := 0 to form.Components.Count - 1 do<br>
      form.Components[i].Enabled := False;<br>
<br>
    Untested, eventually Components.Count has to be replaced by<br>
    ComponentCount.<br>
<br>
    DoDi<br>
<br>
<br>
Previous answers made me wonder: are you sure you meant "Component", not "Control"? If the form contains non-visual components, this could change the result.<br>
</blockquote>
<br></div>
Components[] contains the components *owned* by the form, while Controls[] contains only the top-level controls, whose *Parent* is the form.</blockquote></div><br></div><div class="gmail_extra">OK, but since Components can be Controls or not, they could have an Enabled property or not. So shouldn't the loop actually be something like:<br clear="all">

</div><div class="gmail_extra"><br>for i := 0 to form.Components.Count - 1 do<br>
    if form.Components[i] is TControl<br>        then form.Components[i].Enabled := False;<br>
<br>-- <br>Frederic Da Vitoria<br>(davitof)<br><br>Membre de l'April - « promouvoir et défendre le logiciel libre » - <a href="http://www.april.org" target="_blank">http://www.april.org</a><br>
</div></div>