This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com

Home

 
4D v20 R7
WA Run offscreen area

WA Run offscreen area 


 

WA Run offscreen area ( parameters ) -> Function result 
Parameter Type   Description
parameters  Object in Object containing the web area's attributes
Function result  Mixed in .result property of the onEvent object, or Null if does not return a value

The WA Run offscreen area command creates a web area in memory which can be used to automatically load and parse web pages. 

Note: This command uses the embedded web rendering engine. 

In parameters object, pass any of the following optional properties. These properties will be available through the This command within the onEvent method and reference the instance: 

Property  Type  Description 
url  text | file object The URL or file to be loaded in the web area. If omitted or null, a blank page is loaded.
area  text  The name of the web area. If omitted or null, a generic name is assigned (e.g., OffscreenArea1).
onEvent object (formula) A callback method that will be launched when the web area is ready. It can be either:
  • an onEvent function of a class, or
  • a Formula object
By default, the callback method is called on the On Load, On Unload, On End URL Loading, On URL Loading Error, or On Timer events.
autoQuit  boolean  True (default value) if the command must stop the formula execution when the On End URL Loading or On URL Loading Error events occur.

If false, you must use the CANCEL or ACCEPT commands in the callback method or project methods called with the $4d object to close the web area.
timeout  real  Maximum time (expressed in seconds) before the area automatically closes if no event is generated. If set to 0, no limitation is applied. Default value: 60
result mixed Result of the processing to be returned (if any)
<customProperty>  mixed Any custom attribute to be available in the callback or $4d method.

 

The following property is automatically added by the command if necessary:

Property  Type Description
timeoutReached boolean Added with true value if timeout has been exceeded


If a null value is passed in parameters, a blank web area will be created and then automatically closed.

Notes

  • The offscreen web area is only available during the execution of the WA Run offscreen area command. It will automatically be destroyed once execution has ended.
  • 4D methods can be called from the JavaScript code executed in a web area. See Accessing 4D methods.

The following commands can be used in the callback method:

Example  

You want to create and handle an offscreen web area using a function of your OffscreenArea class:

 $config:=cs.OffscreenArea.new()
 $result:=WA Run offscreen area($config)
 If($config.timeoutReached) //automatically returned in case of timeout
    ALERT("Timeout reached")
 End if

In the OffscreenArea class:

 Class constructor
 This.url:=File("/RESOURCES/compute.html")
 This.area:="myWAOffscreen"
 
 Function onEvent
 Case of
    :(FORM Event.code=On End URL Loading)
       This.result:=WA Evaluate JavaScript(*;This.area;"myJSMethod();")
 End case

The OK system variable is set to 0 if the timeout has been reached or the CANCEL was called in onEvent, otherwise it is set to 1.



See also 

FORM Event
Programmed management of Web Areas
WA OPEN WEB INSPECTOR

 
PROPERTIES 

Product: 4D
Theme: Web Area
Number: 1727

The OK variable is changed by the command

 
PAGE CONTENTS 
 
HISTORY 

Created: 4D v18 R3
Modified: 4D v18 R6

 
ARTICLE USAGE

4D Language Reference ( 4D v20 R7)