4. System Classes : Object Class
 
Share this page                  
Object Class
Note:  The Object class is used for classification only.
The Object class provides methods that you can use on any object in the system. All objects in the system are subclasses of the Object class.
The SetAttribute and GetAttribute methods are useful in generic applications because they enable you to reference attributes that cannot be defined for the class of the specific object for which you are calling the method. For example, you might want to set an attribute for all selected objects and do not want to check whether the attributes are appropriate for a specific object in the selected group. If the attribute does not exist, the SetAttribute or GetAttribute method is ignored. The return status indicates if any one of the attributes referenced in the parameters is not valid for the object. The following example illustrates these methods:
/* Declarations */
sbar = ScrollbarField;
tmpsize = integer;
tmpcolor = integer;
rval = integer;

sbar = field(field_on_form);

sbar.BgColor = CC_BLUE;
sbar.ElevatorSize = 10;
/* The above 2 lines could be expressed as:*/
rval = sbar.SetAttribute(bgcolor = CC_BLUE,
elevatorsize = 10);
if(rval != ER_OK) then
msg = 'either bgcolor or elevatorsize'
       + ' is not an attribute';
endif;
Some of the system classes contain attributes of type Object that you can use in generic ways. When you do so, you must cast the generic object to the correct specific class. For example, assume that Frame A declares a reference variable, poobject, of type PurchOrder and that you want to pass an object of type PurchOrder from Frame B to Frame A. To do so, in Frame B, you would use the SendUserEvent method and the messageobject parameter, which passes a generic object to the receiving frame, placing the object in the MessageObject attribute of the receiving frame.
However, to assign the object in the MessageObject attribute to the variable, poobject, you must cast the reference to the generic object to the PurchOrder class:
poobject = PurchOrder(CurFrame.MessageObject);
For more information about casting, see the Programming Guide.
Inherits From
None
Inherited By
All
Attributes
ClassName
ClientData
InstanceIdentifier
InstanceReferences
Methods
Duplicate
GetAttribute
IsA
SetAttribute