Previous Page | Next Page

Customizing the SAS Windowing Environment

Customizing Key Definitions under OpenVMS


Introduction to Defining Keys

You can define most of the keys on your keyboard. However, a few keys have dedicated functions that are associated with them. For example, the mouse buttons are dedicated to the cursor and cut-and-paste operations and are not available for user customization. For more information, see Default Keyboard Actions.


Methods for Customizing Key Definitions

You can customize your key definitions by using one of the following methods:


Defining Key Translations


What Is a Key Translation?

To customize a key for the X Window System, you define a key sequence and specify an action to be executed when that key sequence is typed on the keyboard. This is known as binding keys to actions; together, they are referred to as a translation.


What Is the SAS.keyboardTranslations Resource?

The SAS.keyboardTranslations resource specifies the set of key bindings that SAS uses in all SAS windows. The default value for the SAS.keyboardTranslations resource is determined at run time based on the vendor identification string reported by the X server that you are using as the display. These default settings are listed in the SAS$ROOT:[MISC.BASE]SASXDEFAULTS.DAT file. To modify the default bindings supplied by SAS, you must modify the SAS.keyboardTranslations resource.

Note:   The X Toolkit Intrinsics translations specified in this resource apply to both the user area and the command line of all SAS windows that are affected by this resource. This resource does not affect windows that are controlled by Motif interface resources, such as the Command window, the Open or Import dialog boxes, and some other menu dialog boxes.  [cautionend]


Steps for Creating a Key Definition

To create a key definition, follow these steps:

  1. Determine the keysyms for the keys that you want to define. Keysyms are the symbols recognized by the X Window System for each key on a keyboard.

  2. Modify/add the keyboardTranslations resource in your resource file to include the definitions of the keys that you want to define. Use a keyboard action routine to define which action you want the key to perform. The definition in the right column in the KEYS window will no longer control the function of any keys that are defined with a keyboard action routine other than sas-function-key() .

  3. Modify/add the SAS.keysWindowLabels resource in your resource file. The SAS.keysWindowLabels resource specifies the set of valid labels that will appear in the KEYS window. Modify this resource only if you want to add new labels or modify existing labels in the left column in the KEYS window.

    The SAS.keysWindowLabels resource defines only the mnemonics used in the KEYS window. For a specific key to perform an action, you must specify a SAS.keyboardTranslations definition for the key.

  4. Start a SAS session and open the KEYS window.

  5. Type a command name or other description of each key that you have defined in the right column in the KEYS window.


SAS Keyboard Action Names

SAS declares a set of keyboard actions during X initialization. You can think of these keyboard actions as simple functions. When the actions are executed, they act on the window that currently has keyboard input focus.

Keyboard action names represent X Toolkit action routines that are registered by the SAS interface to Motif for use with X Toolkit keyboard-event translations. A set of default keyboard actions is supplied as part of the interface. You can override and augment these actions by supplying a suitably formatted X Toolkit translation string in the SAS.keyboardTranslations resource.

Note:   Most SAS documentation uses angle brackets (<>) to indicate optional syntax. However, in this topic, optional syntax is shown with square brackets ([ ]). The angle brackets that are shown are part of the syntax and should be entered exactly as shown.  [cautionend]

The following list of keyboard actions represents action routines registered by the Motif interface for use with X Toolkit keyboard-event translations:

sas-cursor-down()

moves the cursor down one line in a SAS window. The cursor does not wrap when it reaches the bottom of the SAS window interior.

sas-cursor-left()

moves the cursor left one character in a SAS window. The cursor does not wrap when it reaches the left side of the SAS window interior.

sas-cursor-right()

moves the cursor right one character in a SAS window. The cursor does not wrap when it reaches the right side of the SAS window interior.

sas-cursor-up()

moves the cursor up one line in a SAS window. The cursor does not wrap when it reaches the top of the SAS window interior.

sas-delete()

deletes all text in the current field.

sas-delete-begin()

deletes all text from the current cursor position to the beginning of the current text field.

sas-delete-char()

deletes the character under the text cursor and leaves the cursor in place.

sas-delete-end()

deletes text from the current cursor position to the end of the current text field.

sas-delete-prev-char()

deletes the character to the left of the text cursor and moves the cursor back one space.

sas-delete-prev-word()

deletes text from the current cursor position to the start of the previous word. If the cursor is in the interior of a word when the action is invoked, the text from the cursor position to the beginning of the word is deleted.

