Tutorial Chapter 5: Enhancing the Form |
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.
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.
MENU ... ON ACTION close EXIT MENU END MENU
By default the action view for the close action is hidden and does not display on the form.