BEFORE MENU block

If the MENU block contains a BEFORE MENU clause, statements within this clause will be executed before the menu dialog starts.

This block is typically used to hide or disable some menu options according to the current context of the program. For example, when the current user is not allowed to create new records, the menu options can be disabled as follows:

MENU "Orders"
   BEFORE MENU
      CALL DIALOG.setActionActive("append", can_user_append() )
      ...
   COMMAND "Append" -- creates "append" action (lowercase)
      ...
   ...
END MENU

In TUI mode, the menu options can also be disabled, but they will still be displayed on the screen. The end user will see the option, but cannot select it. In this case it's more convenient to hide the option to the end user with the DIALOG.setActionHidden() method, instead of disabling the action.