sas-delete-word()

deletes text from the current cursor position to the end of the current or next word.

sas-do-command()

accepts one or more text-string parameters that are interpreted as SAS commands to be executed when the action is invoked. The action can be invoked with multiple parameters, separated by commas. The parameters are concatenated, with semicolon delimiters that are supplied by the sas-do-command() action. The assembled SAS command string is then submitted for execution. For example, the following translation can be used to define a global HOME, SUBMIT key sequence for all SAS windowing environment windows:

SAS.keyboardTranslations: <Key>KP_F3: 
_sas-do-command(HOME,SUBMIT)
sas-function-key("InternalKeyName")

invokes the SAS commands associated with the function key identified by the InternalKeyName label. InternalKeyName is the character string (one to eight characters long) that is passed to the SAS.keysWindowLabel resource. You must enclose InternalKeyName in double quotation marks. For a description of internal key names, see Defining Key Translations. For a list of function-key parameters that SAS recognizes, see the sample SASXDEFAULTS.DAT file.

For example, the following keyboard translation designates the physical key KP_1 as a function key and associates the "Keypd 1" parameter with KP_1. SAS recognizes the "Keypd 1" parameter as being associated with the command LEFT (that is, scroll left) by default. Thus, it assigns the LEFT command to KP_1.

SAS.keyboardTranslations: ~Ctrl<Key>KP_1: 
_sas-function-key("Keypd 1")

If you specify a function-key parameter that SAS does not recognize, the function-key command is initially left unspecified.

sas-home-cursor()

is the equivalent of the HOME command. This action is provided for convenience so that the HOME action can be defined globally.

sas-insert-char(["InsertionString"])

inserts or overwrites the character typed into the input field under the text cursor. Insert or overstrike behavior is determined by the sas-toggle-insert() action, which has a mode that is reflected by the text cursor style displayed: the block cursor indicates overstrike mode, and the underline cursor indicates insert mode. Normally, sas-insert-char translates the XKeyEvent into the appropriate character and inserts it at the SAS text cursor location. If you specify the parameter, the text string represented by this parameter is inserted at the SAS text cursor location. Any spaces in the string are interpreted by the X Toolkit as a parameter delimiter unless you enclose the string in double quotation marks. For information about embedding quotation marks in the string parameter, see your X Window System documentation. To include an escaped quotation mark, use the following syntax:

Shift<Key>KP_1:\
   sas-insert-char("One\\"1\\" ")
This produces the text string One"1" at the SAS text cursor location.
sas-kp-application()

sets the workstation's numeric keypad to allow function key translations to be reinstated. This toggle only works for those keypad keys that are bound to sas-function-key() actions. Keypad bindings to other actions are not affected by this translation.

sas-kp-numeric()

sets the workstation's keypad to generate numeric characters instead of its previous function-key assignment. Note that this toggle only works for keypad keys that are bound to sas-function-key() actions. Keypad bindings to other actions are not affected by this translation.

sas-move-begin()

moves the cursor to the beginning of the current text field.

sas-move-end()

moves the cursor to the end of the current text field.

sas-new-line()

generates an end-of-line event when invoked. This is a context-sensitive action. If you are typing in the SAS command line, the text that you enter is submitted for execution. If you invoke the sas-new-line action in the SAS application client area, then the action depends on the attributes of the text area that is under the cursor. In simplest terms, this action is the general line terminator for an input field.

sas-next-field()

advances the cursor to the next field in the SAS window client area.

sas-next-word()

moves the cursor forward to the beginning of the next word in the current text field. Wrapping is supported; that is, if the sas-next-word() action does not find the beginning of a word in the current text field, it advances to the next SAS application field. However, if you are typing in the SAS command line area of the window, the cursor will not wrap into the SAS window client area.

sas-page-down()

scrolls the current window contents forward by one page.

sas-page-end()

moves the text cursor to the end of the current page.

sas-page-top()

moves the text cursor to the top of the current page.

sas-page-up()

scrolls the current window contents backward by one page.

sas-prev-field()

returns the cursor to the previous field in the SAS window client area.

sas-prev-word()

moves the cursor backward to the start of the next word in the current text field. Wrapping is supported; that is, if the sas-prev-word() action does not find the beginning of a word in the current text field, then it returns to the end of the previous SAS application field. However, if you are typing in the SAS command line area of the window, the cursor does not wrap into the SAS window client area.

