ui.Dialog.setActionActive

Enabling and disabling dialog actions.

Syntax

setActionActive(
  name STRING,
  active BOOLEAN )
  1. name is the name of the action.
  2. active is a boolean value.

Usage

Use the setActionActive() method to enable or disable an action.
ON ACTION hide 
  CALL DIALOG.setActionActive("zoom", FALSE)

In GUI applications, push-buttons triggering actions should normally be disabled if the current context / situation makes the corresponding action invalid or unusable. For example, a "print" button should be disabled if there is nothing to print. The setActionActive() method is typically used to enable/ disable actions according to the context.

The second parameter of the method must be a boolean expression that evaluates to 0 (FALSE) or 1 (TRUE).

To simplify action activation, write a common "setup" function which centralizes all rules to enable/ disable actions. This function can then be called from any place in the DIALOG instruction, passing the DIALOG object as parameter. See Example 3.

When the action activation depends from a field context, use the INFIELD clause of ON ACTION to automatically disable an action if the focus leaves the specified field.

For more details about action names, see Identifying actions in dialog methods.