Popular Posts

Wednesday, 6 July 2011

control:: enum on forms


control:: enum on forms

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:

Post a Comment