sas-to-bottom()

moves the text cursor to the absolute bottom of the window's text range.

sas-to-top()

moves the text cursor to the absolute top of the window's text range.

sas-toggle-insert()

toggles the line-editing behavior of the associated window between insert and overstrike modes. This action applies only to the SAS command line and to the SAS window client area. The current mode is indicated by the style of the cursor:

block cursor

indicates overstrike mode.

underline cursor

indicates insert mode.

sas-xattr-key(<KeyType>[,<KeyParam>])

defines the extended attributes that are associated with extended-attribute keys. This action accepts two text-string parameters.

Note:   Most SAS documentation uses angle brackets (< >) to indicate optional syntax. However, in this topic optional syntax is shown with square brackets ([ ]). The angle brackets that are shown are part of the syntax and should be entered exactly as shown.  [cautionend]

The <KeyType> parameter must be one of the following:

XAATTR

sets a display attribute. If XAATTR is specified, then the second parameter must be one of the following:

HIGHLIGHT

turns on bold.

UNDERLINE

turns on underlining.

REVERSE

turns on reverse video.

BLINK

turns on blinking.

Note:   The BLINK attribute is not supported in the Motif interface. However, if you specify the BLINK attribute, it will be displayed when the catalog is ported to other operating environments.  [cautionend]

XACLEAR

clears all attributes. If XACLEAR is specified, then you must specify NULL as the second parameter.

XACOLOR

sets a color attribute. If XACOLOR is specified, then the second parameter must be one of the following:

BLACK

sets the text color to black.

BLUE

sets the text color to blue.

BROWN

sets the text color to brown.

CYAN

sets the text color to cyan.

GRAY

sets the text color to gray.

GREEN

sets the text color to green.

MAGENTA

sets the text color to magenta.

ORANGE

sets the text color to orange.

PINK

sets the text color to pink.

RED

sets the text color to red.

WHITE

sets the text color to white.

YELLOW

sets the text color to yellow.

For example, the following resource definition defines the CTRL+B key sequence to set the extended attribute for the color BLACK:

sas.keyboardTranslations:#override \ 
    Ctrl<Key>b:sas-xattr-key(XACOLOR,BLACK)

Default Keyboard Actions

Some keyboard-action routines are assigned to certain keys by default. The following table shows the default keyboard actions, which are defined by the SAS.keyboardTranslations resource. For more information about this resource, see Defining Key Translations and your Motif documentation.

Note:   Most SAS documentation uses angle brackets (< >) to indicate optional syntax. However, in this topic the angle brackets that are shown are part of the syntax and should be entered exactly as shown.  [cautionend]

Default Key Actions
Key Name Keyboard-Action Routine
<Key>Home sas-home-cursor()
<Key>osfUp sas-cursor-up()
<Key>osfDown sas-cursor-down()
<Key>osfRight sas-cursor-right()
<Key>osfLeft sas-cursor-left()
<Key>Return sas-new-line()
Shift<Key>Tab sas-prev-field()
<Key>Tab sas-next-field()
<Key>osfBackSpace sas-delete-prev-char()
<Key>osfDelete sas-delete-prev-char()
<Key> sas-insert-char()
Shift<Key> sas-insert-char()


Extended-Attribute Key Resources

The SAS interface to Motif supports the use of attributes such as bold, reverse video, and underline. You can use the SAS.keyboardTranslations resource to control this feature.

The following table summarizes the functions that are provided through SAS extended-attribute keys.

Note:   Most SAS documentation uses angle brackets (< >) to indicate optional syntax. However, in this topic the angle brackets that are shown are part of the syntax and should be entered exactly as shown.  [cautionend]

Functions Provided through the SAS Software Extended-Attribute Keys
Keyboard Chord Character Attribute Selected
Mod1<Key>b Blue
Mod1<Key>r Red
Mod1<Key>p Pink
Mod1<Key>g Green
Mod1<Key>c Cyan
Mod1<Key>y Yellow
Mod1<Key>w White
Mod1<Key>m Magenta
Mod1<Key>o Orange
Mod1<Key>k Black
Mod1<Key>n Brown
Mod1<Key>a Gray
Mod1<Key>0 Clear extended attributes
Mod1<Key>1 Set HIGHLIGHT (bolding) attribute
Mod1<Key>2 Set UNDERLINE attribute
Mod1<Key>3 Set REVERSE video attribute

Previous Page | Next Page | Top of Page