Implementing the close action
The close action is a predefined action dedicated to close graphical
windows (for example, with the X cross button).
Purpose of the close action
With GDC/UR on desktop, the "close" action can be triggered by pressing Alt+F4
or by clicking the X cross button in the upper-right corner of the desktop
window.

With GBC in a web browser, an X button is displayed on the right of the chromebar, to trigger the "close"
action:

Genero BDL has a predefined "close" action name dedicated to this specific
window closing event.
When the end user triggers an X close button, the event can be managed in the
program code with an ON ACTION close block. If this action handler is not defined
in the current dialog, the VM implements a default behavior for the close action, depending on the
type of dialog.
The "close" action can be disabled with
DIALOG.setActionActive("close",FALSE). With GDC/UR desktop, a click on the x-cross
button of the desktop window will have no effect. If the chromebar is visible, the action views for
the "close" action is made invisible, while the default action view button in the
action panel is disabled, if present.
Details for the default action
view hanlding of the "close" action:
-
With GBC in browser:
-
When the chromebar is visible,
DEFAULTVIEWhas no impact on the(X)close button on the right of the chromebar. -
When the chromebar is hidden,
DEFAULTVIEWis taken into account to hide or show the default action view button in the action panel.
-
-
With GDC/UR desktop:
-
Independently from the chromebar visiblility, the button in the action panel will never be shown: We consider the
[x]button of the desktop window as the view for the "close" action, even ifDEFAULTVIEW=YES?
-
The close action in a DIALOG multiple dialog block
The close action executes an ON ACTION close block, if defined.
Otherwise, the close action is mapped to the cancel action, when
an ON ACTION cancel handler is defined.
If neither ON ACTION close, nor ON ACTION cancel are defined,
nothing will happen if the user tries to close the window with the X cross button
or an ALT+F4 keystroke.
The int_flag register will not
be set in the context of DIALOG.
The close action in singular data handling dialogs
By default, for INPUT, INPUT ARRAY, CONSTRUCT,
DISPLAY ARRAY or PROMPT dialogs, the VM will create a
close action, except if the singular dialog is defined with
ATTRIBUTES(CANCEL=FALSE).
When an ON ACTION close handler is explicitly defined in an
INPUT, INPUT ARRAY, CONSTRUCT, DISPLAY
ARRAY or PROMPT dialog, the handler code will be executed if the
close action is fired.
If no explicit ON ACTION close handler is defined, the close
action acts the same as the cancel predefined action: When the user clicks the
X cross button, the dialog stops and the int_flag is set to 1.
If there is an explicit ON ACTION cancel block defined,
int_flag is set to 1 and the user code under ON ACTION cancel
will be executed.
If the CANCEL=FALSE option is set, no cancel and no
close action will be created, and you must write an ON ACTION
close handler to proceed with the close action. In this case, the
int_flag register will not be set when the close action is
invoked.
The close action on mobile devices
When displaying on Androidâ„¢ and iOS mobile device, the
close action can be bound to the "Back button". For more details, see The Back button
Example
Implementing a close action handler, to open a confirmation dialog box, before
leaving the dialog:
DIALOG ...
INPUT BY NAME cust_rec.*
END INPUT
...
ON ACTION close
IF msg_box_yn("Close this window?") == "y" THEN
EXIT DIALOG
END IF
...
END DIALOG