Chapter Contents

Previous

Next
Data Form and Data Table: _setColumnAttribute

Data Form and Data Table: _setColumnAttribute



Sets an attribute for a column

Delegated to: Data Set Data Model class


Syntax
Details
Examples
Example 1: Spin box list in a cell
Example 2: Editor pushbutton in a cell
Example 3: Combo box and editor pushbutton in a cell

Syntax

CALL SEND ( object-id, '_setColumnAttribute', col-name, attr-name, attr-value);

Argument Type
Description
col-name
C specifies the name of the column in which to set the attribute
attr-name
C specifies the name of the column attribute to be set
attr-value
C | N specifies the value of the column attribute


Details

The type of the attribute value must match the type of the attribute you specify.

To specify more than one column attribute, use the _setColumnAttributes method.

Note:   You cannot change the NAME, TYPE, LENGTH, COMPUTED, or MODIFIED attributes of a column.

Also, you cannot call the _setColumnAttribute method from the INIT or TERM label sections of model SCL.  [cautionend]

Column Attribute Items
Item Type Description
'NAME' C the name of the column; must be a valid SAS name

Note that NAME cannot be changed using the _setColumnAttribute or the _setColumnAttributes method.

'DATFONT' N the identifier of an SCL list that contains the font to use when displaying the data
'LABFONT' N the identifier of an SCL list that contains the font to use when displaying the label
'REQUIRED' C 'Y' if a value is required for the column

'N' if a value is not required for a column

'PROTECTED' C 'Y' if the column is protected

'N' if the column is not protected

'HIDDEN' C 'Y' if the column is hidden

'N' if the column is visible

'MODIFIED' C 'Y' if the column has been modified

'N' if the column has not been modified.

Notes: MODIFIED cannot be changed using the _setColumnAttribute or _setColumnAttributes methods. Although using the MODIFIED attribute is convenient in some situations, such as where an OVERRIDE occurs, using a check for the MODIFIED attribute is expensive. Instead, column labels should be used to handle modified columns where possible.

'EBCOLOR' C the background color when the column is in error
'EFCOLOR' C the foreground color when the column is in error
'LBCOLOR' C the background color for the column label
'LFCOLOR' C the foreground color for the column label
'DBCOLOR' C the background color for the column data
'DFCOLOR' C the foreground color for the column data
'JUST' C the justification format for the column:

'C' (center)

'L' (left)

'R' (right)

'N' (none)

'CAPS' C the capitalization for the column:

'Y' if the column sets entered values to UPPERCASE

'N' otherwise

'INITVALUE' C|N the initial value to use for the column when adding new rows to the table; the type is the same as the data column
'MINVALUE' C|N the minimum acceptable value for the column; the type is the same as the data column
'MAXVALUE' C|N the maximum acceptable value for the column; the type is the same as the data column
'ERROR' C 'Y' if the column is in error

'N' if the column is not in error

'DISPLAYLABEL' C 'Y' if the column label is displayed

'N' if the column label is not displayed

'COLUMN_WIDTH' C the width for the column in points. If the value of COLUMN_WIDTH is 0, then column width defaults to format-length EN spaces for character columns and format-length FG spaces for numeric columns.
'COMPUTED' C 'Y' if the column is a computed column

'N' if the column is not a computed column

Note that COMPUTED cannot be changed using the _setColumnAttribute or _setColumnAttributes methods

'TYPE' C the type of the column:

'C' for character columns

'N' for numeric columns

Note that TYPE cannot be changed using the _setColumnAttribute or _setColumnAttributes methods

'LENGTH' N the data length for the column.

Note that LENGTH cannot be changed using the _setColumnAttribute or _setColumnAttributes methods

'FORMAT' C the format name for the column; it must be appropriate for the column type
'INFORMAT' C the informat name for the column; it must be appropriate for the column type
'LABEL' C the label for the column; must be 255 or fewer characters
'DATACLASS' C the host control for a column:

COMBOBOX or SPINBOX; default is TEXTFIELD

