version 6.0
Object ID Numbers
Every object in a 4D Draw document is given a unique number. This number is referred to as the object's ID and is assigned when the object is created.
This means that each time the user draws an object with the palette, pastes an object from the Clipboard, groups several objects, duplicates an existing object, or pastes a field reference, a new ID is assigned. Since the object ID is unique, IDs are a convenient way to refer to objects. Object IDs are never reused within a document. Even if an object is deleted, its number is "retired" for the life of the document.
Object IDs cannot be transferred. An object whose ID is equal to 5 in one 4D Draw document will not necessarily have the same ID if it is pasted into another document.
All of the standard object creation commands are functions and return the resulting object's ID. Unlike objects created by the user through the palette, objects created through the commands are not automatically selected.
You can obtain the ID of an object using the DR Get ID function.
Disabling Access to Text Objects
If you want to disable access to text object attributes, you must deactivate both the Text menu and the Attributes menu item in the Object menu. A text object is accessible by either means.
If you do not want to disable access to the Attributes menu item for objects other than text objects, you can install a method using DR ON MENU to test if the menu item has been selected. You need only determine the type of the selection the user made before choosing the menu item. If the selection contains an object of type Text, you can display an alert box. If not, you can execute the menu item using the DR DO COMMAND command.
Specifying an Object's Coordinates
An object's position and size are referred to as its coordinates. All commands that describe or specify coordinates do so in base units. Base units are the units specified in the Base Units pop-up menu in the Rulers dialog box. Use the DR Scale to base and DR Base to scale functions to convert between base and scale units.
Most commands that describe or specify a position do so with respect to the origin. The origin is the intersection of the zero points on the horizontal and vertical rulers. In some commands, an option is given to specify the ending point with respect to the starting point. For instance, in DR Draw rectangle, the first point (startH/startV) is always specified using the origin, but the second point (endH/endV) can use either the origin or an offset from the starting point. The following diagrams illustrate the difference between absolute and relative measurement:
A positive coordinate indicates a position to the right or below. A negative coordinate indicates a position to the left or above.
Specifying the Scope of a Command
Many 4D Draw commands have a parameter called scope, which specifies those objects or text characters in a 4D Draw document that are affected by the command. The following table describes the general rules for scope. For a description of how scope affects a given command, see the command description.
| Scope | Affected text or object |
| >0 | Selected objects |
| 0 | Selected objects |
| -1 | All objects in the document |
| -2 | Default values |
| -3 | Selected characters |
| -4 | Foreground objects |
| -5 | Background objects |
Modifying Hidden and Background Objects
Objects that are hidden (invisible) or that are part of the background can be selected only by using the 4D Draw language. When selecting objects that are hidden or on the background, we strongly recommend that you perform the following steps before returning control to the user.
1. Select the objects.
2. Perform the action on the objects.
3. Deselect the objects.
This last step is important because the user may inadvertently perform an action on the objects if they remain selected.