I have tried the following: AX2009 Loop through all the controls in the form on init, and have been able to loop through all the form controls in the form when opening it.
But, for some reason, when i try to edit a form control, it is not working. I have a switch statement like this:
switch ( control.handle() )
{
case classnum(FormBuildButtonControl):
formBuildButtonControl = control;
formBuildButtonControl.enabled(false);
break;
}
When the form then opens, the button control is still enabled. I have tried calling the loop method from before and after the super in the run method and from before and after the super method in the init and it did not work in any of them. Although, it does not work when called before the super in the init method because I have to use some properties from initalized form controls.
Ok, I figured this out. Instead of using the FormBuildButtonControl class, the following can take the control id and be called to makes changes to the control: element.control(control.id()).enable(false);
Edit: The looping can also be called from before or after the super in the run or after the super in the init method.