Home > Software design >  Disable all child objects/components on a panel
Disable all child objects/components on a panel

Time:09-22

I have a panel containing labels, buttons, memo's, etc. and I want every component to be disabled on that panel, individually (i.e., Enabled is false).

I want the components to be disabled individually (and not just the panel itself to be disabled) to show the person using my program that the objects are there but cannot be used (they are greyed out because the Enabled property is false).

Is there a quicker way of disabling all of them at once, instead of changing the Enabled property to false for each component?

CodePudding user response:

Is there a quicker way of disabling all of them at once, instead of changing the Enabled property to false for each component?

The fastest way is to just disable the Panel itself, but you ruled out that possibility. So no, there is no other way. You must loop through the Panel's components and disable them one at a time.

  • Related