UIDisplayMode function

Syntax

UIDisplayMode()

Description

Use the UIDisplayMode function to return an Integer value indicating the user interface display mode of the current execution context (a combination of the active web profile configuration and the user’s browser):

Numeric Value Description

0

Error (undefined)

1

Classic

2

Fluid

3

Small form factor optimized

Parameters

None.

Returns

A Integer value.

Example 1

In the following example, certain characteristics regarding the browser and web profile are obtained from the executing environment. In turn, these values are used to construct a cookie that is saved to the browser.

/* Read conditional navigation related parameters */
Local number &formfactor = %Request.BrowserDeviceFormFactor;
Local number &fluidCapable = UIDisplayMode();
/*Error - Default back to classic mode when undefined. */
If (&fluidCapable = 0) Then
   &fluidCapable = 1; /* Set to classic mode. */
End-If;

/* Set a browser cookie indicating these characteristics */
&cookieStr = "PS_CONDNAV" | "=" | &fluidCapable | "," | &formfactor | "; ";
&cookieStr = RTrim(&cookieStr, "; ");
&reqMsg.IBInfo.IBConnectorInfo.Cookies = &cookieStr;
&resMsg = %IntBroker.SyncRequest(&reqMsg, &targetNode);

Example 2

In the following example, the display mode is set as a property of the search object. Then, if the current mode is classic, certain characteristics are set for conditional navigation search mode:

...
   %This.nUIDisplayMode = UIDisplayMode();
   %This.SearchType = "S";
   %This.IsAdvancedSearch = False;
end-method;
...

method SetConditionalSearchNavMode
   /+ Returns Boolean +/
   If Not %This.bIsGlobalSearch Then
      Return False;
   End-If;
   Local string &name = "PTSF_NAV_MODE";
   If (%This.nUIDisplayMode = 1) Then
      %This.fg.MatchAny();
      %This.fg.EqualsString(&name, "1");
      %This.fg.NotEqualsString(&name, "2");
      %This.fg.EndMatchAny();
      Return True;
   End-If;
   Return False;
end-method;