space
Previous Page | Next Page

Managing Attributes

Assigning an Editor to an Attribute

An editor is a SAS/AF catalog entry that provides assistance when a user tries to set an attribute's value. Typically, an editor is implemented as a FRAME entry that is defined as a dialog box. You can specify an editor to assign an attribute value, which can make build-time operations easier and can decrease the chance of input error. Editors are usually reserved for broad ranges, where valid values presented in a drop-down list would not accurately or completely represent valid input. For example, instead of making users remember and correctly input numeric RGB or Hex color values, or even color names, you could assign the Color Editor (sashelp.classes.colorEditor.frame) to the attribute to simplify the selection of color values. An editor that is specified for an attribute is stored in the attribute's Editor metadata item.

To assign an editor for a component attribute using the Class Editor:

  1. Select the Attributes node, then select the attribute for which you want to assign an editor.

    Note:   If the attribute is inherited, you must first override it by selecting Override from the pop-up menu.  [cautionend]

  2. Select the Editor cell, then click the ellipsis (...) button.

  3. Specify the catalog entry that you want to use as the editor.

You can also use the Properties window to define an editor for a specific instance of a component. In the New Attributes dialog box that appears when you add an attribute in the Properties window, select the Value/CAMs tab, then click the ellipsis (...) button next to the Editor field to add an editor.

SAS/AF software provides several ready-to-use editors that you can specify to modify attribute values in components that you develop. For a complete list of supplied editors, see the SAS/AF online Help.


Creating a Custom Attribute Editor

You can create your own frame or SCL entry to use as an attribute editor. The frame or SCL entry functions just like other frames or SCL programs, except that you must include an ENTRY statement with an OPTIONAL= option before the INIT label. The ENTRY statement can include the following arguments:

objectID

is the object identifier of the current object for entries that are invoked from the Properties window. For entries that are invoked from the Class Editor, the object identifier is 0.

classID

is the object identifier of the class that is used to create the current object for entries that are invoked from the Properties window. For entries that are invoked from the Class Editor, classID is the object identifier of the class that is currently loaded and displayed.

environment

is a two-character value that contains CE for entries invoked from the Class Editor and PW for entries invoked from the Properties window.

frameID

is the object identifier of the active frame that contains the object for entries that are invoked from the Properties window. For entries that are invoked from the Class Editor, frameID is 0.

attributeName

is a character variable (char(32)) that contains the name of the selected attribute.

attributeType

is a character variable (char(83)) that contains the type of the selected attribute, which can be Character, List, Numeric, Object, or the four-level name of a specific CLASS entry.

value

is either a character or numeric variable that can contain the value of the attribute.

mode

is a character variable (char(1)) that can be set to E if the attribute is editable.

For example, in the Font Editor that is provided in SAS/AF software, the complete SCL program for the editor is:

entry optional= objectId:object  classId:object environment:char(2)
frameId:object attributeName:char(32) attributeType:char(83)  
value:char mode:char(1);

INIT:
   value=fontlist(", 'N', 1, 'Select a font.', 'N');
   if value ne ' ' then value = scan(value,1,' ');
return;

The program simply calls the SCL FONTLIST function, but by including the ENTRY statement, you can wrap that functionality inside an attribute editor.

You can specify just those arguments that you need to either process information in the editor or to return to the Class Editor or the Properties window. For example, you would include the environment parameter in the ENTRY statement if you needed to determine whether the entry was called when a user was modifying an attribute in the Class Editor or the Properties window.

space
Previous Page | Next Page | Top of Page