(LOGO.JPG) Python for OpenVMS

(go to: table of contents, index, list of vms_smg, prev: SET_DISPLAY_SCROLL_REGION, next: NEXT)


SET_KEYPAD_MODE - Set Keypad Mode

Set the terminal's numeric keypad to either numeric or applications mode.

Format:

    None = vms_smg.set_keypad_mode (keyboard_id, [flags])
Returns:

None

Arguments:

keyboard_id
The identifier of the virtual keyboard whose mode is to be changed.
flags
Mask that specifies whether the keypad is to be in applications or numeric mode. Value SMG_M_KEYPAD_APPLICATION is in module 'vms_smgdef'.
Examples:
>>> import vms_smg
>>> import vms_smgdef

>>> # create a new DECwindows terminal using SMG
>>> status, pasteboard_id, number_of_pasteboard_rows, \
... number_of_pasteboard_columns, type_of_terminal,   \
... device_name = vms_smg.create_pasteboard           \
...   (None, vms_smgdef.SMG_M_WORKSTATION)
>>>

>>> # create a virtual keyboard -
>>> #   use the device name from CREATE_PASTEBOARD
>>> keyboard_id, resultant_filespec = \
...     vms_smg.create_virtual_keyboard (device_name)
>>>

>>> # create virtual display
>>> status, vtdpy1 = vms_smg.create_virtual_display \
...         (8, 10, vms_smgdef.SMG_M_BORDER, None, None)
>>>

>>> # paste virtual display
>>> status = vms_smg.paste_virtual_display \
...          (vtdpy1, pasteboard_id, 3, 5, None)
>>>

>>> # put characters on virtual display
>>> status = vms_smg.put_chars (vtdpy1, '1234567890', 1, 1)
>>> status = vms_smg.put_chars (vtdpy1, 'ABCDEFGHIJ', 2, 1)
>>>

>>> # position cursor 
>>> vms_smg.set_cursor_abs (vtdpy1, 3, 1)
>>>

Screen layout, file: VMS_SMG_063.JPG

(picture VMS_SMG_063.JPG)

>>> # read a single keystroke
>>> status, terminator_code = vms_smg.read_keystroke \
...                           (keyboard_id, 'IN=', None, vtdpy1)

Notice that the Python interpreter does not respond
with the prompt ('>>>').

Screen layout, file: VMS_SMG_064.JPG

(picture VMS_SMG_064.JPG)

Enter [KP7] into the DECterm.

Notice that the Python interpreter returns with the prompt:

>>>
>>> # check status
>>> import vms_sys
>>> print vms_sys.getmsg (status)[0]
%SYSTEM-S-NORMAL, normal successful completion
>>>

>>> print terminator_code, vms_smgdef.SMG_K_TRM_KP7
267 267
>>>

>>> # change keypad to numeric mode
>>> vms_smg.set_keypad_mode (keyboard_id, 0)
>>>

>>> # make another read
>>> status, terminator_code = vms_smg.read_keystroke \
...                           (keyboard_id, 'IN2=', None, vtdpy1)

Again, the Python interpreter does not respond
with a prompt ('>>>').

(no screenshot here, 'IN2=' is just placed in the next line)

Hit [KP7] key on the keypad.

Again, the Python interpreter comes back:

>>>
>>> print vms_sys.getmsg (status)[0]
%SYSTEM-S-NORMAL, normal successful completio
>>>

>>> print terminator_code, chr(terminator_code)
55 7
>>>

>>> # change keypad back to application mode
>>> vms_smg.set_keypad_mode (keyboard_id, \
...        vms_smgdef.SMG_M_KEYPAD_APPLICATION)
>>>

>>> # make another read
>>> status, terminator_code = vms_smg.read_keystroke \
...                           (keyboard_id, 'IN3=', None, vtdpy1)

Again, the Python interpreter does not respond
with a prompt ('>>>').

(no screenshot here, 'IN3=' is just placed in the next line)

Hit [KP7] key on the keypad.

Again, the Python interpreter comes back:

>>>
>>> print vms_sys.getmsg (status)[0]
%SYSTEM-S-NORMAL, normal successful completion
>>>

>>> print terminator_code, vms_smgdef.SMG_K_TRM_KP7
267 267
>>>

(go to: table of contents, index, list of vms_smg, prev: SET_DISPLAY_SCROLL_REGION, next: NEXT)

11-SEP-2000 ZE.