Category : BASIC Source Code
Archive   : QWEZ50.ZIP
Filename : MULTSAM2.BAS

 
Output of file : MULTSAM2.BAS contained in archive : QWEZ50.ZIP
DECLARE SUB SETINPT (SCRN%, WID%, EX$, INPT%(), INPT$(), BC%)
DECLARE SUB SETWIND (FST%, S%, SH%, NOHI%, SA%)
DECLARE SUB MULTINPT (SCRN%, TOFLD%, EXIT$, AEXIT%, RKEY%, RTRN$())
DECLARE SUB MAKEWIND (W%, LABEL$, TR%, LC%, WD%, NR%, ATTR%, BORDER%)
DECLARE SUB PRINTW (TEXT$, R%, LC%)
DECLARE SUB INPTINIT (DFORMAT%, ISDOT%, EXIT$)


'***************************************************************************
' This is an example of using auto-exit fields in MULTINPT to add ****
' two numbers and place the sum in a protected field. ****
'***************************************************************************
'**** THIS PROGRAM MUST BE USED WITH ONE OF THE FOLLOWING LIBRARIES: ****
'***************************************************************************
'**** For QB4.+ unenhanced version use QB4UNEN.QLB ****
'**** For BASIC 7.+ unenhanced version use PDSUNEN.QLB ****
'**** For QB4.+ enhanced version use QB4ALL.QLB or QB4NER.QLB ****
'**** For BASIC 7.0 enhanced version use PDSALL70.QLB or PDSNER70.QLB ****
'**** For BASIC 7.1 enhanced version use PDSALL71.QLB or PDSNER71.QLB ****
'**** Load QB or QBX with the /L option using the correct library ****
'***************************************************************************

CALL SETWIND(1, 1, 7, 0, 1) ' INITIALIZE WINDOW MEMORY
CALL INPTINIT(1, 1, "") ' INITIALIZE INPUT MEMORY
COLOR 7, 0: CLS ' BLANK THE SCREEN
DIM RTRN$(4) ' FOR THE FOUR FIELDS

'---------------------------------------------------------------------------
' SETINPT MUST BE CALLED FOR EACH MULTI-FIELD INPUT SCREEN

REDIM INPT%(25), INPT$(4)
TOFLD% = 1: B% = 1
DO
READ INPT%(B%)
IF INPT%(B%) = 9999 THEN EXIT DO
B% = B% + 1
FOR X% = 1 TO 5
READ INPT%(B%)
B% = B% + 1
NEXT
READ INPT$(TOFLD%)
TOFLD% = TOFLD% + 1
LOOP

' Auto-exit ( on change ) - auto advance - numeric with no decimal places
DATA 21000,5,5,4,15,99,"" : 'FIELD 1
' Auto-exit ( on change ) - auto advance - numeric with no decimal places
DATA 21000,7,5,4,15,99,"" : 'FIELD 2
' Protected - numeric with no decimal places
DATA 100,9,5,5,15,99,"" : 'FIELD 3
' Alpha / numeric
DATA 7,11,5,15,15,99,"" : 'FIELD 4
DATA 9999 : '9999 MARKS END OF DATA

CALL SETINPT(1, 80, "1", INPT%(), INPT$(), 0)
ERASE INPT%, INPT$
'----------------------------------------------------------------------------
' THE MAIN PROGRAM

' program
' program

GOSUB AUTOEXITEXAMPLE

' program
' program

END

'---------------------------------------------------------------------------
' MULTI-FIELD SUB-ROUTINE

AUTOEXITEXAMPLE:

TOFLD% = 1: AUTOEXIT% = 0: EXIT$ = "" ' START IN FIELD 1. PRINT ALL
' FIELDS.
'----------------------------------------------------------------------------
' MAKE A WINDOW. PRINT INSTRUCTIONS

CALL MAKEWIND(1, "@Auto-exit fields used to update a protected field", 1, 1, 80, 14, 112, 102)
CALL PRINTW("Auto-exit and auto advance with numeric input", 2, 15)
CALL PRINTW("+", 3, 5)
CALL PRINTW("Auto-exit and auto advance with numeric input", 4, 15)
CALL PRINTW("Protected Field", 6, 15)
CALL PRINTW("Alpha-numeric", 8, 24)
CALL PRINTW("Press F1 to end demonstration", 10, 100)

'----------------------------------------------------------------------------
PREINPT:
CALL MULTINPT(1, TOFLD%, EXIT$, AUTOEXIT%, RKEY%, RTRN$())

' FIRST CHECK TO SEE IF THE EXIT WAS DUE TO FIELD 1 OR 2 BEING EXITED,
' EITHER BY THE AUTO-EXIT FEATURE OR BY THE "F1" KEY.
' ON EXIT AUTOEXIT% POINTS TO THE FIELD THE CURSOR WAS ON WHEN MULTINPT
' WAS EXITED ( IF IT WAS AN AUTOEXIT FIELD. ). ON EXIT TOFLD% POINTS TO
' THE FIELD THE CURSOR IS MOVING TO.


IF AUTOEXIT% = 1 OR AUTOEXIT% = 2 THEN ' IS IT FIELD 1 OR 2 ?
RTRN$(3) = STR$(VAL(RTRN$(1)) + VAL(RTRN$(2))) ' ADD FIELD 1 + 2
IF RTRN$(1) + RTRN$(2) = "" THEN RTRN$(3) = ""
CALL MULTINPT(1, TOFLD%, "VIEW", 3, JUNK%, RTRN$()) ' UPDATE FIELD 3 ONLY
END IF

IF RKEY% <> 1 THEN ' WAS NOT "F1".
GOTO PREINPT ' CURSOR GOES TO TOFLD%.
ELSE
RETURN ' PROGRAM WILL ALWAYS COMES HERE IF "F1"
END IF ' IS PRESSED AS RKEY% = "F1"




  3 Responses to “Category : BASIC Source Code
Archive   : QWEZ50.ZIP
Filename : MULTSAM2.BAS

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/