(go to: table of contents, index, list of vms_smg, prev: READ_FROM_DISPLAY, next: NEXT)
Format:
READ_KEYSTROKE - Read a Single Character
Read a keystroke and return that keystroke's terminator code.
status, terminator_code = vms_smg.read_keystroke \
(keyboard_id, [prompt_string], [timeout], \
[display_id], [rendition_set], [rendition_complement])
Returns:
Arguments:
Examples:
(go to: table of contents,
index, list of vms_smg,
prev: READ_FROM_DISPLAY,
next: NEXT)
>>> 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)
>>>
>>> # 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 ('>>>').
Enter 'A' 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, chr(terminator_code)
65 A
>>>
>>> # make another read
>>> status, terminator_code = vms_smg.read_keystroke \
... (keyboard_id, 'IN=>', None, vtdpy1)
Again, the Python interpreter does not respond
with a prompt ('>>>').
(no screenshot here, 'IN2=' is just placed in the next line)
Hit the [PF1] 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_PF1
256 256
>>>