4D v13

Documents in 4D Write Areas

Home

 
4D Write v13
Documents in 4D Write Areas

Documents in 4D Write Areas  


 

 

There are three types of areas available to you in 4D:

  • External areas in forms
  • External windows
  • Offscreen areas.

To use a 4D Write document, you either create an external area on a form or open an external window. You create an external area by drawing the area on a form in the Design environment. You open an external window either by choosing 4D Write from the Tools menu or by executing the Open external window function.

In addition to creating visible areas, you can create invisible offscreen areas. For more information, refer to the paragraph “4D Write Offscreen Areas”, later in this section.

4D Write uses variables to store the location of 4D Write areas, external windows, and offscreen areas. You reference the area on which you want to perform an operation by passing the variable containing the area’s ID number as a parameter to the command or function.
In the command descriptions that follow this introduction, the Area parameter refers to the variable identifying the document area.

There are two types of Area variables:

  • External object names
    When you create and name a 4D Write area, 4D automatically recognizes the name of the 4D Write area as a variable referring to the area. For example, you would refer to the Letter area by specifying “Letter” as for the Area parameter.
  • Variables you create for an external window or offscreen area
    When you create an external window or offscreen area using the Open external window or WR New offscreen area functions, you can store the area ID number returned by the function in a variable. You can then use the variable to refer to the external window or offscreen area in other commands and functions. To store the value in a variable, you place the variable name and the assignment operator (:=) to the left of the function in the line of code.

Most 4D Write commands require you to specify an area before they can be executed.

When you want a 4D Write document to appear in a 4D form, you must create a plug-in area on the form and assign it a unique name, specifying the plug-in type as 4D Write.

4D allows you to save this document with the record.

You will probably most often use the plug-in area to store a document or to use it instead of a text field if formatting is important.

4D allows you to create a 4D Write document in an independent area called an external window. External windows are useful when you want the user to have access to a word processor at any time to write letters, memos or other documents.

Issuing the 4D function, Open external window, from a method opens a specified window and returns an area ID in a long integer variable. You can reference this variable whenever you want to issue a 4D Write command to affect the external window.

For example:

 vWrite:=Open external window(50;50;350;450;8;"Merge Letter";"_4D Write")

For more information about the Open external window command, please refer to its definition in the 4D Language Reference manual.

An offscreen area is stored in memory and is not visible to the programmer or user. You can use an offscreen area to modify a document before a user views it or to save the document so a user can revert to the original, if necessary.

WR New offscreen area and WR PICTURE TO AREA are the two commands used to create an offscreen area. Remember to delete the offscreen area after you are done with it to free the memory it uses.

When placed in a global method, the following code creates an offscreen area for saving the document.

 QUERY([Employee];[Employee]ID=vID)
 If(Records in selection([Employee]=1)
    Area:=WR New offscreen area
    WR PICTURE TO AREA(Area;[Employee]Review_)
  `Store the review in the offscreen area
    MODIFY RECORD([Employee])
  `Modify the employees record
    WR DELETE OFFSCREEN AREA(Area)
  `Free the memory used by the offscreen area
 End if

Using a button on a form, you can allow a user to revert to the original saved document.

You can create a button on the input form and assign it the following code:

 Review:=WR Area to picture(Area)
  `Places the offscreen area that contains the original document into the external
  `area contained in the Review form.

 
PROPERTIES 

Product: 4D
Theme: 4D Write, Introduction to the language

 
SEE ALSO 

Multi-platform Document Management
Referring to Characters