Re: Help - What is this code used for ?
- From: "Eddy Fontaine" <eddy.fontaine@xxxxxxxxx>
- Date: Mon, 28 Nov 2005 19:28:35 GMT
Thanks Bruce,
I understand :
> By the looks of things the code is used to enable / disable a group of
> controls on the main form.
but i am not clever enough to see if there is a bug...;-(
Cheers,
Eddy.
"Bruce Roberts" <dontsendtober@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:2xHif.1350$Et5.90799@xxxxxxxxxxxxxxxxxxxxxxxx
>
>
> "Eddy Fontaine" <someone@xxxxxxxxxxxx> wrote in message
> news:438b3d2d$0$10963$ba620e4c@xxxxxxxxxxxxxxxxx
> >I found this code in the INDY 9 basic TCPClient demo, and i have no idea
> > what it is used for...
>
> > procedure TfrmMain.LockControls(ALock: Boolean);
> > var
> > i : integer;
> > begin
> > for i := 0 to componentcount-1 do
> > if TControl(Components[i]).Tag = 99 then
> > TControl(Components[i]).Enabled := ALock;
> > end;
>
> The code has a bug, at least IMO. tForm.Components has an entry type of
> tComponent, not tControl. It is possible to have a non tControl component
> on a form. The reason that the code doesn't fail is that Tag is declared
in
> tComponent and I presume that the author has only set the Tag of
components
> of type tControl to 99. However the code would have been tighter if it
were
> written
>
> if Components [i].Tag = 99
> then begin
> Assert (Components [i] is tControl);
> tControl (Components [i]).Enabled := aLock;
> end;
>
> or
>
> if (Components [i].Tag = 99) and (Components [i] is tControl)
> then tControl (Components [i]).Enabled := aLock;
>
> By the looks of things the code is used to enable / disable a group of
> controls on the main form.
>
>
>
.
- References:
- Help - What is this code used for ?
- From: Eddy Fontaine
- Re: Help - What is this code used for ?
- From: Bruce Roberts
- Help - What is this code used for ?
- Prev by Date: Re: Help - What is this code used for ?
- Next by Date: Where to call RestoreDesktop?
- Previous by thread: Re: Help - What is this code used for ?
- Next by thread: Where to call RestoreDesktop?
- Index(es):
Relevant Pages
|
|