!*************************** AMUS Program Label ******************************
! Filename: VUESCR.BAS                                      Date: 01/12/89
! Category: UTIL         Hash Code: 050-206-101-400      Version: 1.1(1)
! Initials: GR/AM        Name: JAMES A. JARBOE IV
! Company: EDUCATIONAL FILMSTRIPS & VIDEO          Telephone #: 4092955767
! Related Files: VUESCR.M68, VUESCR.INC, WINDOW.M68
! Min. Op. Sys.: 1.0                           Expertise Level: BEG
! Special: Use VUESCR.SBR, WINDOW.SBR, VUESCR.INC
! Description: Demonstrates the usage of VUESCR.SBR and WINDOW.SBR
! The VUESCR.INC file will NOT be destroyed by this program
!
!*****************************************************************************
!
! VUESCR.BAS how to use VUESCR.SBR
! by James A. Jarboe IV, GR/AM  (409) 295-5767
!
! Original 20-Feb-86
! Updated  12-Jan-89
!
! Be sure to get the following files from AMUS
!
!               VUESCR.M68 - Assembly subroutine listing
!               VUESCR.BAS - Basic program listing
!               VUESCR.INC - Help file that VUESCR.bas uses
!               WINDOW.M68 - Draws pretty boxes
!
! VUESCR.SBR (by James A. Jarboe) is an inhanced version of VUE.SBR
! by Dave Pallman
! VUESCR.SBR allows editing of text in a VUE like fashion
! Hope it helps someone else
!
!        XCALL VUESCR,ST,ROWS,COLUMNS,START'ROW,START'COL,{Rtncde}
!
!  ST       =  variable string to input or change
!              I map it as ARRAY(?) to make access easier
!              although just using the ST as the variable will work just as well
! ROWS      =  the maximum amount of rows you choose to use
! COLUMNS   =  the maximum amount of columns you choose to use
! START'ROW =  the row that you wish the editing to begin on.
! START'COL =  the column that you wish the editing to begin on.
! Rtncde    =  the value of ^T or ^R, only if Rtncde is added on the XCALL
!              line and is binary and is the 6th variable. If Rtncde is not
!              used then ^T or ^R will not exit the subroutine nor will
!              the values be displayed. Rtncde will also return the value
!              of escape & ^C if Rtncde is used
!
! ESCAPE    : the escape key gets you out of the VUESCR.SBR editing mode and
!           : returns the string ST with the changes you have made
!
! ^C        : Control C will also get you out of VUESCR.SBR and not abort
!           : the basic program
! ^T        : Will exit the subroutine if Rtncde is used
! ^R        : Will exit the subroutine if Rtncde is used
!
! EXTRA  -   Using START'ROW, START'COL, ROWS, and COLUMNS for your ? TAB
!            Statements makes movement of the editing area easier than changing
!            everything.
!
! 02/23/86
! WINDOW.SBR by James A. Jarboe IV draws an alternate set graphics window
! according to dimensions
!
!       XCALL WINDOW, START'ROW, START'COL, COLUMNS, ROWS
!
!       START'ROW   = Row number you want corner of window to start on
!       START'COL   = Column number you want left vertical side to be on
!       COL'LONG    = number of columns wide you want window to be
!       ROW'LONG    = number of rows deep you want window to be
PROGRAM VUESCR,1.1(1)

MAP1 ST                 ! make string length as long as you want
   MAP2 ARRAY(20),X,77 ! easier way to get at ST
                       ! this string is 1,540 bytes long
                       ! If you use X variable (unformatted) you can
                       ! clear the variable to nulls so that *'s will
                       ! show on the screen
MAP1 ROWS,F,6,20        ! maximum number of rows you want to have
MAP1 COLUMNS,F,6,77     ! maximum number of columns per row that you want
MAP1 START'ROW,F,6,1    ! what screen row you want to start display at-1
MAP1 START'COL,F,6,1    ! what screen col you want to start display at-1
MAP1 COL'LONG,F
MAP1 ROW'LONG,F
MAP1 RTNCDE,B,2         ! Rtncde used by VUESCR to show value of key

CLEAR'SCREEN:
       ? tab(-1,0);
!
! VUESCR.INC is a short descriptive file that shows how to use VUESCR
!
       OPEN #1,"VUESCR.INC",INPUT
LOOP:
       I=I+1
       IF I>ROWS THEN GOTO EDIT
       INPUT LINE #1,ARRAY(I)
       IF EOF(1)=1 THEN GOTO EDIT
       GOTO LOOP
EDIT:
       CLOSE #1
EDIT2:
       ? TAB(-1,0);
       XCALL WINDOW,2,1,79,22
       START'ROW=3
       START'COL=2
! here it is the infamous VUESCR.SBR
VUE:
!
! Try using the XCALL VUESCR with RTNCDE and see the results on a ^T & ^R
! Then try using the XCALL VUESCR without the RTNCDE
!
    XCALL VUESCR, ST,ROWS,COLUMNS,START'ROW,START'COL
!   XCALL VUESCR, ST,ROWS,COLUMNS,START'ROW,START'COL,RTNCDE


DO'AGAIN:

       IF RTNCDE>0 ? TAB(1,4);"RTNCDE is ";RTNCDE;
       if RTNCDE=18 THEN GOTO CTRL'R
       IF RTNCDE=20 THEN GOTO CTRL'T
       ? TAB(1,20);
       INPUT LINE "Would you like to re-edit the string ?",Y$
       ? tab(1,4);TAB(-1,9);
       IF UCS(Y$[1;1])="Y" THEN GOTO EDIT2
       ? TAB(-1,0);"Hope this helps someone !!!!"
END

CTRL'R:
       ! You could reload the ARRAY with the previous ?? lines here
       GOTO VUE
CTRL'T:
       ! You could reload the ARRAY with the next ?? lines here
       GOTO VUE
END