6 19 6 Why Are the Contents of a Form Hidden from Other Forms

Visual LANSA

6.19.6 Why Are the Contents of a Form Hidden from Other Forms?

The contents of a form are hidden from other forms to reduce interdependencies between them. If an owner form could access the properties, events and methods of components in a member form, then changes in that component would require a change in the owner form as well.

Let's assume that a form has a field #Address1 which contains Street Name and Street Number. It also has a custom-defined property AddressInfo which other forms can use to set and retrieve the value of #Address1.

At some stage it becomes necessary to split the #Address1 field into two fields #StreetName and #StreetNumber. Consequently also the property routine for AddressInfo inside this form has to be changed. However, the AddressInfo property used by the other forms will not need to change. As a result, no change is required in the forms that set or get this property.

Similarly, you should consider creating user-defined methods to allow generalized processing for all owner forms. For example you can create a user-defined method for showing a form from an owner form. In its simplest, the method routine would be:

mthroutine uShowCustomerForm

   invoke #com_owner.showform

endroutine

 

You could then add to this method routine code to set the size of the form, to activate it in case it is behind other windows, restore it if it is minimized. All this processing then becomes automatically available to any form that shows the Customer Form using the uShowCustomerForm method.

Ý 6.19 Multi-Form Applications