Doens.be

  • Linkedin flickr twitter delicious Facebook Youtube

Setting propperties on a FormControl without AutoDeclaration

When you want to set a property of a control on a form without setting the property AutoDeclaration = yes. You can address the control trough the following code, knowing that element is a FormRun-object:

element.design().controlName("btnOk").visible(false);

Tags: , , , ,

2 Responses to “Setting propperties on a FormControl without AutoDeclaration”

  1. March 19th, 2010 at 10:04

    Björn says:

    Handy trick indeed.

    If you want a compile time check on the control name you can write it like this:
    element.design().control(control::btnOk).visible(false);

    Control is a special enum that maps a name to a control ID. It great for catching typos.

  2. March 19th, 2010 at 10:45

    Klaas Deforche says:

    Hi,

    An other way is:

    element.control(Control::btnOk).visible(false);

    It is better (imo) because you will get a compilation error if the control does not exist. In your example, the compiler will not warn you if btnOk does not exist as a control.

    Regards,
    Klaas.

Leave a Reply