Modify properties on a form control
Often, the way that users interact with the application requires modification. Typically, you hide or disable controls on the page, replace standard labels with labels that are more appropriate, or even add new controls that the user requires. You can also create a form extension.
You can achieve even more flexibility through event subscription on form control events. This approach is discussed in other topics. In this topic, the focus is on metadata changes.
The customer requires changes to the Manage inventory FastTab on the Released product details page. You must change the label of the FastTab, disable the field group that shows the catch weight configuration, and add new controls. (For this example, the new controls aren't bound to existing fields in the data source).
Follow these steps to make the required changes.
- In the extension model, create an extension of the EcoResProductDetailsExtended form.
- Navigate through the form design tree to the TabPageInventory tab page (Design > Tab > Details > GroupDetails > TabHeader > TabPageInventory), select it in the designer, and open the Property sheet.
Update the Caption property to the desired value.
Right-click the tab page, and then select New. Set the required properties on the new control. You can also move the control up and down in the immediate container to position it correctly.
Alternatively, right-click the subnode that the new control should appear after, select Insert sibling, and then select the type of control to add.
Of course, you can just drag bound controls over from the corresponding data source.
Select the PdsCatchWeight group control, and change the Enabled property to No.
If you change metadata properties such as Enabled and Visible, there is no guarantee that the control will stay in that state at runtime. After a form is loaded, business logic on that form can change the state of controls through code.
When you've finished, the page includes additional fields, catch weight information can't be edited, and the whole FastTab has a different caption.
You can't modify the AutoDeclaration property on controls. However, you can still access the controls by name from code.