How to load a subform

It may be necessary that you want to load a subform by clicking a button. To do so, add the following code to the on_click action of a button. Line 1 gets a handle to the subformobject named "mysubform". In line 2 old settings will be cleared, line 3 adds depending fields between the form and the subform. In line 4 the name of the (existing) subform is added, and last not least in line 5 the definition will be loaded and activated.

Example 5.18. Load a subform

subform=hk_thisform.get_pyvisible("mysubform") (1)
subform.clear_depending_fields() (2)
subform.add_depending_fields("subfield","masterfield",False) (3)
subform.set_name("Subformname") (4)
subform.activate_subform() (5)