Re: [Lazarus] Subroutine ?

2013-07-31 Thread Hans-Peter Diettrich
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 :=

Re: [Lazarus] Subroutine ?

2013-07-31 Thread Frederic Da Vitoria
2013/7/31 Hans-Peter Diettrich drdiettri...@aol.com 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

Re: [Lazarus] Subroutine ?

2013-07-31 Thread Mattias Gaertner
On Wed, 31 Jul 2013 10:04:49 +0200 Frederic Da Vitoria davito...@gmail.com wrote: 2013/7/31 Hans-Peter Diettrich drdiettri...@aol.com 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.

Re: [Lazarus] Subroutine ?

2013-07-31 Thread Graeme Geldenhuys
On 2013-07-31 04:53, Terry A. Haimann wrote: 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. Not sure if you wanted controls to be disabled or readonly (when possible)... If you wanted the latter, then tiOPF has a

Re: [Lazarus] Subroutine ?

2013-07-31 Thread Chavoux Luyt
Hi Mattias On 31 July 2013 11:00, lazarus-requ...@lists.lazarus.freepascal.org wrote: 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

Re: [Lazarus] Subroutine ?

2013-07-31 Thread Terry A. Haimann
Interesting and I didn't know you could do that. But, more of what I have in mind is. I have a bunch of database components on a form, I want them to be enabled only after hitting the edit or insert button on the DbNavigator. Since this is going to occur in multiple points in my button

Re: [Lazarus] Subroutine ?

2013-07-31 Thread Frederic Da Vitoria
2013/7/31 Terry A. Haimann te...@haimann.us Interesting and I didn't know you could do that. But, more of what I have in mind is. I have a bunch of database components on a form, I want them to be enabled only after hitting the edit or insert button on the DbNavigator. Since this is going

Re: [Lazarus] Subroutine ?

2013-07-31 Thread Hans-Peter Diettrich
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

Re: [Lazarus] Subroutine ?

2013-07-31 Thread Hans-Peter Diettrich
Chavoux Luyt schrieb: On 31 July 2013 11:00, lazarus-requ...@lists.lazarus.freepascal.org mailto:lazarus-requ...@lists.lazarus.freepascal.org wrote: TComponent does not have Enabled. So the above code does not work. TControl has Enabled. Thanks, I missed that. Disabling a

Re: [Lazarus] Subroutine ?

2013-07-31 Thread Terry A. Haimann
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 davito...@gmail.com wrote: 2013/7/31 Hans-Peter Diettrich drdiettri...@aol.com Terry A. Haimann schrieb:

Re: [Lazarus] Subroutine ?

2013-07-31 Thread Mattias Gaertner
On Wed, 31 Jul 2013 12:09:44 +0100 Chavoux Luyt chav...@gmail.com wrote: [...] Just a related question on this: What happens afterwards when I say Form1.Enabled:=true; ? Form1.Enabled does not change the 'Enabled' values of child controls. A control is enabled if itself and all its parents

Re: [Lazarus] Subroutine ?

2013-07-31 Thread Mattias Gaertner
On Wed, 31 Jul 2013 07:23:02 -0500 Terry A. Haimann te...@haimann.us wrote: Interesting and I didn't know you could do that. But, more of what I have in mind is. I have a bunch of database components on a form, I want them to be enabled only after hitting the edit or insert button on the

Re: [Lazarus] Subroutine ?

2013-07-31 Thread Frederic Da Vitoria
2013/7/31 Hans-Peter Diettrich drdiettri...@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

Re: [Lazarus] Subroutine ?

2013-07-31 Thread Hans-Peter Diettrich
Frederic Da Vitoria schrieb: 2013/7/31 Hans-Peter Diettrich drdiettri...@aol.com mailto:drdiettri...@aol.com 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

Re: [Lazarus] Subroutine ?

2013-07-31 Thread Frederic Da Vitoria
2013/7/31 Hans-Peter Diettrich drdiettri...@aol.com Frederic Da Vitoria schrieb: 2013/7/31 Hans-Peter Diettrich drdiettri...@aol.com mailto: drdiettri...@aol.com Components[] contains the components *owned* by the form, while Controls[] contains only the top-level controls, whose

[Lazarus] Subroutine ?

2013-07-30 Thread Terry A. Haimann
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? -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org

Re: [Lazarus] Subroutine ?

2013-07-30 Thread Mattias Gaertner
On Tue, 30 Jul 2013 22:53:40 -0500 Terry A. Haimann te...@haimann.us wrote: 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? for i:=0 to ControlCount-1 do Controls[i].Enabled:=false; Mattias --