function long window_input( string prompt, answer, long max_answer_len ) !labels !constants %include "$trmdef" %from %library "sys$library:basic$starlet.tlb" %include "$smgdef" %from %library "sys$library:basic$starlet.tlb" %include "$smgmsg" %from %library "sys$library:basic$starlet.tlb" %include "smg$routines" %from %library "sys$library:basic$starlet.tlb" %include "$smgtrmptr" %from %library "sys$library:basic$starlet.tlb" %include "$ssdef" %from %library "sys$library:basic$starlet.tlb" !types !variables declare long sys_status, input_dpid, dp_attr, & window_width, window_len, start_col, & start_row, modifiers %include "que_struct.bas" !procedures !functions external long function smg$put_with_scroll, & window_getmsg( long ) modifiers = trm$m_tm_trmnoecho dp_attr = smg$m_border prompt = " " + prompt window_width = len(prompt) + max_answer_len + 2% window_len = 3% sys_status = smg$create_virtual_display( window_len by ref, & window_width by ref, & input_dpid by ref, & dp_attr by ref,, ) if (sys_status and 1%) = 0% then call lib$signal( sys_status by value ) end if start_col = (tt_cols - len(prompt) - max_answer_len) / 2% + 1% start_row = (tt_rows / 2%) - ((window_len + 2%) / 2%) + 1% sys_status = smg$paste_virtual_display( input_dpid by ref, & pbid by ref, & start_row by ref, & start_col by ref, ) if (sys_status and 1%) = 0% then call lib$signal( sys_status by value ) end if sys_status = smg$set_cursor_abs( input_dpid by ref, & 2% by ref, & 1% by ref ) if (sys_status and 1%) = 0% then call lib$signal( sys_status by value ) end if sys_status = smg$read_string( kbid by ref, & answer by desc, & prompt by desc, & max_answer_len, & modifiers by ref,,,,, & input_dpid by ref,,, ) if sys_status = smg$_eof then sys_status = ss$_normal end if if (sys_status = ss$_badescape) or & (sys_status = ss$_partescape) or & (sys_status = ss$_dataoverun) then sys_status = window_getmsg( sys_status ) end if if (sys_status and 1%) = 0% then call lib$signal( sys_status by value ) end if sys_status = smg$delete_virtual_display( input_dpid by ref ) if (sys_status and 1%) = 0% then call lib$signal( sys_status by value ) end if window_input = sys_status end function