home *** CD-ROM | disk | FTP | other *** search
- DECLARE SUB FORMSAMP.FRM.SETUP (S%, BCOL%, TAC%, TMAC%, BAC%, BMAC%, MAC%)
- DECLARE SUB FORMSAMP.FRM.DISPLAY (W%, FCOL%, HCOL%)
-
- ' Functions MUST DECLARE
- DECLARE FUNCTION MOUSEON% (ONOFF%)
- DECLARE FUNCTION CHOICEWIND% (T$, T$(), C$(), TR%, LC%, C1%, C2%, ESC%, BRDR%)
-
- '***************************************************************************
- '**** THIS PROGRAM MUST BE USED WITH ONE OF THE FOLLOWING LIBRARIES: ****
- '***************************************************************************
- '**** For QB4.5 unenhanced version use QBUNEN.QLB ****
- '**** For BASIC 7.1 unenhanced version use PDSUNEN.QLB ****
- '**** For VBDOS 1.0 unenhanced version use VBUNEN.QLB ****
- '**** For QB4.50 enhanced version use QBALL.QLB or QBNER.QLB ****
- '**** For BASIC 7.1 enhanced version use PDSALL.QLB or PDSNER.QLB ****
- '**** For VBDOS 1.0 enhanced version use VBALL.QLB or VBNER.QLB ****
- '**** Load QB, QBX, or VBDOS with the /L option and the correct library ****
- '***************************************************************************
- '**** Load this file first as the main module then load FORMSAMP.FRM ****
- '**** as a module. Although only four CALLS are required to edit ****
- '**** data in the form, this example displays many options such as ****
- '**** the INFOLINE, HELP, and data validation. ****
- '***************************************************************************
- COLOR 0, 7: CLS
- '----------- Routines must be called once in every program. ---------------
- '----------- See WIND_REZ.DOC for details
-
- CALL SETWIND(1, 1, 8, 0, 15) ' For all routines. 15 is color
- ' of "hot brackets".
- CALL INPTINIT(1, 1, 1, 1, 1) ' For input routines
- J% = MOUSEON%(1) ' turn mouse "ON"
-
- '--------- Set up the fields and display the form w/o the fields ----------
-
- '----- SETINPT must be called prior to call to FORMSAMP.FRM.SETUP.
- '----- If the Muli-field input screen ( #1 in this example ) is
- '----- reserved for this input screen only, SETINPT & FORMSAMP.FRM.SETUP
- '----- can be called once in the program. Calls to FORMSAMP.FRM.DISPLAY
- '----- and MULTINPT can be repeated when required.
-
- CALL SETINPT(1, 25, "1E", 15) ' Mult-input screen #1 with 25 lines.
- ' F1 or ESC will exit MULTINPT.
- ' 15 is color for button field hot
- ' characters.
-
- '----- FORMSAMP.FRM.SETUP calls routine MAKEFIELD for all fields.
-
- CALL FORMSAMP.FRM.SETUP(1, 23, 15, 15, 15, 23, 15)
-
- '----- FORMSAMP.FRM.DISPLAY displays the form without the fields.
- '----- The call to MULTINPT which follows displays the fields.
-
- CALL FORMSAMP.FRM.DISPLAY(1, 23, 15)
-
- '- Add boxes / lines to the form. Use print-out from Form Maker to help -
-
- CALL LINEW(2, 1): CALL LINEW(10, 1)
- CALL BOXW(11, 7, 12, 3, 1): CALL BOXW(11, 43, 12, 3, 1)
-
- '---------- Set constants for button and mouse select fields --------------
-
- DIM FIELDDATA$(12) ' 12 fields in the form
- FIELDDATA$(10) = "< OK >" ' 10th field is OK button
- FIELDDATA$(11) = "< Cancel >" ' 11th field is Cancel button
- FIELDDATA$(12) = "[ F1=HELP ]" ' 12th field is "Mouse select field"
-
- CALL INFOLINE(25, 2, 78, 31) ' Print instuctions on bottom line
-
- '------------------ Get the data via routine MULTINPT ---------------------
-
- TOFLD% = 1: FROMFLD% = 0 ' Enter form in field one ( TOFLD% =1 )
- ' Update all fields ( FROMFLD% = 0 )
- DO
- '---------------------- For infoline at bottom of screen -----------------
- '------------- All fields must be Auto-exit to use the infoline ----------
-
- SELECT CASE TOFLD%
- CASE 1: IL$ = " Enter your name."
- CASE 2: IL$ = " Enter your street address."
- CASE 3: IL$ = " Enter your city."
- CASE 4: IL$ = " Enter your state."
- CASE 5: IL$ = " Enter your zip."
- CASE 6: IL$ = " Enter birth date. FORMAT MUST = DD-MM-YYYY to exit field."
- CASE 7, 8, 9: IL$ = " Enter your Social Security number"
- CASE 10: IL$ = " Press ENTER or the SPACE bar to accept the data as shown."
- CASE 11: IL$ = " Press ENTER or the SPACE bar to cancel."
- END SELECT
- CALL PRINTINFO(IL$ + " TAB = Next field")
-
- '--------------------- Get the data via MULTINPT ------------------------
-
- ' "U" in MULTINPT - follow user defined field sequence ( order ).
-
- CALL MULTINPT(1, TOFLD%, "U", FROMFLD%, RKEY%, FIELDDATA$(), MOUSESEL%)
-
- WASERROR% = 0 ' Assume all fields filled
-
- ' ---- Check for SPACE BAR pressed on button or mouse clicked on button
-
- IF RKEY% = 100 OR RKEY% = 32 THEN ' 100 = mouse / 32 = SPACE BAR
- IF TOFLD% = 10 THEN RKEY% = 13 ' OK button -- make same as ENTER
- IF TOFLD% = 11 THEN RKEY% = 27 ' CANCEL button -- make same as ESC
- END IF
-
- ' ---- Check if ENTER pressed on Cancel button -------------------------
-
- IF FROMFLD% = 11 AND RKEY% = 13 THEN RKEY% = 27 ' make same as ESC
-
- ' ----- Check if ENTER was pressed or simulated -----------------------
-
- IF RKEY% = 13 THEN ' ENTER pressed. Check for blank fields.
- FOR X% = 1 TO 9 ' field one to 9.
- IF FIELDDATA$(X%) = "" THEN ' a field was blank.
- CALL CUROFF
- CALL GETANS("ERROR: BLANK FIELD Press any key...", "", "", 100, 100, 15, 15, 41)
- TOFLD% = X% ' re-enter on blank field
- WASERROR% = 1 ' flag for error
- EXIT FOR
- END IF
- NEXT
- END IF
-
- ' ----- Check if F1 pressed or mouse clicked on "[ F1=HELP ]" ---------
- ' RKEY% = 1 for F1. "[ F1=HELP ]" is field 12
-
- IF RKEY% = 1 OR MOUSESEL% = 12 THEN
- REDIM CH$(1), TXT$(3)
- CH$(1) = "Ok"
- TXT$(1) = " Enter data in all fields. Press ENTER"
- TXT$(2) = " or click on <OK> to accept. Press ESC"
- TXT$(3) = " or click on <Cancel> to abort........"
- J% = CHOICEWIND%("@Help", TXT$(), CH$(), 100, 100, 15, 0, 1, 141)
- END IF
-
- ' Exit LOOP if ENTER pressed or < OK > selected without error.
- ' Exit LOOP if ESC pressed or <Cancel> selected.
-
- LOOP WHILE (RKEY% <> 13 AND RKEY% <> 27) OR WASERROR% = 1
-
- '---------------------------- Done ----------------------------------------
-
- IF RKEY% = 13 THEN ' ENTER or < OK >
- MESSAGE$ = "DATA ACCEPTED"
- ELSE ' ESC or < Cancel >
- MESSAGE$ = "TRANSACTION CANCELED"
- END IF
-
- CALL GETANS(MESSAGE$ + "! Press any key.", "", "", 20, 100, 15, 15, 1)
-
- CALL RSTRWIND(1, 1) ' Restore area under form.
- ' Window #1 was used for form.
- END
-
-