DR Get ID

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

version 6.0


DR Get ID (area; scope; index) Longint

ParameterTypeDescription
areaLongint4D Draw area
scopeLongint-1=All
0=Selected
>0=Group ID
indexLongintIndex number into list
Function resultLongintObject ID

Description

The command DR Get ID returns the unique ID for the object in area described by scope and index. This number is used by many other 4D Draw commands and is referred to as an object's ID.

To get an object's ID, you specify the set of objects to which to refer; then specify the order of the object within the set. Objects are ordered from back to front. The object that is farthest in back has an index of 1.

If scope equals -1, then index refers to the order of the object within the entire document.

If scope equals 0, then index refers to the order of the object within the currently selected objects.

If scope is greater than 0, it must be the ID for a group, and index refers to the order of objects within the group. This last syntax lets you manipulate objects in a group without ungrouping.

The codes for the scope parameter are given in the paragraph "Specifying the Scope of a Command" of the Manipulating Objects section.

Examples

(1) The following example shows how to extract the ID for an object.

   vID := DR Get ID (Area;0;1)
      `Get the ID of the first selected object

(2) The following code segments show how to loop through different sets of objects and get their ID's.

      `Looping through all objects
      `Counts the number of objects in the entire document
   $Count := DR Count (Area;-1)
   For($i;1;$Count)
         `Loop for all objects in the document
      vObjectID := DR Get ID (Area;-1;$i)
         `Get the object's ID
      ... 
         `Do something for each object here
   End for
      `Looping through selected objects
   $Count := DR Count (Area;0)
      `Count the selected objects 
   For($i;1;$Count)
         `Loop for all selected objects
      vObjectID := DR Get ID (Area;0;$i)
         `Get the object's ID
      …
         `Do something for each object here
   End for
      `Looping though objects in a group
   $Count := DR Count (Area;vGroupID)
      `Count the objects in the group 
   For($i;1;$Count)
         `Loop for all objects objects in group
      vObjectID := DR Get ID (Area;vGroupID;$i)
         `Get the object's ID
      …
         `Do something for each object here
   End for

See Also

DR Count.


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