(go to: table of contents, index, list of vms_smg, prev: PREV, next: NEXT)
Format:
The Python interface uses a Python integer for the short form terminator and
a Python string for the long form.
@@ This part needs further investigation.
READ_STRING - Read String
Read a string from a virtual keyboard.
status, resultant_string, \
terminator_code, terminator_string = \
vms_smg.read_string (keyboard_id, [prompt_string], \
[maximum_length], [modifiers], [timeout], \
[terminator_set], [display_id], [initial_string], \
[rendition_set], [rendition_complement])
Returns:
Arguments:
Examples:
(go to: table of contents,
index, list of vms_smg,
prev: PREV,
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 string
>>> status, resultant_string, \
... terminator_code, terminator_string = \
... vms_smg.read_string (keyboard_id, 'IN=', \
... 5, None, None, \
... None, vtdpy1, 'AB', \
... None, None)
Notice that the Python interpreter does not respond
with the prompt ('>>>').
'AB' is pre-loaded into the input buffer.
'B' is deleted by hitting the [DEL] key.
'C' is entered.
Input is terminated by hitting the [PF4] key.
Notice that the Python interpreter returns with the prompt:
>>>
>>> import vms_sys
>>> print vms_sys.getmsg (status)[0]
%SYSTEM-S-NORMAL, normal successful completion
>>>
>>> print repr(resultant_string)
'AC'
>>> print terminator_code, vms_smgdef.SMG_K_TRM_PF4
259 259
>>> print repr(terminator_string)
'\033OS'
>>> # '\033' is ESC
>>>
>>> # use a timeout of 3 seconds
>>> status, resultant_string, \
... terminator_code, terminator_string = \
... vms_smg.read_string (keyboard_id, 'IN=', \
... 5, None, 3, \
... None, vtdpy1, 'AB', \
... None, None)
>>> print vms_sys.getmsg (status)[0]
%SYSTEM-F-TIMEOUT, device timeout
>>>