home *** CD-ROM | disk | FTP | other *** search
-
- ' Amazingly enough, here is another modification of the input.arc file
- ' and the input2.arc files found on Genie.
-
- ' I wrote the original INPUT.ARC and it has since been greatly enhanced by
- ' Mr. Grainger. I downloaded his version and made a few more changes
- ' to it (and the way some things work).
-
- ' It is called with:
-
- ' sub getin(tp$,ulc%,numonly%,mxl%,x1%,y1%,ntp$,ab$) static
-
- ' tp$ - Default string to display (may be left blank)
- ' ulc% - 1 to force uppercase - 0 to leave as typed
- ' numonly% - 1 to force numbers only - 0 for alphanumeric
- ' mxl% - max. # of characters for input ( <75 )
- ' x1% - row to start (if a 0 is put here, the position is of the last print)
- ' y1% - column to start (if a 0 is put here, the position is of the last print)
- ' TO USE A '0' ABOVE : Locate x,y:print "Input : ";:call getin ....
-
- ' ntp$ - code retured
- ' ab$ - string returned (edited string returned to calling program)
- '
- ' Uses FASTPRT by Dave Evers to print status line (change to print if you don't have it)
- ' (Daves' programs are GREAT, well worth buying)
- '
- ' Files QBINPUT.ARC (this file) and Input.ARC uploaded by:
-
- ' Jeff Goza
- ' PO Box 6401
- ' Abilene, Tx 79608-6401
- ' 915-692-9461
- ' Genie Mail : J.GOZA
- ' CSERVE : 75056,3555
-
- ' File Input2.ARC uploaded by:
- '
- ' Garrett Grainger, Jr.
- ' 8145 Swaps Way
- ' Lake Park, Florida 33418-6034
- ' 305-627-8348
- '
- ' Mail to: G.Grainger
-
- ' example call getin("Sample Txt",0,0,16,5,10,ntp$,ab$)
- ' produces "Sample Txt" on row 5,column 10
- ' with the cursor under the S in Sample - will accept 16 characters
- ' and allow alphanumeric input. The string will return in upper/lower case
- ' If ESC is pressed, the entry is cleared, and
- ' you may reenter the information
-
- ' The INS key toggles OW (overwrite) and INS (Insert) modes
- ' OW types over current entries, INS inserts characters
-
- ' **********************
- ' There must be other QuickBasic programmers out there (you downloaded this.)
- ' I would like to hear from you. Ideas? Complaints? Questions? let me know.
- ' **********************
-
- sub getin(tp$,numonly%,ulc%,mxl%,x1%,y1%,ntp$,ab$) static
-
- if x1%=0 then x1%=csrlin ' set for current location
- if y1%=0 then y1%=pos(0)
-
- zl$=tp$
- IF LEFT$(TP$,2)=" " THEN ZL$=""
- eflag1%=1 'insert mode on
- nc=mxl% 'max # chars
- char$=chr$(95):ul=ulc% ' char$ = "_" - change as you wish
- numonly=numonly%
- IF zl$="" THEN
- locate x1%,y1%:print STRING$(NC,char$)
- eflag1%=0 '******** edit - overwrite switch INS on now
- end if
-
- locate x1%,y1%:print zl$:diff=mxl%-len(zl$)
- locate x1%,y1%+len(zl$):print string$(diff,char$)
-
- CURRENT=1:bx=x1%:by=y1%
- ab$=""
- a=0
- if zl$="" or zl$=" " then goto stall
- if len(zl$)<>nc then goto stall
-
- stall:
- ab$=INKEY$
-
- IF ab$<>"" THEN A=ASC(RIGHT$(ab$,1))
- call capscheck(eflag%,nim$,cap$,ike$)
- if len(ab$)=2 then
- if right$(ab$,1)="Q" then NTP$="Q":goto done2:
-
- '************ processes PgUP and PgDn keys and returns an I or Q
- ' check if len(ab$)=2 and ntps$="I" for processing.
- ' exits input routine
-
- if right$(ab$,1)="I" then ntp$="I":goto done2
- if right$(ab$,1)="R" and eflag%=1 then eflag%=0:goto stall
- if right$(ab$,1)="R" and eflag%=0 then eflag%=1:goto stall
- end if
-
- if eflag1%=1 and eflag%=1 and ab$<>"" and ab$<>chr$(13) then
- eflag1%=0
- end if
-
- ' ************** Toggle for the insert Key
-
- if eflag%=0 and ab$<>"" then eflag1%=1
-
- if ab$=chr$(27) then ' clears entry
- zl$="":current=1
- locate bx,by:print string$(mxl%,95);
- goto stall
- end if
-
-
- select case ab$
- case "G" to "K","M","O" to "S"
- a=0
- case ""
- goto update
- case else
- a=a
- end select
-
- select case a
- case 72,73,80 to 82
- goto update:
- case 13
- locate x1%,y1%+current-1:print " ":GOTO done
- case 79
- locate x1%,y1%+current-1:print MID$(zl$,CURRENT,1)
- CURRENT=LEN(zl$)+1
- GOTO update:
- case 83
- if current>len(zl$) then goto update:
- if current<=len(zl$) then
- zl$=left$(zl$,current-1)+right$(zl$,len(zl$)-current)
- PAD=NC-LEN(zl$)
- PAD$=STRING$(PAD,char$)
- locate x1%,y1%:print zl$+pad$
- CURRENT=CURRENT
- GOTO update:
- end if
-
- case 71
- locate x1%,y1%+len(zl$):print char$;
- locate x1%,y1%+current-1:print MID$(zl$,CURRENT,1);
- CURRENT=1
- GOTO update:
-
- case 75
- if CURRENT=<1 THEN GOTO UPDATE:
- if current>len(zl$) then_
- locate x1%,y1%+len(zl$):print char$;
- if CURRENT>1 THEN CURRENT=CURRENT-1:GOTO update:
- case 77
- if CURRENT>LEN(zl$) THEN goto update
- if CURRENT<NC THEN CURRENT=CURRENT+1:GOTO update:
- case 8
- if current=1 then goto update:
- if CURRENT>1 THEN
- zl$=LEFT$(zl$,CURRENT-2)+RIGHT$(zl$,LEN(zl$)-CURRENT+1)
- PAD=NC-LEN(zl$)
- PAD$=STRING$(PAD,char$)
- locate x1%,y1%:print zl$+pad$;
- CURRENT=CURRENT-1
- GOTO update:
- end if
- case else
- a=a
- end select
-
- locate x1%,y1%+current-1:print MID$(zl$,CURRENT,1);
-
- IF LEN(ZL$)>=NC AND EFLAG%=0 THEN
- call snd
- GOTO update
- end if
-
- IF CURRENT>NC THEN
- CALL SND
- GOTO UPDATE
- END IF
-
- IF NUMONLY=1 AND ab$="." THEN goto t185
- IF NUMONLY=1 AND ab$<"0" OR NUMONLY=1 AND ab$>"9" THEN
- call snd
- GOTO update
- end if
- t185:
- t1=len(zl$)+1
- if current=t1 then eflag%=0 'turn on insert mode, end of line
- if eflag%=0 then zl$=LEFT$(zl$,CURRENT-1)+ab$+RIGHT$(zl$,LEN(zl$)-CURRENT+1)
- if eflag%=1 then mid$(zl$,current,1)=ab$
- locate x1%,y1%:print zl$;
- CURRENT=CURRENT+1
-
- Update:
- locate x1%,CURRENT+y1%-1,1,4,7
- A=0
- GOTO stall:
- Done:
- templ=nc-len(zl$)
- locate x1%,y1%+len(zl$):print string$(templ+1," ");
- locate x1%,y1%:print zl$;
- numonly=0
- if ulc%=1 then call upperlower(zl$,re$):zl$=re$
- call strip(zl$,ntp$)
- Done2:
- locate bx,by:print zl$;:ab$=zl$
- end sub
-
- '************ Capscheck queries the keyboard for the status of the caps,num,shift
- ' and INS keys.
-
- sub capscheck(eflag%,nim$,cap$,ike$) static
- 'returns spaces if not on, letters if on
-
- DEF SEG=0
- v$=date$
- CAP$=" "
- nim$=" "
- if eflag%=1 then ike$=" OW"
- if eflag%=0 then ike$="INS"
- IF PEEK(&H417) AND 64 THEN CAP$="CAPS"
- IF PEEK(&H418) AND 64 THEN CAP$=" "
- IF PEEK(&H417) AND 32 THEN NIM$="NUM"
- IF PEEK(&H418) AND 32 THEN NIM$=" "
- IF (PEEK(&H417) AND 2) OR (PEEK(&H417) AND 1) THEN CAP$="CAPS"
- IF (PEEK(&H418) AND 2) OR (PEEK(&H418) AND 1) THEN CAP$=" "
- call fastprt(" "+IKE$+" "+NIM$+" "+CAP$,25,1,7)
- end sub
-
- ' *** Upper/Lower case conversion - 1 for uppercase 0 for as entered ***
-
- sub upperlower(in$,out$) static
-
- out$=in$
- for y=1 to len(in$)
- ch$=mid$(in$,y,1)
- ac=asc(ch$):if ac>96 and ac<123 then new$=chr$(ac-32):mid$(out$,y,1)=new$
- next y
- end sub
-
- '************** strips trailing blanks from entries.
- ' used as call strip(sending string to strip,returned stripped string)
-
- sub strip(rax$,clean$) static
- FOR SS=1 TO len(rax$)
- IF MID$(rax$,SS,2)=" " THEN Rax$=LEFT$(Rax$,SS-1):exit for
- NEXT SS
- clean$=rax$
- end sub
-
- '************** Used instead of beep for error notification.
- 'used as "call snd"
-
- sub snd static
- SOUND 1000,1:SOUND 1500,2:SOUND 500,1
- end sub
-