DR Get object type

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 object type (area; scope) Integer

ParameterTypeDescription
areaLongint4D Draw area
scopeLongint-1=All
0=Selected
>0=Object ID
Function resultIntegerType for the object(s) in area described by scope

Description

The DR Get object type command returns the object type for the object(s) in area described by scope.

An object's type is described by an integer code and cannot be changed after an object is created.

If scope equals -1, the function returns the object type for all objects in the document.

If scope equals 0, the function returns the object type for the selected objects. In both cases, if the types of the objects are not equal, DR Get object type returns -32000, and DR Error returns error number 29.

If scope exceeds 0, it must equal a specific object's ID; the function returns that object's type. If the object does not exist, DR Get object type returns -32000 and DR Error returns error number 2.

The following table lists all object codes:

CodeObject Type
1Text object
3PICT
4Bitmap
5Rectangle/Round rectangle
6Polygon/Freehand object
7Oval
8Arc
9Line
10Group

Example

The following example is the object method for a button on a form that contains area. When the object method executes, it checks to see that only rectangles are selected and then rounds their corners. If objects other than rectangles are selected, it alerts the user.

    If (DR Get object type (Area;0) = 5)
          `Are selected objects rectangles?
      DR SET CORNER ROUNDING (Area;0;0.2)
         `Set their corner rounding
   Else
         `If other types are selected 
      ALERT ("Only rectangles can be rounded!") 
         `Alert the user
   End if

See Also

DR Get ID.


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