ExecuteCustomCall

The function ExecuteCustomCall invokes custom code in the ActiveX container that contains the ISSymbol control. For example, you can use this function to invoke custom JavaScript on web thin clients.

Function Group Execution Windows Embedded Thin Client Mobile Access
ExecuteCustomCall Graphic Asynchronous Not supported Not supported Supported Not supported

Syntax

  ExecuteCustomCall(optParam1,optParam2,…,optParamN)  
Web Studio Help  graphics executecustomcall.xml d412562e129 ExecuteCustomCall
optParam1
optParam2
optParamN
Parameters to be passed through the ISSymbol control to the ActiveX container. See “Notes” below.

Returned value

This function returns one of the following possible values:
Value Description
-1 Function is not supported.

This error will be returned if the function was called by any of the Background Task worksheets (e.g., Math, Script, Scheduler) on the project server. The function only works on web thin clients, and it only affects the web thin client on which it was called.

0 Function executed successfully.

Notes

This function can be used to invoke custom code in any ActiveX container that can add custom events to a control and receive VBArray objects. The following example only shows how this is done when the ActiveX container is Internet Explorer and the ISSymbol control is being used to drive a web thin client.

When you save a project screen as HTML, the resulting webpage by default is simply a frame for the ISSymbol control. The control is embedded in the webpage as an object, similar to a Flash player or a Java applet, and then it is configured to access your IWS project over the network. For more information, see About web thin clients.

There is nothing, however, that prevents you from customizing the webpage, as long as the object configuration is maintained. And as part of customizing the webpage, you might insert the following piece of JavaScript code:
  <script language="JavaScript"><!--        ISSymbol1.attachEvent("OnCustomCall",           function(parameters) {              var params = (new VBArray(parameters)).toArray();              …          }      );    //--></script>  

This code uses the method attachEvent to add the event OnCustomCall to the ISSymbol control, and then it binds a function to that event. The first line of the function sets up an array that will receive the parameters passed to the function from ExecuteCustomCall. (The parameters are passed as a VBArray object, from your IWS project through the ISSymbol control to the JavaScript function, and the first line of the function converts that VBArray object to a standard JavaScript array.) The rest of the function can be whatever you want it to be.

Once this code is inserted in the webpage, calling ExecuteCustomCall in your IWS project will cause the ISSymbol control to fire the event and execute the function in the web browser.

Note: The method attachEvent is supported only in Internet Explorer 5 through Internet Explorer 10. It will be deprecated in Internet Explorer 11. Instead, you may use the DOM-standard methods createEvent, initEvent, and addEventListener to do the same thing. For more information, go to: msdn.microsoft.com/library/ms536343.aspx

If the option Enforce Web functionality equivalence is selected in the project settings, this function cannot be called from Global Procedures or Script worksheets. This is because the function is meaningful only when it is executed on stations that display project screens; it might cause unexpected behavior if it is called from background tasks that are executed on the project runtime server. For more information, see Preferences tab.

ExecuteCustomCall