Documents in 4D Draw Areas

4D - Documentation   Français   English   German   4D Draw 2004, Command Theme List   4D Draw 2004, Command Alphabetical List   Back   Previous   Next

version 6.0


A 4D Draw document can exist in any of three locations (areas) in 4th Dimension:

External areas in forms

External windows

Offscreen areas

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

In addition to creating visible areas, you can create invisible offscreen areas.

Area ID Numbers and Area Variables

When you use commands to control a 4D Draw document, you need to identify the document by its area ID number. Wherever the document is located, 4D Draw needs its area ID number to locate it and operate on it. The area ID number is internal to 4D Draw and is normally stored in a variable.

4D Draw uses variables to store the location of 4D Draw 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 area object names

Variables you create for an external window or offscreen area

External area object names

When you create and name a 4D Draw area, 4th Dimension automatically recognizes the name of the 4D Draw area as a variable referring to the area. For example, you would refer to the FloorPlan area by specifying "FloorPlan" as the area parameter.

Variables for external window or offscreen area

When you create an external window or offscreen area using the Open external window or DR New offscreen area functions, the area ID number returned by the function should be stored 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 Draw commands require you to specify an area before they can be executed.

The following example creates a 4D Draw external window and stores the area ID number in the MyArea variable:

MyArea:=Open external window(30;30;350;450;8;"Design";"_4D Draw")

4D Draw External Areas on Forms

When you want a 4D Draw document to appear in a 4th Dimension form, you must create an external area on the form and assign it a unique name, specifying the external area type as 4D Draw. You can place 4D Draw areas in an input form, so that you can work with documents, or in an output form to display and print information.

4D Draw can use the entire form, or it can share space with fields and other form elements.

You use an active object area of the external object type for 4D Draw. An external object is one of several types of active objects in 4th Dimension, such as buttons, enterable areas, and scrollable areas. For complete information about external objects, see the 4th Dimension Design Reference and Language Reference.

When you need to refer to a document on a form, use the object name that you used when you created the 4D Draw external object.

4D Draw External Window Areas

4th Dimension allows you to create a 4D Draw document in an independent area called an external window. External windows for 4D Draw are useful when you want the user to have access to a drawing program at any time.

Issuing the 4th Dimension 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 Draw command to affect the external window.

For complete information about the Open external window function, see the 4th Dimension Language Reference.

4D Draw Offscreen Areas

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

4D Draw operations in an offscreen area can be performed more quickly because the screen does not have to be redrawn.

You can use the DR New offscreen area function to create an offscreen area. You can use the DR PICTURE TO AREA command to place a 4D Picture field—which can contain a 4D Draw area— in a 4D Draw area—which can be an offscreen area.

Remember to delete the offscreen area after you are done with it to free the memory it uses. 4th Dimension will display an error message when you close the database if you have not cleared all offscreen areas.

When placed in a project method, the code in the following example creates an offscreen area for saving a document. Using a button on a form, you can allow the user to revert to the original saved document.

   Area:=DR New offscreen area
   QUERY([Designs];[Designs]CustID=vCustID)
   If(Records in selection([Designs]=1)
      Area:=DR PICTURE TO AREA(Area;[Designs]FloorPlan_)
         `Store the floor plan in the offscreen area
      MODIFY RECORD([Designs])
         `Modify the designs record
      DR DELETE OFFSCREEN AREA(Area)
         `Free the memory used by the offscreen area
   End if

Create a button on the input form and assign it the following code:

   Review:=DR Area to picture(Area;-2)
      `Places the offscreen area that contains the original document 
      `into the external area contained in the FloorPlan form.

4D - Documentation   Français   English   German   4D Draw 2004, Command Theme List   4D Draw 2004, Command Alphabetical List   Back   Previous   Next