If no host control is desired, set to NONE.

'DATAATTRIBUTES' L the named list of attributes that define the control specified in DATACLASS.

The attributes are:



'ITEMS' specifies a list of valid values for a column. This list will populate the COMBOBOX or SPINBOX host controls.


'READONLY' specifies if a cell value is editable via the input field part of the host control. For comboboxes and spinboxes, if 'READONLY' is set to 'Y', then the cell can only be edited via the control part of the host control (such as selecting from the drop-down list for the combobox). If no 'dataclass' is specified and the default is being used for editing, then setting 'READONLY' to 'Y' will protect that cell.


'TEXTCOMPLETION' specifies if text matching should occur as text is entered. Valid values are 'Y' | 'N' (default is 'Y'). This is used for comboboxes and spinboxes only.


'HONORCASE' specifies whether or not text completion (if active) is case sensitive. Valid values are 'Y' | 'N' (default is 'N'). This is used for comboboxes and spinboxes only.
'EDITOR' C the four-level name of the catalog entry that is opened as an editor when the ellipsis (...) button is selected in the cell. Valid only when using a data table.
'EDITORATTRIBUTES' L the list of items sent to the editor. By default, the table passes the cell contents to the editor as the 'VALUE' list entry item. Valid only when using a data table.

If you wish to use a different entry item than the cell contents, specify a named item 'VALUE' on the editorAttributes list, and populate it with the desired values.

'DSPROTECTED' C 'Y' if the variable is derived via SQL

'N' if the variable is not derived from SQL



Examples

The following three examples illustrate how to place host controls in an active cell. All three examples assume you have created a FRAME that contains a datatable object called TABLE.

Example 1: Spin box list in a cell

This example creates a spin list with items 'one', 'two', 'three', 'four', and 'five' available on the spin list. It also protects the input field.

list = makelist();
rc = insertc(list, 'ONE', -1);
rc = insertc(list, 'TWO', -1);
rc = insertc(list, 'THREE', -1);
rc = insertc(list, 'FOUR', -1);
rc = insertc(list, 'FIVE', -1);
spinlist = makelist();
rc = insertl(spinlist, list, -1, 'ITEMS');
rc = insertc(spinlist, 'Y', -1, 'READONLY');
call notify(object-id, '_setColumnAttribute', column-name,
             'dataClass', 'SPINBOX');
call notify(object-id, '_setColumnAttribute', column-name,
             'dataAttributes', spinlist);

Example 2: Editor pushbutton in a cell

This example creates an editor pushbutton that will bring up 'SASUSER.EXAMPLE.EXAMPLE.FRAME' when it is selected.

call notify(object-id, '_setColumnAttribute', column-name,'editor',
            'SASUSER.EXAMPLE.EXAMPLE.FRAME');

Example 3: Combo box and editor pushbutton in a cell

This example creates both a combo box and an editor pushbutton. The combo box has the items 'red', 'green', 'blue', 'gray', 'white', and 'black' available on the drop-down list. The editor pushbutton will bring up 'SASUSER.EXAMPLE.CLRSELECT.FRAME' when it is selected. Text completion is on and is case sensitive.

list = makelist();
rc = insertc(list, 'RED', -1);
rc = insertc(list, 'GREEN', -1);
rc = insertc(list, 'BLUE', -1);
rc = insertc(list, 'GRAY', -1);
rc = insertc(list, 'WHITE', -1);
rc = insertc(list, 'BLACK', -1);
boxlist = makelist();
rc = insertl(boxlist, list, -1, 'ITEMS');
rc = insertc(boxlist, 'Y', -1, 'HONORCASE');
call notify(object-id, '_setColumnAttribute', column-name,
             'dataClass', 'COMBOBOX');
call notify(object-id, '_setColumnAttribute', column-name,
             'dataAttributes', boxlist);
call notify(object-id, '_setColumnAttribute', column-name,
             'editor', 'SASUSER.EXAMPLE.CLRSELECT.FRAME');


Chapter Contents

Previous

Next

Top of Page

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