Rockwell Automation 2708-NBD VBASIC Language Development Kit User Manual

Page 75

Advertising
background image

Appendix C

Application Library Subroutines

C–7

The global MODIFIED% is TRUE when the string was changed in any
way. The strlength is the maximum number of characters to allow in the
string (not including the terminal null). This must be at least fieldlength%
characters long. The return value “e” is an event code. This is 0 on a normal
return (operator pressed CR). The devices which are active are defined by the
global variable GLOBALMASK% which is in the same format as the
mask% used by % and TestEvent%. The field will start at the current cursor
location. The cursor is left at its starting locationi when ReadStrField exits.

e = ReadStrField%( attr%, fldlen%, strtchar%, string$,
stringlen% )
FUNCTION ReadStrField% ( attr%, flength%, strpos%, s$,
slen% )

ReadStr%

Edit a string on the screen.

Thhis is a simplified version of ReadStrField% that does not have as many
parameters. Any attributes should be in the GLOBALATTR% variable.
Don’t forget to set GLOBALMASK% to the devices which can terminate the
read. Make sure you include KbdMask. See TestEvent% for more info.

e = ReadStr ( length%, s$ )
FUNCTION ReadStr% ( n%, s$ )

An example of reading from the keyboard is as follows:

e = ReadStr(Length%, s$)
IF e = BadgeEvent THEN

s$ = InBuf$

. .

END IF

ReadNumStr%

Edit a numeric string on the screen.

The string which is edited may contain only 0 through 9. Any attributes
should be in the GLOBALATTR% variable.

e = ReadNumStr ( length%, s$ )
FUNCTION ReadNumStr% ( n%, s$ )

ReadYN%

Wait for a YES/NO response from user.

Returns TRUE or FALSE depending on the user’s response. EXITKEY% is
set if you really need the event value. Nothing is displayed; this just waits for
Enter, Clear, or a Y or N.

IF ReadYN% ( default% ) THEN . . .
FUNCTION ReadYN% ( defv% )

Advertising