!*************************** AMUS Program Label ****************************** ! Filename: GETFID.BAS Date: 12/13/92 ! Category: ESP Hash Code: 544-131-244-046 Version: 1.0(100) ! Initials: GR/AM Name: JAMES A. JARBOE IV ! Company: EDUCATIONAL VIDEO NETWORK, INC Telephone #: 4092955767 ! Related Files: GETFID.SBR, GETFID.SCR, SKPFLD.SBR ! Min. Op. Sys.: 1.3D Expertise Level: BEG ! Special: Must have TOOLBX.SYS installed and GETFID.SBR ! Description: Basic program to test out and demonstrate the usage of ! GETFID.SBR ! !***************************************************************************** !*! Updated on 11-Dec-92 at 6:42 AM by James A. Jarboe I V; edit time: 1:28:20 !*! Created on 11-Dec-92 at 1:18 AM by James A. Jarboe I V; edit time: 0:01:44 !*************************************************************************** ! GETFID.BAS - Tests GETFID.SBR !*************************************************************************** ! ! This program tests the GETFID.SBR which is to be used with ESP and TOOLBX. ! One gripe of ESP users is the unavailability to allow the user to ! modify the sequence of an ESP screen entry and always get, set or ! evaluate the proper information from the ESP screen to the basic ! program variables without changing the BASIC program or using some ! elaborate table that must always be modified correctly. ! PROGRAM GETFID, 1.0(100) ! 11-Dec-92 ! ! THE GETFID.SBR helps to overcome this problem by allowing the program ! to access an ESP screen Fields PERMANENT ID NUMBER and base evaluations ! upon the PERMANENT ID NUMBER as offset by the screen's current FIELD ! NUMBER. ! ! This program uses: ! SYSSTD.BSI (Provided with ESP) ! TOOLBX.SBR (Provided with ESP) ! TOOLBX.BSI (Provided with ESP) ! GETFID.SCR (Provided on AMUS NETWORK by James A. Jarboe IV) ! GETFID.SBR (Provided on AMUS NETWORK by James A. Jarboe IV) ! Source also provided (GETFID.M68) ! SKPFLD.SBR (Provided on AMUS NETWORK by James A. Jarboe IV) ! ! Any comments, suggestions, gripes should be directed to: ! GR/AM on the AMUS Network. ! ++include TOOLBX.BSI ! include standard TOOLBX symbolics. ++include SYSSTD.BSI ! include standard ESP symbolics. ! map1 SCREEN$, S, 34 ! Screen to try out map1 FLDCNT, F, 6 ! Number of fields in screen. map1 FLDID, F, 6 ! Permanent Field ID. map1 PFLD(50), F, 6 ! Permanent fields. ! Make big incase more screen fields are added. map1 CFLD(50), F, 6 ! Current field (Field Number) map1 CURNT'PERM'FIELD, F, 6 map1 PER'OFF, F, 6 ! Permanent offset for SETVAL for POSTEDITing ! Set permanent field offset for SETVAL call when setting field values. ! We use 6 because we are using a generic call to SET values and the ! first SET value permanent field value is 7 because I used permanent ! field 6 for something else. So the logic will be (PER'OFF+X) ! PER'OFF = 6 ! Set screen to use ! SCREEN$ = "GETFID.SCR" !*************************************************************************** ! GETFID !*************************************************************************** ! This program will always get information from ESP screen GETFID.SCR ! Permanent Fields number 1,2,3,4,5 and set the date from permanent fields ! number 1,2,3,4,5 and set them in permanent fields number 7,8,9,10,11. ! Permanent field number 1 will always be entered first. ! All the ESP field's FIELD NUMBER or sequencing entry can be modified ! to suit the user and the information will always be returned to the ! proper variables. ! GETFID: ! Properly initialize terminal. ! xcall INITRM, "GETFID.SBR Test Program","By James A. Jarboe IV" ! Properly Fetch screen. ! xcall FETCH, SCREEN$, SCREEN, X if X call FETCH'ERROR : goto FINISHED ! Get Number of fields in this screen. ! xcall TOOLBX, TBX'FLDCNT, SCREEN, FLDCNT ! GETFID.SBR does the following: ! Returns the current FIELD NUMBER of the PERMANENT FIELD NUMBER of ! an ESP SCREEN FIELD. ! ! GETFLD, SCREEN, PERM'FIELD, CURRENT'FIELD ! Get and store the FIELD NUMBER of all PERMANENT FIELD NUMBERS. ! Also, pre-SKIP all fields. ! for X = 1 to FLDCNT ! Here is where we get the current FIELD NUMBER (which can be modified ! by a user in SEDIT) of a of a permanent field ID (Which is the permanent ! field number created when a field is created in ESP). ! xcall GETFID, SCREEN, X, PFLD(X) ! Here, through math, we store the PERMANENT FIELD ID number, of the ! current FIELD NUMBER so that we can use it to SETVAL or GETVAL or ! evaluate expressions based on that situation. ! if PFLD(X) <> 0 CFLD(PFLD(X)) = X xcall SKPFLD, SCREEN, TRUE, X next X ! Allow entry into only PERMANENT FIELDS 1-5 no matter what the user ! has changed them to. ! for X = 1 to 5 xcall SKPFLD, SCREEN, FALSE, PFLD(X) next X CHAR = ESP'BEGLIN ! Set begginning of line. ! Set PERMANENT FIELD 1 as the field we always enter first no matter ! what the user changed the value to by using SEDIT. ! FIELD = PFLD(1) ! Set first field as Permanent field 1 xcall OPNSCR, SCREEN ! Always properly open screen. ! Normal GTSCR processing but always base GETVAL's and SETVAL's ! on PFLD() and CFLD() as needed. (SEE POST'EDIT) ! GTSCR: xcall GTSCR, SCREEN, CHAR, FIELD if (CHAR and 255) = ESP'MENU goto FINISHED if (CHAR and ESP'POSTEDIT) call POST'EDIT if (CHAR and ESP'PREEDIT) call PRE'EDIT if (CHAR and 255) = ESP'EXECUTE call EXECUTE goto GTSCR ! Post Edit situation. ! POST'EDIT: ! First we get the Current permanent field number based upon the current ! FIELD we are POST'EDITing from. This will allow us to get the proper ! variable from the proper string based upon the field's permanent ID ! number so it will always be correct. ! CURNT'PERM'FIELD = CFLD(FIELD) ! POST EDIT process according to Proper PERMANENT field value. ! ON CURNT'PERM'FIELD call PFLD'1, PFLD'2, PFLD'3 , PFLD'4, PFLD'5 return ! Do your own Post editing based upon the permanent field value. ! PFLD'1: PFLD'2: PFLD'3: PFLD'4: PFLD'5: ! Get the proper value from the proper field based upon the current ! field we are editing offset by the proper PERMANENT field. ! xcall GETVAL, SCREEN, PFLD(CURNT'PERM'FIELD), X$ ! Set the proper value from the proper field based upon the current ! field we are editing offset by the proper PERMANENT field. xcall SETVAL, SCREEN, PFLD(CURNT'PERM'FIELD+PER'OFF), X$ return ! Could be similar to above. ! PRE'EDIT: return EXECUTE: ! Get values from permanent fields 1-5 and set them in permanent fields ! 7-11 (Note Fields 7-11 are used instead of 6-10 because when I created ! the GETFID.SCR I used permanent field 6 for something esle, thus ! permanent field 6 does not follow permanent field 5 for the situation ! I have created. The next permanent field after permanent field 5 that ! this program will be using is permanent field 7. The user can change the ! FIELD NUMBER to what they want and the correct values will always be ! set in the proper fields. ! X will equal the permanent field values. for X = 1 to 5 xcall GETVAL, SCREEN, PFLD(X), X$ ! Get permanent field value. xcall SETVAL, SCREEN, PFLD(X+PER'OFF), X$ ! Set permanent field. next X return FINISHED: xcall CLSSCR, SCREEN ! Always properly close screen. xcall INITRM ! De-initialize terminal. END FETCH'ERROR: xcall ERRDSP, "FETCH ERROR - "+STR(X) return ! Referenced in SYSSTD.BSI ! ERR'ROUTINE: xcall ERRDSP, "Program Error - ERROR # "+STR(ERR(0)) end