4D View Pro: Offscreen Areas

Automatically translated from English

Want to dynamically generate 4D View Pro documents on a server and, for example, send them by email or calculate values? 4D v18 R4 introduces a new command to manipulate 4D View Pro commands in an offscreen area: VP Run offscreen area.

The HDI below demonstrates how to use a 4D View Pro offscreen area and export documents in PDF or MS Excel files:

HDI 4DVP offscreen

VP Run offscreen area creates a 4D View Pro area in memory. Simply pass all of the area’s pertinent information in parameter, such as:

  • The area name
  • The method called when an event is thrown by the 4D View Pro area.

 

For example if you want to open a 4D View Pro document to retrieve a value, just create a class with the necessary information and a function named “onEvent“. The “onEvent” function is automatically called when an event occurs in the offscreen area. You can manage events with the FORM Event command.

// OffscreenArea class declaration
Class constructor
C_TEXT($1)
This.filePath:=$1
 
// This function will be called on each event for the offscreen area
Function onEvent
Case of
: (FORM Event.code=On VP Ready)
  VP IMPORT DOCUMENT (This.area;This.filePath)
  This.result:=VP Get value (VP Cell (This.area;6;22))
End case 

Instantiate this class and pass it to the VP Run offscreen area:

$o:=cs.OffscreenArea.new()
$result:=VP Run offscreen area ($o)
ALERT("The G23 cell contains the value: "+String($result))

Refer to the documentation for more in-depth information about what you can do with this new command.

Fabrice Mainguené

• Product Owner •

Fabrice Mainguené joined 4D Program team in November, 2016. As a Product Owner, he is in charge of writing the user stories then translating it to functional specifications. His role is also to make sure that the feature implementation delivered is meeting the customer need.

After obtaining a Bachelor degree in Computer Science at CNAM, Fabrice joined a small software publishing company as a Windev developer. Then he worked for different companies in industry and trade areas as a Windev and web developer as well as technical advisor on new features.