Thursday, February 4, 2010

FormDataSource.object method

There is a nice way to change a property for all controls on a form that are bound to the same field, for example, hide\unhide or enable\disable. FormDataSource has method object() which accepts field number as parameter and returns an object of type FormDataObject which has several properties to change controls' behavior, like visible(), enabled(), allowEdit() and others.
inventBatch_ds.object(fieldnum(InventBatch, ItemId)).visible(false);
This way to change controls' properties is more preferable than working with individual controls, since it's possible that user will add new controls for the same field using user setup.