Chapter Contents

Previous

Next
SAS/AF Software: Class Dictionary

Using the Object Class

You can use the Object class as the parent class for many of the classes that you create with SAS/AF software. The Object class contains the base information that you need to create a class and enable communication with other objects. By subclassing the Object class and combining it with the SAS Component Object Model (SCOM) architecture, you can build components using a flexible application framework that offers improved component communication.


Instance Variables

Instance variables contain data associated with an object, such as its description, the types of messages it can receive, the objects it can receive messages from, and the objects it can send messages to. The information contained in the instance variables is used by some of the Object class methods (for example, the _broadcast method) to broadcast messages between objects.

Every object can have the following instance variables.

_receivers_
contains a list of objects that receive broadcast messages from the object. When an object broadcasts a message through the _broadcast method, the message is sent to all objects in this _receivers list. Thus, this list enables an object to send messages to many other objects with one method call.

If the sending and receiving objects exist in the same frame when you build an application, you can create an object's _receivers_ list in the development environment using the Object Links window. One advantage of this is that because the objects must already exist, you know the names of the objects you want to put on or remove from the _receivers list. Therefore, you can use the object names rather than object identifiers to set up the communications link.

By contrast, if you have any objects that do not exist when the application is built but that need to send and receive messages with the _broadcast method, you can use the _addReceiver method to add these objects to a _receivers_ list. See _addReceiver in this class. To remove objects from a _receivers_ list, you can use the _deleteReceiver method described in this class.

_senders_
contains a list of the objects that can send a message to the object. In other words, _senders_ contains a list of objects from which an object can receive messages. When an object is added to another object's _receivers list through the _addReceivers method, the other object is automatically added to its _senders_ list. For example, OBJECT A is automatically added to OBJECT B's _senders list when OBJECT B is added to OBJECT A's _receivers list. If OBJECT B does not have a _senders_ list, it is created automatically. The _senders_ list is not updated when receivers are added through the Object Links window.

_receive_
contains a list of message names that identify the broadcast message strings an object can receive through a _broadcast method. For example, if you have a Text Entry object that should receive only _setColorName and _setAttr messages, you would specify these messages in the Text Entry's _receive_ list. You can add messages to the Object class' _receive_ list by editing the object's CLASS entry and selecting Receive list from the Additional Attributes list.

The _receive list acts as a filter for messages broadcast from other objects. Only messages that are the names of items in the _receive_ list are delivered. (The value of each item in the _receive_ list is ignored.) For example, if you edit the _receive_ list for a class and specify that the class should receive only messages _changed and _deleted, the _receive_ list looks like this:

_receive=(_changed=' ' _deleted=' ') 

If an object does not have a _receive_ list (that is, there is no item named _receive_), the software checks the _receive_ list of the class from which that object was created. All objects of a particular class respond to broadcast messages with the same _receive method. If the _receive_ list exists but is empty (or is not a valid list), broadcast messages are not delivered.


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.