Managing Actions
Disable/Enable Actions
In the example in the previous lesson, if the user clicks the Next or Previous buttons on the application form without first querying successfully, a message displays and no action is taken. You can disable and enable the actions instead, providing visual cues to the user when the actions are not available.
The ui.Dialog built-in class provides an interface to the BDL interactive
dialog statements, such as CONSTRUCT and MENU. The method
setActionActive enables and disables actions. To call a method of this class, use
the predefined DIALOG object within the interactive instruction block.
For example:
MENU
...
BEFORE MENU
CALL DIALOG.setActionActive("actionname" , state)
...
END MENU
where actionname is the name of the action, state is an
integer, 0 (disable) or 1 (enable).
You must be within an interactive instruction in order to use the DIALOG object
in your program, but you can pass the object to a function. Using this technique, you could create a
function that enables/disables an action, and call the function from the MENU
statement, for example. See The Dialog class in the Genero Business Development Language User Guide for further
information.
The Close Action
In Genero applications, when the user clicks the 
button in the upper-right
corner of the application window, a predefined close action is sent to the
program. What happens next depends on the interactive dialog statement.
- When the program is in a
MENUdialog statement, thecloseaction is converted to anINTERRUPTkey press. If there is aCOMMAND KEYINTERRUPTblock in theMENUstatement, the statements in that control block are executed. Otherwise, no action is taken. - When the program is in an
INPUT,INPUT ARRAY,CONSTRUCTorDISPLAY ARRAYstatement, thecloseaction cancels the dialog, and theis set toINT_FLAGTRUE. Your program can check the value ofand take appropriate action.INT_FLAG
close action within the
interactive statement. For example, to exit the MENU statement when the user
clicks this
button:MENU
...
ON ACTION close
EXIT MENU
END MENUBy default the action view for the close action is hidden and does not display
on the form.