SCL provides dot notation for direct access to component properties. Dot notation
is intended to save time, improve code readability, and
reduce the amount of coding necessary. It also improves the performance of your applications
by providing additional compile-time validation. For example, you can use it to check
the method's argument type. You can also use it to execute methods and to access component
attributes without
having to use SEND or NOTIFY routines.
You can use dot notation
in any of the following forms:
object.method(<arguments>);
return-value=object.method(<arguments>);
object.attribute=value;
value=object.attribute;
if (object.method(<arguments>)) then ...
if (object.attribute) then ...
where
object
specifies an object or an automatic system variable (such as _CFRAME_, _FRAME_, or
_SELF_) whose type is object.
method
specifies the name of the method to execute.
arguments
specifies one or more arguments based on the appropriate method
signature.
return value
specifies the value returned by a method (if any).
attribute
specifies an attribute that exists on object.
value
specifies a value assigned to or queried from the attribute.
Dot notation can be used to set or query attributes. For example, suppose object1
is a text entry control:
/*Setting the text color */
object1.textColor='yellow';
/* Querying the text color. */
/* object1's textColor attribute is returned */
/* to the local SCL variable 'color' */
color = object1.textColor;
Dot notation also is
used to call methods. For example,
object._cursor();
is equivalent to
call send(object, '_cursor');
For compatibility with legacy programs, you can continue to use CALL
SEND and CALL NOTIFY to invoke methods.
You can use dot notation to call methods on objects in several ways, provided the
method contains the appropriate signature information. For example,
/* With a return variable */
cost=object1.getPrice(itemnum);
/* Without a return variable */
object1.getPrice(itemnum, cost);
/* In an IF statement */
if object1.getPrice(itemnum) > 100 then
do...
Note: Objects that are created
on a frame and automatic system variables (such as _FRAME_ ) are automatically declared
as objects. You can refer to these objects
in dot notation without having to declare them in your SCL programs.
To use dot notation with legacy objects that you add to a frame, you
must first select “Use object name as ID in SCL” for
those objects in the Properties window.
For more information
about dot notation, refer to the SAS Component Language:
Reference and the SAS/AF online Help.