Customizing the SAS Windowing Environment |
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:
Through the KEYS window. To open the KEYS window, do one of the following:
If you change any key definitions through the KEYS window for the SAS windowing environment windows, the definitions are stored in the SASUSER.PROFILE catalog in the entry DMKEYS.KEYS. Key definitions for other SAS windows are stored in catalog entries named BUILD.KEYS, FSEDIT.KEYS, and so on.For more information about the KEYS command and the KEYS window, see the Base SAS section in the online SAS Help and Documentation.
With the KEYDEF command. The KEYDEF command enables you to redefine individual function keys:
keydef keyname <command | ~text-string>
For example, if you specify keydef F8 dlgpref , then the F8 key will issue the DLGPREF command that opens the Preferences dialog box.
For more information about the KEYDEF command, see the Base SAS section in the online SAS Help and Documentation.
By defining the SAS.keyboardTranslations and SAS.keysWindowLabels resources in your resources file as described in Defining Key Translations.
Defining Key Translations |
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.
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.
To create a key definition, follow these steps:
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.
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() .
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.
Type a command name or other description of each key that you have defined in the right column in the KEYS window.
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.
The following list of keyboard actions represents action routines registered by the Motif interface for use with X Toolkit keyboard-event translations:
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.
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.
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.
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.
deletes all text from the current cursor position to the beginning of the current text field.
deletes the character under the text cursor and leaves the cursor in place.
deletes text from the current cursor position to the end of the current text field.
deletes the character to the left of the text cursor and moves the cursor back one space.
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.
deletes text from the current cursor position to the end of the current or next word.
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)
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.
is the equivalent of the HOME command. This action is provided for convenience so that the HOME action can be defined globally.
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.
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.
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.
moves the cursor to the beginning of the current text field.
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.
advances the cursor to the next field in the SAS window client area.
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.
returns the cursor to the previous field in the SAS window client area.
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.
moves the text cursor to the absolute bottom of the window's text range.
moves the text cursor to the absolute top of the window's text range.
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:
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.
The <KeyType> parameter must be one of the following:
sets a display attribute. If XAATTR is specified, then the second parameter must be one of the following:
clears all attributes. If XACLEAR is specified, then you must specify NULL as the second parameter.
sets a color attribute. If XACOLOR is specified, then the second parameter must be one of the following:
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)
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.
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() |
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.
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 |
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.