Name_object Command
Obsolete
This command is obsolete. This command is valid only in character-mode DataFlex. There is no Windows equivalent for this option.
Purpose
To allow objects and their items and properties to be referred to in get, set, and send commands and in expressions by simple names rather than by access method. Use of this command can impair the integrity of your application's object structure. Its use is not recommended.
Syntax
name_object
symbolicName ;
[
global | child
parentObjectName | access_method
] ;
[
column
columnName ... columnName
] ;
[[[
item
] #] itemName ... itemName] ;
[
property
propertyName ... propertyName
] ;
[[[
item
] #] itemName ... itemName] ;
[
property
propertyName ... propertyName
]
Argument Explanation
-
symbolicName
Symbolic name for the object. The name created will have the formsymbolicName.obj. The symbolic names of objects must be unique throughout the program, while the names of items need to be unique only within any one object. WhensymbolicNameis different from the actual object name, the symbolic name must be initialized at the top of the object's creation block asmove current_object to symbolic_name.obj. -
global | child parentObjectName | access_method
If none of these terms is used, only items, columns, and/or properties will be named. No object will be named. -
global
DefinessymbolicNameas a global object.name_object globalis normally used prior to all procedures, objects, and classes which use or define the object (at the front of the program). If there are no earlier references to the object, you may name a global object at the beginning of its definition. -
child parentObjectName
DefinessymbolicNameas a child object ofparentObjectName. Registers the object (if not already registered). -
access_method
An expression for the access method of the object. Creates asymbolicName.objsymbol. This term may becurrent_object.current_objectis sometimes used inside a class definition to make all access to the object relative. -
item itemName ... itemName
Creates names for items in the formsymbolicName.itemName. Items are named starting at Item 0 unless an item number (#) is specified. Specified item numbers must be integer constants. There may be as many item clauses in a singlename_objectcommand as desired, intermingled, if desired, with property clauses. May be used to name items absolutely across, and then down, the rows of a grid-based object.ItemNamemust begin with a letter. If it is a number, it will be taken as a new starting item number (#). -
column itemName ... itemName
Column is used the same way as item, except that theitemNamesrefer to the first, second, and so on items in the current row in a grid-based object, rather than to absolute items. This amounts to a "column" name. If the keywordcolumnis omitted for a grid-based object,itemwill be inferred, and all references will be to absolute items starting with the first item on the first row. Starting item number (#) may not be used with column. There may be only one column clause in a singlename_objectcommand. -
property propertyName ... propertyName
Creates names for properties in the formsymbolicName.propertyName. This may also be used to name child objects, since they amount to properties of the object. There may be as many property clauses in a singlename_objectcommand as desired, intermingled, if desired, with item clauses.PropertyNamemust match the name of the property as given in its property command, or the name of the child object as given in its object command.
What It Does
name_object may be used to forward-reference objects and item names. The name_object command must precede the first reference in the program to the named object or any of the named items, properties, or child objects. Otherwise, the typical location for a name_object command is at the top of an object's object-creation block.
The .obj extension is required when symbolicName is used in expressions. It may be omitted in get, set, and send commands. Object and item symbolicNames can only be used inside appropriate get, set, and send commands or inside expression functions. Use of item symbolicNames in other places will usually generate an error which lists "ITEM" as an illegal parameter.
Examples
name_object myObject (anObject(desktop))
In this example, myObject.obj becomes the name for global Object anObject. The command move current_object to myObject.obj must be present at the top of the creation block of anObject.
name_object myObject item x y z
In this example, myObject.x becomes the name for Item 0 of Object myObject, myObject.y becomes the name for Item 1, and myObject.z for Item 2.
name_object myObject column a b c
In this example, myObject.a becomes the name for (base_item(myObject.obj)), myObject.b becomes the name for (base_item(myObject.obj) + 1), and myObject.c for (base_item(myObject.obj) + 2).
name_object myObject property myButton
In this example, myObject.myButton becomes the name for (myButton(myObject.obj)).
name_object myObject (anObject(current_object)) x y z
In this example, myObject.obj becomes the name for the current child object of Object anObject, myObject.x becomes the name for Item 0 of that object, myObject.y becomes the name for Item 1, and myObject.z becomes the name for Item 2.
name_object myObject child anObject x y z
In this example, myObject is registered, myObject.obj becomes the name for (myObject(anObject.obj)), myObject.x becomes the name for Item 0 of Object myObject, myObject.y becomes the name for Item 1, and myObject.z becomes the name for Item 2.
name_object myObject item 2 i3 i4 i5 item 9 fred property myButton
In this example, myObject.i3 becomes the name for the third item (#2) of global Object myObject, myObject.i4 becomes the name for the fourth item, myObject.i5 the name for the fifth object, fred becomes the name for the tenth item (#9), and myObject.myButton becomes the name for (myButton(myObject.obj)).
name_object myObject global item 2 i3 i4 i5 item 9 fred property myButton
In this example, a global integer value for Object myObject is created, myObject.i3 becomes the name for the third item (#2) of global Object myObject, myObject.i4 becomes the name for the fourth item, myObject.i5 the name for the fifth object, fred becomes the name for the tenth item (#9), and myObject.myButton becomes the name for (myButton(myObject.obj)).
Examples of Using Named Objects and Items
get value of myObject.x to i
In this example, the value of the item of Object myObject named x is moved to Variable i.
set value of myObject.y to i
In this example, the value of the item of Object myObject named y is set to the value of Variable i.
set focus_mode of myObject.obj to focusable
In this example, the focus_mode of Object myObject is set to focusable.
showln (value(myObject.x))
In this example, the value of the item of Object myObject named x is displayed to the screen.
showln (parent(myObject.obj))
In this example, the object_id of the parent object of Object myObject is displayed to the screen.
Where more properties and/or child objects are to be named in an object than can be named in the 250-character capacity of a single name_object command, additional name_object commands may be used for the additional properties and/or child objects. If the command line capacity is insufficient for the naming of all items that you wish to name, use the name_item command.