Command Using 4D View areas

4D View

Using 4D View areas

version 6.8


You can use programming in the following 4D View environments:

• 4D View areas included in forms

• 4D View external windows

• Off-screen 4D View areas

To work in a 4D View document, you must either create a plug-in area in a form or open an external window.

To create a plug-in area in a form, draw it in the 4D form editor in the Design environment.

To open an external window, choose the 4D View command from the 4D Tools menu or execute the 4D command Open external window.

Other than visible areas, 4D View allows creating off-screen areas, in other words, invisible areas. For more information on this, refer to the "4D View offscreen areas" paragraph below.

4D View area references


Once a 4D View document has been modified using routines, its area identification will need to be specified. This identification is internal to 4D View and is generally located in a variable.

4D View uses variables to save included area pathnames, external windows and off-screen areas. To reference the area where you want to execute an operation, pass the variable containing the area identification as a parameter to the command or the function.

In command descriptions within this documentation, the Longint variable type identifying the 4D View document area is called area.

There are two types of area variables:

• Names of included areas

• Variables created for an external window or an off-screen area

Names of included areas

Once you create and name a 4D View area in a form, 4D considers the name of the 4D View area to be the variable referencing the area. For example, you would reference the "Sheet" area by specifying "Sheet" as the area parameter.

External windows and off-screen area IDs

Once you create an external windows or an off-screen area using the Open external window or PV New offscreen area functions, the area identification number sent back by the function must be saved in a variable. You can use this variable later to make a reference to the external window or off-screen area in other commands and functions. To save the value in a variable, place the variable name and the assignment operator (:=) to the left of the function in the line of code.

The following example creates an external 4D View window and saves the area identification number in the MyArea variable:

   MyArea:=Open external window(30;30;350;450;8;"Sheet";"_4D View")

4D View plug-in areas in forms


A 4D View area can be placed in any form: most often, it is placed in an input form to work with documents, but also in output forms to display or print information

4D View uses the entire form or shares space with fields and other form elements.

You must use a "plug-in area" active object area with 4D View. A plug-in area is one of several types of active objects in 4D (other examples include buttons, entry areas, scroll areas, etc.)

You can also associate the plug-in area with a 4D field so that the contents of the area are saved with each save. Be careful, if you do not use automatic buttons such as Validate but rather the SAVE RECORD command, you will first have to execute PV Area to blob to transfer the content of the 4D View area content in the 4D field since the automatic save mechanism is not active.

For more information on creating 4D View areas in forms, refer to the 4D View User manual.

4D View external windows


Use the 4D Open external window function to open an external window and display a blank 4D View document.

Open external window opens a new window, displays the specified plug-in and returns an identification number for the area.

Below is an example of how to use Open external window. This instruction will open an external window and displays an empty 4D View document.

   PvRefArea:=Open external window (50;50;350;450;8;"Spreadsheet"; "_4D View")

Use PvRefArea every time that you need to make reference to this document. For a complete description of the Open external window command, refer to the 4D Language Reference manual.

4D View off-screen areas


A off-screen area is stored in memory: it is invisible to the programmer and user. It is generally useful in two cases: to modify a document before the user views it or for saving the document so that the user can go back to the original, if necessary.

4D View operations function faster in an off-screen area as the area does not need to be drawn.

Use the PV New offscreen area function to create an off-screen area.

Do not forget to delete the off-screen area after using it to free up used memory by using the PV DELETE OFFSCREEN AREA routine. If you close the database without having terminated all the off-screen areas, 4D will display an error message.