Click or drag to resize

_accept Function (String)

Take input from the keyboard and assign it to a memory variable.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.4a
Syntax
 FUNCTION _accept(
	uValuePrompt AS STRING
) AS STRING
View Source

Parameters

uValuePrompt
Type: String
An optional prompt displayed before the input area.

Return Value

Type: String
Remarks
When _Accept is executed, it first performs a carriage return/linefeed, displays the prompt in the terminal window, and begins taking characters from the keyboard at the position immediately following the prompt. Up to 255 characters can be entered.  When input reaches the edge of the window, as defined by MaxCol(), the cursor moves to the next line. _Accept supports only two editing keys:  Backspace and Enter (Esc is not supported).  Backspace deletes the last character typed.  Enter confirms entry and is the only key that can terminate an _Accept.
If Enter is the only key pressed, _Accept assigns a NULL_STRING to <cVar>.
Examples
This example uses ACCEPT to get keyboard input from the user:
X#
1LOCAL cVar AS STRING
2cVar := _Accept("Enter a value:  " )
3IF cVar = NULL_STRING
4? "User pressed Enter"
5ELSE
6? "User input:", cVar
7ENDIF

Terminal Lite
See Also