Disabling fields used by a dialog

The form fields bound to a dialog are by default active (i.e. they can get the focus). When needed, disable the fields that do not require user input, and reactivate them later during the dialog execution. For example, imagine a form containing an "Industry" COMBOBOX field , with the options Healthcare, Education, Government, Manufacturing, and Other . If the user selects "Other", an secondary EDIT field should be activated automatically, to let the user input the specific description of the industry. But if one of the predefine values is selected, there is no need for the additional field, so secondary field can be left disabled.

This can be achieved by enabling/disabling fields with the ui.Dialog.setFieldActive() method according to the context. The "Industry" field case described can be implemented as follows:
DIALOG ATTRIBUTES(UNBUFFERED)
   INPUT BY NAME rec.*
      ON CHANGE industry 
         -- A value of 99 corresponds to the "Other" item 
         CALL DIALOG.setFieldActive( "cust.industry", (rec.industry!=99) )
     ...
   END INPUT
   BEFORE DIALOG
     CALL DIALOG.setFieldActive( "cust.industry", FALSE )
     ...
END DIALOG

Consider centralizing field activation / deactivation in a setup function specific to the dialog, passing the DIALOG object as parameter.

Do not disable all fields of a dialog, otherwise the dialog execution stops (at least one field must get the focus during a dialog execution).

It is also possible to hide fields with the ui.Form.setFieldHidden() method of the form objects. The dialog considers hidden fields as disabled (i.e. there is no need to disable fields that are already hidden). But hiding form elements changes the space used in the window layout and the form may be displayed in unexpected way, except when hiding elements in containers prepared to that, such as tables.