Chapter Contents

Previous

Next
FLDATTR

FLDATTR



Changes the color and display attributes of a field, text entry widget, or text label widget to those stored in an attribute string

Category: Widget or Field


Syntax
Details
Example
See Also

Syntax

rc=FLDATTR(wcol-name,string);

rc
contains the return code for the operation:
0 successful
[ne]0 not successful

Type: Numeric

wcol-name
specifies the field, text entry widget, or text label widget to be changed.

Type: Character

string
specifies the color and display attributes to apply and the starting and ending character positions within the field.

Type: Character


Details

You can use STRATTR or FILLIST to generate the attribute string. You can also generate the attribute string by assigning hexadecimal values directly to the string.

Color attributes are represented as

Color Value Color Value
BLUE '10'x WHITE '70'x
RED '20'x ORANGE '80'x
PINK '30'x BLACK '90'x
GREEN '40'x MAGENTA 'A0'x
CYAN '50'x GRAY 'B0'x
YELLOW '60'x BROWN 'C0'x

Display attributes are represented as

Attribute Value
NONE '00'x
HIGHLIGHT '01'x
UNDERLINE '02'x
BLINK '04'x
REVERSE '08'x

To preserve a color, use the special hexadecimal value 'F0'x. To preserve a display attribute, use '0F'x. To preserve both the color and display attribute, add the two special characters together ('FF'x).

For programs with extended tables you must call this function in the getrow section of your SCL program.

FRAME entry widgets can also use the _setColorStr method.


Example

Change the first half of the field, ABC, to red reverse.

str=strattr('red','reverse',1,mlength(abc)/2);
rc=fldattr('abc',str);

Suppose the FRAME text entry widget, OBJ1, is BLUE REVERSE. To change the third through the seventh character positions of OBJ1 to yellow, you must initialize the first two characters of the attribute string to 'FF'x, then assign YELLOW in the third through seventh characters. You can assign YELLOW to the attribute string either by using STRATTR or by assigning the hexadecimal values directly to the string.

st ='FFFF6060606060'x;
rc=fldattr('obj1',str);

The previous example could have been written as follows:

str='FFFF'x;
str=strattr('yellow','',3,5);
rc=fldattr('obj1',str);

You can also use the REPEAT function to initialize a string.

str=repeat('FF'x,2 );
str=strattr('yellow','',3,5);
rc=fldattr('obj1',str);

See Also

FLDCOLOR

STRATTR


Chapter Contents

Previous

Next

Top of Page

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