BSTR RFInput(BSTR pszDefault, short nLength, short nCol, short nRow, BSTR pszBarCfg, short nKeyMode, long nInputMode)
Function RFInput(pszDefault As String, nLength As Integer, nCol As Integer, nRow As Integer, pszBarCfg As String, nKeyMode As Integer, nInputMode As Long) As String
Inputs user data from keyboard, scanner or serial port.
Return value
A string that contains the user input. Empty if an error
occurs.
Sets the variables accessed by RFGetLastError,
LastInputType, LastBarcodeType.
The string returned by F1 is "1" (type WLCOMMANDTYPE),
the string returned by [1]+[ENTER] key is "1"
(type WLKEYTYPE).
The values returned by the function keys (type WLCOMMANDTYPE) are :
"1"=F1, "9"=F9, "10"=F0.
"21"=Up Arrow, "22"=Left Arrow, "23"=Right Arrow,
"24"=Down Arrow
Return value, weird
If the CLR key is pressed, the LastInputType is WLCOMMANDYPE. Note
that in GetEvent the CLR key returns a WLKEYTYPE.
If the ENTER key is pressed in an empty field, the LastInputType is WLKEYTYPE
and the 013 code (0Dh) is returned.
If the WLNOCRIFEMPTY flag is
set, an empty string is returned.
Parameters
pszDefault
The default data displayed in the input area, and put in the input queue.
nLength
The maximum possible length of the input if
the WLMAXLENGTH is set in the nInputMode flag. Otherwise, the user
input may exceed this value.
If reached, returns from input automatically
if WLNO_RETURN_FILL is not set in the nInputMode flag.
nCol
The start column (0 based) of the input area.
nRow
The start row (0 based) of the input area.
pszBarCfg
Barcode and button configuration : "BarCfg|BntPad". Should be
"BarCfg|BntPad", "BarCfg", "|BntPad"
or "".
The name of an existing barcode
configuration file (see RFBARCODE
object, and StoreBarcode
method), up to 8 characters.
If empty, uses the previous or default barcode
configuration.
It is recommended to use the StoreBarcode and PullBarcode one time to load
the configuration and leave empty this field rather than supplying a
barcode configuration name here.
The name of an existing Button Pad file preceded by "|" (see RFBUTTON
object, and PadStore
method), up to 8 characters.
If empty, uses the default Button Pad configuration ("_Input") (WCE
only).
The names must contain legal characters for
MS-DOS filenames. Do not include dots (.) and other special
characters (* , $ \ : etc). The "|" character is a separator between
barcode and button file names.
nKeyMode
The default keyboard state, one (and only one) of
the following constants :
Constant | Description |
---|---|
WLNORMALKEYS | The keyboard is set to lowercase mode (for full keyboards: 45, 46 keys) or in numeric mode (reduced keyboards: 35, 21 keys). |
WLCAPSLOCK | The keyboard is set to uppercase mode (for full keyboards: 45, 46 keys) or in alphabetic mode (reduced keyboards: 35, 21 keys). |
WLKEEPKEYSTT | Keep the keyboard actual state. The keyboard remains in the state the previous input left. |
nInputMode
One or more (adding) of the following
constants : (see also SetDefaultInputMode)
Constant | Description Default behavior |
---|---|
Automatic return |
|
WLNO_RETURN_FILL | Do not return from function if the
maximum length is reached. Needs the ENTER key to be
pressed. (If not set) Automatic return if the maximum length is reached, without ENTER key by default. |
WLNO_RETURN_BKSP | Do not return from function if the BKSP
key is pressed and the input area is empty. (If not set) Returns if the BKSP key is pressed, in an empty input area by default. |
Backlight |
|
WLBACKLIGHT | Switch on (timed-out) the display backlight. |
Display |
|
WLECHO_ASTERISK | Replace the displayed characters with an asterisk (*). |
WLSUPRESS_ECHO | Do not display the input data. (If not set) Display by default. |
Input characters |
|
WLALPHA_ONLY | Allow only alphabetic characters in
input. (If not set) All characters are allowed by default. |
WLNUMERIC_ONLY | Allow only numeric characters in input. (If not set) All characters are allowed by default. |
WLINCLUDE_DATA | When a function key is pressed, returns
the data and function key. (If not set) When a function key is pressed, returns only the function key and data is discarded by default. |
WLTOUPPER | Uppercase keyed data characters. (If not set) The input characters are not modified. |
Input devices |
|
WLDISABLE_SCAN | Disable the barcode scanner for input. (If not set) Enabled by default. |
WLDISABLE_KEY | Disable the keyboard for input (but not
the function keys). (If not set) Enabled by default. |
WLDISABLE_FKEYS | Disable the function keys for input. (If not set) Enabled by default. |
WLSOFT_TRIGGER | Activate the scanner (timed-out) at
input time. (If not set) Scanner is activated by trigger keys by default |
Length control |
|
WLFORCE_ENTRY | Do not return from function with an
empty input. (If not set) Returns if ENTER key is pressed with an empty input by default. |
WLMAXLENGTH | The function doesn't allow more than the
maximum length characters defined by nLength. (If not set) The function allows input for more characters than defined by nLength (system limitations). |
WLNOCRIFEMPTY | Do not put a CR (013, 0x0Dh) when an empty string is
input. (If not set) Put a CR (013, 0x0Dh) when an empty string is input. |
Edit Mode |
|
WLEDIT_DEFAULT | If default data is supplied, the input data is
appended. (If not set) The default data is overwritten, new input replaces default. |
Timeout |
|
WLINPUTTIMEOUT | Sets a timeout for user input. Uses KeyTime from
RFTERMINAL for timeout timeframe and returns a WLCOMMANDTYPE "TIMEOUT"
message if the user goes over the timeout. (If not set) No Timeout. |
Unsupported |
|
WLNO_NONPRINTABLE | Suppress the display of some characters. (If not set) All character set is displayed. |
WLCLR_INPUT_BUFFER | Clears the input buffer before input. |
WLINGORE_CRLF | Includes CR and LF in scanner input if
present in the barcode. Always do that. |
Remarks
The RFInput function fills the input area (nLength characters
starting at nCol and nRow position) with the "fill
character" (underscore "_" by default or any other
defined by SetFillChar) and
sets in the input area the default data.
The function sets the keyboard to the mode indicated by nKeyMode
flags.
The barcode configuration file is read and the scanner decoder is set with this values if the entry is not empty.
RFInput enables all the input devices (scanner, keys, function
keys) except those indicated in nInputMode flags.
The keys are echoed to the display, under control of nInputMode
flags. Function keys and scanner input are not echoed.
Some characters (numeric, alphabetic) from keyboard will be
avoided by nInputMode flags.
The input ends with ENTER key, by filling the complete input
area, by a function key or by a successful barcode scanning.
Empty user input and auto-return are controlled by nInputMode
flags.
Backlight and scanner will be automatically switched on when
entering the function by nInputMode flags.
Example
Public wsRfIo As New RFIO
Public wsRfTerm As New RFTERMINAL
Dim sBuff As String
Dim iRes As Integer
Dim iBc As Integer
Public Sub Main()
' Input with :
' default input data "DEFAULT"
' 20 maximum characters
' at column 0 row 5
' no special barcode configuration
' 15 seconds timeout
' nInputMode :
' Keyboard in numeric mode
' No auto-return if filled input area
' Alphabetic characters only allowed
with keyboard input
' Do not allow more characters than
defined by nLength (20)
' Timeout enabled
wsRfTerm.ReadTerminalInfo
wsRfTerm.SetKeyTimeout 15
wsRfTerm.SetTerminalInfo
sBuff = wsRfIo.RFInput("DEFAULT", 20, 0,
5, "", WLNORMALKEYS, _
WLNO_RETURN_FILL + WLALPHA_ONLY +
WLMAXLENGTH + WLINPUTTIMEOUT)
iRes = wsRfIo.RFGetLastError() ' Get the error
code
if iRes <> WLNOERROR Then
If (wsRfIo.LastInputType = WLCOMMANDTYPE And sBuff = "TIMEOUT") Then
' Timeout reached, add your
timeout handling routine here
End If
If wsRfIo.LastInputType =
WLCOMMANDTYPE Then
' A function key OR CLR key
here
End If
If wsRfIo.LastInputType =
WLKEYTYPE Then
' A normal
Keyboard input here
End If
If wsRfIo.LastInputType =
WLSCANTYPE Then
' A barcode
input here
iBc =
wsRfIo.LastBarcodeType
End If
Else
' Input Error (RF link lost)
End If
End Sub
See also RFIO, RFBARCODE, RFGetLastError, LastInputType, LastBarcodeType, SetFillChar, StoreBarcode, PullBarcode, RFBUTTON, SetDefaultInputMode, RFTERMINAL.