Board index » delphi » Disabling all form controls in D1

Disabling all form controls in D1

Using Delphi version 1:

I want to make a universal procedure that will disable always user controls
on a form yet to allow me to leave a couple of controls enabled, or reenable
a couple of controls after they are disabled.  Since I want this to be
universal, I do not really care to explicitly call each controls enable
method.

Looping through the controls is easy, and determining whether the control
has an 'enable' property is also relatively easy using the GetPropInfo()
function.  What I cannot find is how to set the control's enable property
using the PPropInfo reference.  I assume there is something and the TypInfo
unit that would allow me to set the value of a Boolean property.  Then
again, maybe not.

If anyone has any ideas on how to accomplish what I am trying to do I would
really appreciate hearing about it.  It seems like it should be easy task,
and maybe I am overlooking something simple.  But so far, I haven't found
it.

Thanks in advance,

Scott

 

Re:Disabling all form controls in D1


Why not use the TAG property. Set to 1 for controls you wish to diaable,
0 for those you wish to leave enabled.

Then do a scan thru components setting enable/disable based on tag value.

- A.

[This followup was posted to comp.lang.pascal.delphi.misc and a copy was
sent to the cited author.]

In article <6tu8go$oq...@ramp2.tir.com>, sc...@sjm.net says...

Quote
> Using Delphi version 1:

> I want to make a universal procedure that will disable always user controls
> on a form yet to allow me to leave a couple of controls enabled, or reenable
> a couple of controls after they are disabled.  Since I want this to be
> universal, I do not really care to explicitly call each controls enable
> method.

> Looping through the controls is easy, and determining whether the control
> has an 'enable' property is also relatively easy using the GetPropInfo()
> function.  What I cannot find is how to set the control's enable property
> using the PPropInfo reference.  I assume there is something and the TypInfo
> unit that would allow me to set the value of a Boolean property.  Then
> again, maybe not.

> If anyone has any ideas on how to accomplish what I am trying to do I would
> really appreciate hearing about it.  It seems like it should be easy task,
> and maybe I am overlooking something simple.  But so far, I haven't found
> it.

> Thanks in advance,

> Scott

Other Threads