version 6.0
DR Get object type (area; scope) Integer
| Parameter | Type | Description | |
| area | Longint | 4D Draw area | |
| scope | Longint | -1=All | |
| 0=Selected | |||
| >0=Object ID | |||
| Function result | Integer | Type 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:
| Code | Object Type |
| 1 | Text object |
| 3 | PICT |
| 4 | Bitmap |
| 5 | Rectangle/Round rectangle |
| 6 | Polygon/Freehand object |
| 7 | Oval |
| 8 | Arc |
| 9 | Line |
| 10 | Group |
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