• <GetStart>
  • CSPro User's Guide
    • The CSPro System
    • Data Dictionary Module
    • The CSPro Language
    • Data Entry Module
    • Batch Editing Applications
    • Tabulation Applications
    • Data Sources
    • CSPro Statements and Functions
    • Templated Reporting System
    • HTML and JavaScript Integration
    • Action Invoker
      • Overview
      • Execution Environments
      • Security and Formatting Options
      • Base Actions
      • Application Namespace
      • Clipboard Namespace
      • Data Namespace
      • Dictionary Namespace
      • File Namespace
      • Hash Namespace
      • Localhost Namespace
      • Logic Namespace
      • Message Namespace
      • Path Namespace
      • Settings Namespace
      • Sqlite Namespace
      • System Namespace
      • UI Namespace
        • UI Action Invoker Namespace
        • UI.alert Action
        • UI.closeDialog Action
        • UI.enumerateWebViews Action
        • UI.getDisplayOptions Action
        • UI.getInputData Action
        • UI.getMaxDisplayDimensions Action
        • UI.postWebMessage Action
        • UI.setDisplayOptions Action
        • UI.showDialog Action
        • UI.view Action
    • Appendix
  • <CSEntry>
  • <CSBatch>
  • <CSTab>
  • <DataViewer>
  • <TextView>
  • <TblView>
  • <CSFreq>
  • <CSDeploy>
  • <CSPack>
  • <CSDiff>
  • <CSConcat>
  • <Excel2CSPro>
  • <CSExport>
  • <CSIndex>
  • <CSReFmt>
  • <CSSort>
  • <ParadataConcat>
  • <ParadataViewer>
  • <CSCode>
  • <CSDocument>
  • <CSView>
  • <CSWeb>

UI.enumerateWebViews Action

Format
s = CS.UI.enumerateWebViews()
Description
The UI.enumerateWebViews action returns information about all of the web views currently showing.
Return Value
The action returns an object with two properties:
PropertyValue
"webViewId"If applicable, a number containing an ID that uniquely identifies the web view from which this action is executing.
"webViews"An array containing details about each web view currently showing. The topmost showing web view is the first entry in the array.
For example, this object, represented in JSON, may look like this when called from a HTML dialog from an application that uses HTML question text:
{
 
"webViewId": 19917272,
 
"webViews": [
    {
     
"webViewId": 19917272
    },
    {
     
"webViewId": 21877240
    }
  ]
}
The first web view ID in the array represents the web view showing the HTML dialog, and the second web view ID represents the web view showing the question text.
Exceptions
The action does not throw exceptions.
Example (HTML + JavaScript)
<script>
    const CS = new CSProActionInvoker();

    // there should be at least two web views since the question text is showing
    const webViews = CS.UI.enumerateWebViews();

    console.assert(webViews.webViews.length >= 2 && webViews.webViewId == webViews.webViews[0].webViewId);

    // post a web message to the question text, which will be the last web view in the array
    CS.UI.postWebMessage({
        message: `Posting a message to the question text window at ${new Date().toISOString()}.`,
        webViewId: webViews.webViews[webViews.webViews.length - 1].webViewId
    });
</script>
See also: UI Action Invoker Namespace, UI.postWebMessage Action