Chapter Contents |
Previous |
Next |
SAS Companion for UNIX Environments |
There are four ways to customize your key definitions:
keys
command
or select
Tools | Options | Keys |
Refer to the online help for more information on the
keys
command and the KEYS window.
keydef keyname <command|~text-string>
For example, if you specify
keydef F8 dlgpref
, then the F8 key will open the Preferences dialog
box.
Refer to the online help for more information about the KEYDEF command.
In most cases, Resource Helper is much easier and faster
than defining the resources yourself. However, because the X Window System
searches for resources in several places, it is possible for Resource Helper
to pick up the wrong key symbol for the key you are trying to define. Also,
unless the action routine that you assign to your keys is the
sas-function-key
routine, then Resource Helper
does not provide a way to change the key labels in the KEYS window. In both
of these cases, you will need to define your key resources yourself.
SAS.keyboardTranslations
and
SAS.keysWindowLabels
resources in your resources file as described
in Defining Key Translations.
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.
Defining Key Translations |
The
SAS.keyboardTranslations
resource specifies the set of key bindings that the SAS System 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 defaults are listed in the files contained in
!sasroot/X11/resource_files
.
To modify the default bindings supplied by the SAS System, you must modify
the 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 pull-down menu dialog
boxes.
To create a key definition, follow these steps:
SAS.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
. The definitions
of those keys in the KEYS window become labels that have no effect. See Modifying the SAS.keyboardTranslations Resource for more
information.
SAS.keysWindowLabels
resource in your resource file. The
SAS.keysWindowLabels
resource specifies the set
of valid labels that will appear in the SAS 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.
See Modifying the keysWindowLabels Resource
for more information.
You can use the
xev
utility to determine the
keysyms associated with the keys on your keyboard.
xev
is distributed with most UNIX operating systems, but if
xev
is not installed on your operating system,
contact the Technical Support Department at SAS Institute for assistance.
xev
prints a message for each X event that occurs. The
KeyPress
event specifies the keysym for each key that is pressed.
xev
on the X server for which you want to define keys. The
xev
client displays a small Event Tester window
that lists the X events that occur. (The
xev
client generates a large amount of output, so you may want to save
the output to a file for later review. You can issue the UNIX
script
command to save the output to a file.)
KeyPress
event to be listed. The listing has a number
of items that are separated by commas. One of the fields in the
KeyPress
event lists the keysym name that is associated with the key that was
pressed.
For example, when the 0 key on the keypad of an HP 9000/700 keyboard is pressed, it generates the following output:
KeyPress event, serial 14, synthetic NO, window 0x4400001,root 0x23, subw 0x4400002, time 507920400, (54,37),root:(67,66), state 0x0, keycode 30 (keysym 0xffb0, KP_0), same_screen YES, XLookupString gives 1 characters: "0"In this example, the keysym name is
KP_0
.
Note:
SAS defines a set of virtual keysyms with
the
SAS.defaultVirtualBindings
resource. Virtual keysyms all begin with osf, such as osfPageDown,
osfClear, and osfPrimaryPaste. If you remap these virtual bindings instead
of using the defaults supplied by SAS, you might get unexpected results. If
you specify a key translation that does not work, you might be trying to redefine
a key that is bound to a virtual keysym. In this case, you must specify the
virtual keysym in the
SAS.keyboardTranslations
resource instead of the keysym displayed by
xev
. To determine the virtual keysym that is
bound to a key, you can start the Resource Helper, select [Keys],
and press the key or key combination that you want to define. Resource Helper
will display the virtual keysym name. You can also refer to the key definition
files in
/Xll/resource_files
in the directory where SAS is installed (
!SASROOT
) and to the man pages for VirtualBinding or xmbind.
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 in this topic are part of the syntax and should be entered exactly
as shown.
The syntax of the
SAS.keyboardTranslations
resource is
SAS.keyboardTranslations: #override \ |
[modifier] <Key>keysym : action-routine \n\ |
[modifier] <Key>keysym : action-routine |
#override
#override
directive, the new bindings replace all of the default bindings,
and none of the other keys on the keyboard will be available.(footnote 1)Alt
,
Ctrl
,
Meta
,
Shift
,
Lock
,
Mod1
,
Mod2
,
Mod3
,
Mod4
,
Mod5
,
None
, or
a blank space. The list of valid modifiers varies depending on your keyboard.
To display a list of valid modifiers for your keyboard, enter the
xmodmap
UNIX command. Refer to the
man
page for
xmodmap
for more information.Note: The SAS System does not prevent you from specifying
invalid keys in the
SAS.keyboardTranslations
resource. In some cases, invalid keys will produce warnings in the
shell window.
Note: The square brackets ([]) in the
following syntax indicate that the (InternalKeyName)
is optional.
The syntax of the
SAS.keysWindowLabels
resource is
SAS.keyWindowLabels: \ |
KeyWindowLabel [(InternalKeyName)] \n\ |
KeyWindowLabel [(InternalKeyName)] |
sas-function-key
action
routine in the corresponding
SAS.keyboardTranslations
key binding. (InternalKeyName is used by the SAS System to correlate KEYS window entries
to key definitions in the KEYS modules loaded from SAS catalogs or defined
in the SAS KEYS window.) If the InternalKeyName
is not specified, SAS uses the KeyWindowLabel
as the InternalKeyName.SAS.keyboardTranslations
resource.
See Modifying the SAS.keyboardTranslations Resource
for more information.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 in this topic are part of the syntax and
should be entered exactly as shown.
The SAS System 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.
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()
sas-cursor-left()
sas-cursor-right()
sas-cursor-up()
sas-delete()
sas-delete-begin()
sas-delete-char()
sas-delete-end()
sas-delete-prev-chr()
sas-delete-prev-word()
sas-delete-word()
sas-do-command()
<Key>KP_F3: sas-do-command(HOME;SUBMIT)
sas-function-key("InternalKeyName")
sas-home-cursor()
sas-insert-char(["InsertionString"])
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()
sas-kp-numeric()
sas-move-begin()
sas-move-end()
sas-new-line()
sas-next-field()
sas-next-word()
sas-page-down()
sas-page-end()
sas-page-top()
sas-page-up()
sas-prev-field()
sas-prev-word()
sas-to-bottom()
sas-to-top()
sas-toggle-insert()
sas-xattr-key(<KeyType>[,<KeyParam>])
Note: Most SAS documentation uses
angle brackets (<>) to indicate optional syntax. However, in these examples,
optional syntax is shown with square brackets ([]). The angle brackets that
are shown in these examples are part of the syntax and should be entered exactly
as shown.
In the following example, the sas-do-command action
routine specifies that the COMMAND command is to override any existing definition
for
KP_0
.
SAS.keyboardTranslations: #override \n\ None<Key>KP_0: sas-do-command(COMMAND)All other keys retain their current definitions.
The following example binds the key sequence CTRL-K to the KEYS command and specifies that CTRL-D deletes the character under the cursor. Commands entered in the KEYS window for CTRL-K and CTRL-D will have no effect.
SAS.keyboardTranslations: #override\ Ctrl<Key>k: sas-do-command(keys)\n\ Ctrl<Key>d: sas-delete-char()
The following example specifies that the key associated
with the keysym
hpClearLine
performs the command entered beside the
MyClrLn
label in the KEYS window.
SAS.keyboardTranslations: #override \ <Key>hpClearLine : sas-function-key("ClearLn") SAS.keysWindowLabels: MyClrLn(ClearLn)The character string that appears inside the parentheses in the
SAS.keysWindowLabels
resource must match the string entered as the
parameter to the sas-function-key routine. The label (
MyClrLn
) can be any character string, and the
keysym
hpClearLine
must
be a valid keysym for your keyboard.
#augment
and
#replace
directives, refer to the documentation for the X Window System.
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.