Re: Help - What is this code used for ?




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.
>
>
>



.



Relevant Pages

  • Re: Help - What is this code used for ?
    ... It is possible to have a non tControl component ... tComponent and I presume that the author has only set the Tag of components ...
    (comp.lang.pascal.delphi.misc)
  • Re: SuspendLayout Not Suspending...
    ... Then I add 81 "tags" to the controls collection of the panel ... I have a panel on a form that is being populated with 81 of the tag ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Assigning more than one tag to tag property
    ... so by parsing out multiple tag properties the code ... controls with a tag property of "carryover". ... Dim rst As DAO.Recordset ... Dim ctl As Control ...
    (microsoft.public.access.forms)
  • Re: prevent runat="server"
    ... I don't think there is any way that you can easily get away from including the runat="server" attribute value pair since it is exactly what the server uses to identify sever side nodes. ... The asp:ListItem can probably get away without it since it is a child of an asp:DropDownList tag that already has a runat="server attribute/value pair. ... I would not recommend going to the effort of using it unless it is a control that is used ONLY between the opening/closing tags of one of your other controls. ... way I can specify this in my code, so that the designer using my controls doesn't have to specify this for each custom control tag? ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • Re: Why use <%= %> ?
    ... >>HtmlGenericControl...but it turns out CAN'T have a closing tag, ... >>all server/html controls render a closing tag. ...
    (microsoft.public.dotnet.framework.aspnet)