!DISCLAIMER:
       !  The following program was made in the USA at Gunite Corporation.
       !  It is not for sale.  Gunite Corporation makes no gaurantee implied
       !  or otherwise that this program will work.  User takes full
       !  responsbility of the results it may produce.
       !
       !ACCOMPLISHMENTS:
       !
       !  1.  The user keys in data, presses the return key.
       !  2.  The user keys in data, positions the mouse at the next field
       !      to edit and clicks.
       !  3.  The user doesn't key in data, positions the mouse at the next
       !      field to edit and clicks.
       !  4.  The user doesn't key in data and presses the return key.
       !
       ! MOUSE.WKS translated MOUSE.MAP
       ! MOUSE.RTN translated MOUSE.COM
++INCLUDE WKS:CURTME.WKS
++INCLUDE WKS:MOUSE.WKS

       MAP1 SYEAR,             F,6
       MAP1 QUOTE'NUMBER,      S,5,"55555"
       MAP1 VENDOR'NUMBER,     S,4,"4444"

       MAP1 STR'ENTRY,         S,10
       MAP1 DSP'STRING,        S,10

       MAP1 FIELD1,S,2
       MAP1 FIELD2,S,2
       MAP1 FIELD3,S,2

               ON ERROR GOTO HARD'ERROR
               ?TAB(-1,0)

               CALL CUR'TIME           ! In house routine to get current
                                       !  date and time
               SYEAR=CUR'YEAR

               !
               ! Determine if terminal is a GUI terminal
               CALL INIT'HOT'SPOT      ! Refer to Peter Winters MOUSE.COM

               FIELD1="1" : FIELD2="2" : FIELD3="3"

               ! Define the hot spots.
               ! "{" is used to decern a mouse click from the user pressing
               ! the return key.  It must be before the first carriage return
               ! and can be any character the programmer wants, but should
               ! be uniquie.
               HOT'SPOT(1) ="030102"+"{"+CHR(13)+FIELD1+CHR(13)
               HOT'SPOT(2) ="050102"+"{"+CHR(13)+FIELD2+CHR(13)
               HOT'SPOT(3) ="070102"+"{"+CHR(13)+FIELD3+CHR(13)

               CALL SET'HOT'SPOT       ! Refer to Peter Winters MOUSE.COM
               ?TAB(3,1);: ? USING "1) ##",SYEAR
               ?TAB(5,1);: ? USING "2) \XXX\",QUOTE'NUMBER
               ?TAB(7,1);: ? USING "3) \XX\",VENDOR'NUMBER
       PROMPT:
               ! UCRT is a product of UltraSoft Corporation
               ! According to Peter Winter INFLD, which is a product of
               ! MicroSabio, will work also.  I have yet to prove it.
               !
               ! Definition of fields in UCRT
               !  ROW,COL,TYPE - STRING INPUT, MIN SIZE, MAX SIZE,
               !   FLAGS - WHAT TO DO ON ENTRY, INPUT FIELD NAME,
               !    CODE - RETURN GIVEN ex up arrow etc
               !
               ! The maximum size of the field is one chracter greater to
               ! facilitate the special character we're using.
       DSP1:
               STR'ENTRY=SYEAR USING "#Z"
               ?TAB(3,4);:? USING "\\",STR'ENTRY
               XCALL UCRT,3,4,"*",1,3,"",STR'ENTRY,CODE

               CALL CHECK'MOUSE
               IF MOUSE'SW=0 SYEAR=VAL(STR'ENTRY) &
                  : ?TAB(3,4);:? USING "##",SYEAR &
                  : goto DSP2

               IF DSP'STRING="" goto DSP1A
               SYEAR=VAL(DSP'STRING)
       DSP1A:
               ?TAB(3,4);:? USING "## ",SYEAR
               IF STR'ENTRY=FIELD1 goto DSP1
               IF STR'ENTRY=FIELD2 goto DSP2
               IF STR'ENTRY=FIELD3 goto DSP3
           goto DSP1
       DSP2:
               STR'ENTRY=QUOTE'NUMBER
               ?TAB(5,4);:? USING "\XXX\",STR'ENTRY
               XCALL UCRT,5,4,"*",1,6,"",STR'ENTRY,CODE

               CALL CHECK'MOUSE
               IF MOUSE'SW=0 QUOTE'NUMBER=STR'ENTRY USING "#####" &
                  : ?TAB(5,4);:? USING "\XXX\",QUOTE'NUMBER &
                  : goto DSP3

               IF DSP'STRING="" goto DSP2A
               QUOTE'NUMBER=STR'ENTRY USING "#####"
       DSP2A:
               ?TAB(5,4);:? USING "\XXX\",QUOTE'NUMBER
               IF STR'ENTRY=FIELD1 goto DSP1
               IF STR'ENTRY=FIELD2 goto DSP2
               IF STR'ENTRY=FIELD3 goto DSP3
           goto DSP2
       DSP3:
               STR'ENTRY=VENDOR'NUMBER
               ?TAB(7,4);:? USING "\XX\",STR'ENTRY
               XCALL UCRT,7,4,"*",1,5,"",STR'ENTRY,CODE

               CALL CHECK'MOUSE
               IF MOUSE'SW=0 VENDOR'NUMBER=STR'ENTRY USING "####" &
                  : ?TAB(7,4);:? USING "\XX\",VENDOR'NUMBER &
                  : goto ENDIT

               ?TAB(7,4);:? USING "\XX\",VENDOR'NUMBER
               IF STR'ENTRY=FIELD1 goto DSP1
               IF STR'ENTRY=FIELD2 goto DSP2
               IF STR'ENTRY=FIELD3 goto DSP3
           goto DSP3
       ENDIT:
               CALL CLEAR'HOT'SPOT
               ?TAB(23,1);SYEAR;
           END
++INCLUDE RTN:CURTME.RTN
++INCLUDE RTN:MOUSE.RTN
       CHECK'MOUSE:
               MOUSE'SW=0
               STRING'THERE=0
               STRING'THERE=INSTR(1,STR'ENTRY,"{") ! See if our special
                                                   ! character is in the string
               XCALL STRIP,STR'ENTRY
               CSTR=LEN(STR'ENTRY)                 ! Obtain number of characters
                                                   ! are in the string.
               IF STRING'THERE=>1 goto CHK'MSE1    ! Mouse Click or Return?
           return
       CHK'MSE1:
               ! Mouse Click
               MOUSE'SW=1
               !
               ! If our special character is the first character of the
               ! string, the user didn't key in any data and our character
               ! overlayed part of the string.
               !
               ! If our specail character isn't the first character, the
               ! user keyed in information and clicked the mouse to advance
               ! to another field so we'll strip off the special character
               ! and put the results in DSP'STRING
               IF STRING'THERE=1 DSP'STRING="" else &
                  : DSP'STRING=STR'ENTRY[1,(CSTR-1)]
               !
               ! Another input statement is needed to handle the second
               ! carriage return we defined while setting up the Hot Spots.
               ! The "O" is overlay.  It's needed.
               XCALL UCRT,23,1,"*",1,10,"O",STR'ENTRY,CODE
           return

       HARD'ERROR:
               CALL CLEAR'HOT'SPOT
       END