How To Enable and Disable Dialog Elements

During end-user interaction, it may be implicitly clear that certain dialog elements must not be used. For example, if a dialog requiring personnel data contains a group of radio button controls for marital status and an input field control for date of marriage, the input field control must be disabled whenever the marital status is other than married.

There are two ways to do this:

  • Use Natural code to enable/disable a dialog element dynamically.

  • Use the dialog editor (to disable a dialog element initially).

The first method is used more often.

The Natural code might look like this:

/*First alternative 
... 
IF #RB-1.ENABLED = TRUE     /* Logical condition 
   #IF-1.ENABLED := TRUE    /* Set ENABLED to TRUE 
END-IF 
... 
/*Second alternative 
#PB-1.ENABLED := #RB-1.ENABLED

When you use the dialog editor, you set the attribute ENABLED to TRUE by marking the Enabled entry in the dialog element's attributes window.

To disable editing in input-field controls, selection box controls and edit area controls, it is not always necessary to disable these dialog elements entirely. It may be sufficient to make them MODIFIABLE = FALSE.