Odd code in AX #2: control:: enum on forms

April 13, 2010 at 18:14
filed under Dynamics AX
Tagged , ,

A somewhat non-intuitive way of accessing controls on a form is using a built in enum named ‘control’. This enum automatically contains all controls of you form (tabs, buttons, etc), and you can reference them by name.

So, if for example your button is called ‘ButtonFunctions’, you can set the property ‘enabled’ to false like this:

element.control(Control::ButtonFunctions).enabled(false);

The main advantage here is that you don’t have to set the property autodeclaration to yes.

no comments

RSS / trackback

respond