Adapting to viewport changes

Application forms and functions can be adapted according to the front-end viewport size or mobile device orientation.

Detecting viewport size / orientation changes

When the mobile device orientation changes, or when the current window is resized on desktop/web front-ends, the windowresized specific predefined action will be sent, if an ON ACTION handler is defined by the current dialog for this action.

Note: The windowresized action should only be used to hide/show items on the current form using the standard user interface API (ui.Form.setElementHidden()) and not reload forms on the fly.

This predefined action can be used to detect viewport geomatry changes and adapt the application form to the new size:

  ON ACTION windowresized
     -- Code to adapt to the new viewport size
Note: In dialogs allowing field input (INPUT / INPUT ARRAY or CONSTRUCT), take care of the current field input: The windowresized action can force the field validation. Therefore, it is not recommended to use this special action in these dialogs. The action can be safely used in DISPLAY ARRAY and MENU dialogs.
To control the action view rendering defaults and current field validation behavior when the windowresized action is used and fired, consider setting action defaults attribute for this action in your .4ad file as follows:
<ActionDefaultList>
  ...
  <ActionDefault name="windowresized" validate="no" defaultView="no" contextMenu="no"/>
  ...
</ActionDefaultList>

Querying the geometry of the viewport

Use the feInfo/windowSize front call to query the actual size of the front-end view-port (GDC current window, GBC webview, or mobile screen size):
DEFINE size STRING
CALL ui.Interface.frontCall("standard","feInfo",["windowSize"],[size])
IF size == "1200x1824" THEN
   ...
END IF