version 6.0
DR Get name (area; scope) String
| Parameter | Type | Description | |
| area | Longint | 4D Draw area | |
| scope | Longint | -2=Default | |
| -1=All | |||
| 0=Selected | |||
| >0=Group ID | |||
| Function result | String | Name of the objects in area |
Description
The command DR Get name returns the name of the objects in area described by scope. A name is a string associated with an object and is not necessarily unique. Names have a maximum length of 31 characters. Users can set names using the Object Attribute dialog box or using the DR SET NAME command in a method.
If scope equals -2, the function returns the default name. The default name is usually an empty string and can only be set procedurally.
If scope equals -1, the function returns the name for all objects in the document. If the names of the objects are not equal, DR Get name returns "*****" and DR Error returns error number 29.
If scope equals 0, the function returns the name for the selected objects. If the names of the objects are not equal, DR Get name returns "*****" and DR Error returns error number 29.
If scope is greater than 0, it must be equal to a specific object's ID; the function returns that object's name. If the object does not exist, DR Get name returns an empty string and DR Error returns error number 2.
The codes for the scope parameter are given in the paragraph "Specifying the Scope of a Command" of the Manipulating Objects section.
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 at least one object is selected; if so, it puts the names of the objects into the $Name variable. It then tests to see if the names are all the same and displays an appropriate alert.
If (DR Count (Area;0) > 0)
`If at least one object is selected
$Name := DR Get name (Area;0)
`Get the name(s)
If (29 = DR Error)
`Check if they were the same
ALERT ("These objects don't have the same name!")
`If not tell the user
Else
`If they are the same
ALERT ("These objects are named "+$Name)
`Tell the user the name
End if
End if
See Also