This is REALLY messy and can potentially introduce errors in your actions!!!
Instead let pgTBObjSet() do all the work for you. If you group the buttons into a group and name it something like "Control_Buttons", then this single action will enable or disable the all the buttons in one operation!!
NOTE: In the example below, set the parameter parseGroup = true. This means that each item in the group will have their enabled property set to false.
Which action sequence do you feel is easier and faster to implement?
Advantages:
- Automatically takes into account added or deleted buttons from the group. You will not have to edit your code if you modify the group.
- If a button is deleted from the group, the former action sequence will throw a runtime error. However, the PowerPac function pgTBObjSet() will gracefully take into consideration the removed button and never throw an error.
- Makes it easier to follow the action logic and later make adjustments to the code.
- Works just as effectively with many other supported object types and properties. (Not just buttons; try it with fields too.)
- Effectively improves bandwidth when your page loads.
What if you want to disable all EXCEPT one or two buttons?
Solution: Just add the object property set actions to follow the global effect of pgTBObjSet() like this:
Can it get any easier!!