[Lazarus] Subroutine ?
Frederic Da Vitoria
davitofrg at gmail.com
Wed Jul 31 15:35:34 CEST 2013
2013/7/31 Hans-Peter Diettrich <DrDiettrich1 at aol.com>
> Frederic Da Vitoria schrieb:
>
> This code disables all components owned by form:
>>
>> for i := 0 to form.Components.Count - 1 do
>> form.Components[i].Enabled := False;
>>
>> Untested, eventually Components.Count has to be replaced by
>> ComponentCount.
>>
>> DoDi
>>
>>
>> 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.
>>
>
> Components[] contains the components *owned* by the form, while Controls[]
> contains only the top-level controls, whose *Parent* is the form.
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:
for i := 0 to form.Components.Count - 1 do
if form.Components[i] is TControl
then form.Components[i].Enabled := False;
--
Frederic Da Vitoria
(davitof)
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20130731/fb95bd64/attachment-0003.html>
More information about the Lazarus
mailing list