I am talking mostly about TDBEdit and a few TDBComboBox objects.

On Wed, 2013-07-31 at 11:00 +0200, Mattias Gaertner wrote:
> On Wed, 31 Jul 2013 10:04:49 +0200
> Frederic Da Vitoria <[email protected]> wrote:
> 
> > 2013/7/31 Hans-Peter Diettrich <[email protected]>
> > 
> > > Terry A. Haimann schrieb:
> > >
> > >  I am sure this is a dumb ?, but I want a subroutine that will change all
> > >> of the components of a form to Enabled := False.
> > >>
> > >> How do I do this?
> > >>
> > >
> > > 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.
> 
> TComponent does not have Enabled. So the above code does not work.
> TControl has Enabled.
> Disabling a control (e.g. no focus, some widgetsets draw them
> gray) automatically disables child controls. So the easiest way
> to disable all controls on a form is to set Form1.Enabled:=false.
> 
> Mattias
> 
> 
> Mattias
> 
> 
> --
> _______________________________________________
> Lazarus mailing list
> [email protected]
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus



--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to