Chapter Contents


SAS/AF Software: Class Dictionary

Using the Text Entry Class

SCL programs are easier to maintain if you do not code numbers for colors or display attributes in the programs. If color or display attribute numbers were to change, your programs could produce unexpected results.

To make your programs easier to maintain, you can create a field, assign it the appropriate validation type COLOR or ATTR, and assign the appropriate value to the field. This technique enables you to use the name of this text object for the argument that specifies the appropriate parameter number. The objects to which you send color or display attribute changes will always display correctly, regardless of the internal number.

For example, if you know that the number assigned to the color red is 2, you can use the following statement to display the field TEXT1 in red:

   call notify('text1','_set_color_num_',2);

However, if the internal numbers assigned to colors were to change, the next time you ran your SCL program the text would display in whatever color was assigned the number 2.

Alternatively, you can construct a statement that generates an error message and halts the program if the number 2 was no longer assigned to a color. Better still, if you create a field with the validation type COLOR and the value red, as shown in the next example with COLORNUM, you can use the following statement and know that the correct color will be assigned, regardless of color number assignments:

   call notify ('text1','_set_color_num_',

Another way to do this is to use the supplied color or display attributes lists (stored in SASHELP.FSP.COLORS.SLIST and SASHELP.FSP.ATTRS.SLIST). The following example prints the lists and gets the numbers associated with the color red and the attribute reverse and applies them to the text entry object, OBJ2:

   colors=makelist();  /* create list */

              colors); /* fill it */

   call putlist(colors,'colors',1);
               /* print it */
   call putlist(attrs,'colors',1);

                      /* get info */

   call notify ('obj2','_set_color_num_',
               /* apply it */

Chapter Contents



Top of Page

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