Identifying actions in dialog methods

In ui.Dialog methods such as setActionActive(), the first parameter identifies the action object to be modified. This parameter can be full-qualified or partly-qualified. If you don't specify a full-qualified name, the action object will be identified based on the focus context.

The action name specification can be any of the following:

  • action-name
  • dialog-name.action-name
  • dialog-name.field-name.action-name
  • field-name.action-name (singular dialogs only)

Here action-name identifies the name of the action specified in ON ACTION action-name or COMMAND "action-name" handlers, while dialog-name identifies the singular dialog or sub-dialog and field-name defines the field bound to the action INFIELD clause of ON ACTION.

The action name must be passed in lowercase letters.

The runtime system will raise the error -8089 if the action specified by [dialog-name.][field-name.]action-name can not be found within the current dialog.

Note: As a general rule, assign unique action names for each specific dialog action, to avoid the usage of dialog and/or field identifiers.

In the DIALOG instruction, actions can be prefixed with the sub-dialog identifier. However, if methods like setActionActive() are called in the context of the sub-dialog, the prefix can be omitted. When using a field-specific action defined with the INFIELD clause of ON ACTION, you can identify the action with the full-qualified name dialog-name.field-name.action-name. Like sub-dialog actions, if you specify only action-name, the runtime system will search for the action object based on the focus context.

Note that an INPUT or CONSTRUCT sub-dialogs have no identifier by default. The dialog name can be defined with the NAME attribute. For more details, see Identifying sub-dialogs in procedural DIALOG.

When using a singular dialog like INPUT, you can identify field-specific actions by field-name.action-name, if the dialog was defined without a NAME attribute.

Example

MAIN
  DEFINE cust_rec RECORD
            num INT,
            name VARCHAR(50),
            city INT
         END RECORD
  DEFINE orders DYNAMIC ARRAY OF RECORD
            ord_num INT,
            cust_num INT,
            ord_date DATE
         END RECORD
  OPEN FORM f1 FROM "cust_ord"
  DISPLAY FORM f1
  DIALOG ATTRIBUTES(UNBUFFERED)
   INPUT BY NAME cust_rec.* ATTRIBUTES(NAME="cust")
      ON ACTION compare
         CALL compare()
      ON ACTION check INFIELD cust_city
         CALL check_city(cust_rec.city)
   END INPUT
   DISPLAY ARRAY orders TO sr_ord.*
      ON ACTION archive
         CALL archive()
   END DISPLAY
   ON ACTION print
      CALL print()
   ON ACTION disable_all
      CALL DIALOG.setActionActive("cust.compare", FALSE)
      CALL DIALOG.setActionActive("cust.cust_city.check", FALSE)
      CALL DIALOG.setActionActive("sr_ord.archive", FALSE)
      CALL DIALOG.setActionActive("print", FALSE)
  END DIALOG
END MAIN