Reading the Browser Window Size and Screen Size

You can adjust the display of your application if the size of the browser window or the size or orientation of the screen or presentation device changes.

Context

With methods of interface IF_WD_CLIENT_INFORMATION you can be notified if users turn their mobile devices, the size of the browser window changes, or switches device to run your application on. With this information you can respond appropriately in your application.

Procedure

  1. To retrieve an instance of interface IF_WD_CLIENT_INFORMATION, call method GET_CLIENT_INFORMATION of interface IF_WD_APPLICATION (for example, in method WDDOINIT).
    You can use the following code:
  2. There are several different ways of reading the properties of the client:
    • Use the following GET methods of interface IF_WD_CLIENT_INFORMATION (e.g. in method WDDOMODIFYVIEW) to retrieve the relevant properties:
      • GET_CLIENT_WIDTH
      • GET_CLIENT_HEIGHT
      • GET_SCREEN_WIDTH
      • GET_SCREEN_HEIGHT
      • GET_SCREEN_ORIENTATION
      • GET_DEVICE_TYPE

      If the application is started with only one roundtrip (without loading aninmation), the sizes are not available initially. If the information is needed at this point, you can register an event handler. This will trigger a roundtrip. The following steps describe how to register an event handler.

    • Register an event handler that will be called if these properties have been changed. Proceed as follows:
      1. Create the event handler (e.g. ONACTIONRESIZE).
      2. Link the event handler to the RESIZE event (e.g. in method WDDOMODIFYVIEW).

        To do this, you use method REGISTER of interface IF_WD_CLIENT_INFORMATION.

        You can use the following code:
      3. Implement the event handler method. You can read the following parameters:
        • OLD_SCREEN_WIDTH
        • SCREEN_WIDTH
        • OLD_SCREEN_HEIGHT
        • SCREEN_HEIGHT
        • OLD_WIDTH
        • WIDTH
        • OLD_HEIGHT
        • HEIGHT
        • OLD_ORIENTATION
        • ORIENTATION
        • OLD_DEVICETYPE
        • DEVICETYPE