![]() | Programming Guide | ![]() |
Sets cursor control key options
#include <smkeys.h>int sm_keyoption(int key, int mode, int newval);
key- The key whose processing you wish to change.
mode- Specifies the type of action to take on
keywith one of these values:
KEY_ROUTINGlets you disable a key or explicitly control the action taken when a key is pressed.
KEY_GROUPlets you control the cursor action when it is within a group.
KEY_XLATElets you assign key the action performed bynewval.newval- The new action to assign to
key.
- · The old value.
Use
sm_keyoptionto change at runtime how sm_input processeskey, wherekeyis a cursor control key. Default key option values are built into Panther. This function only works with cursor control keys; these include all Panther logical keys except those of type PF, SPF, and APP. Refer to Table 6-1 in Configuration Guide for a list of Panther logical keys.There are three different possible values for
mode:KEY_ROUTING,KEY_GROUPandKEY_XLATE. Thenewvalarguments that are valid for each mode are described below. All of these modes accept a logical key constant forkey.
KEY_ROUTING- Allows access to the EXECUTE and RETURN bits of the routing table. Use this mode to disable a key or to explicitly control the action to take when a key is pressed. The following constants can be assigned to
newval:
KEY_IGNORE. Disables key. Panther does nothing when key is struck.
EXECUTE. The action normally associated with key is executed; can be OR'd withRETURN.KEY_GROUP- Allows access to the group action bits. Use this mode to control the action of the cursor when it is within a group. The following values can be assigned to
newval:
VF_GROUP— Obey group semantics. Hitting key causes the cursor to move to the next field within the group in the indicated direction. If this constant is OR'd withVF_CHANGEthe cursor exits the group in the indicated direction.
VF_OFFSCREEN— Offscreen data scrolls onscreen from the direction indicated.
VF_NOPROT.key— Moves cursor into a field protected from tabbing.KEY_XLATE- Allows access to the cursor table. Use this mode to assign
keythe action performed bynewval.keycan be any cursor control key excludingINS,MNBR,REFR,SFTS, andLP.newvalcan be any key—logical, function, application, ASCII, and so on.
/* newline_is_xmit: Map the new line key (Return or Enter on
* most keyboards) to XMIT -or- reset it back to NL.
* Invoke from a control string as:
* ^newline_is_xmit X To make NL act as XMIT
* ^newline_is_xmit N To make NL act as NL */
int newline_is_xmit(char *cs_data);
{
while (*cs_data && *cs_data != ' ')
cs_data++;
while (*cs_data == ' ')
cs_data++;
if (*cs_data == 'X')
{
sm_keyoption(NL, KEY_XLATE, XMIT);
}
else
{
sm_keyoption(NL, KEY_XLATE, NL);
}
return(0);
}
![]()
![]()
![]()
![]()