TIP: Click on subject to list as thread! ANSI
echo: power_bas
to: ALL
from: CHARLES GODARD
date: 1997-07-11 00:41:00
subject: Input$ function 1/4

'                    In-func.Bas
'                 By Charles Godard
'                     Delhi, La
'                  August 6, 1996
'       Coded for Qbasic, QuickBasic, and PDS
'This is a program to illustrate a use for the inpfun$.
'It allows entry of several hundred characters to be
'entered and stored in a string, while limiting the
'area of displayed text to the length specified, by
'scrolling the input within the visible area.
'Pass it:
'a buffer as a default string to be displayed
'Visible is the length of the visible string to be displayed
'Max is the maximum length of the buffer variable
'Exit code passes the selected function key out of the function;
'it can be changed to pass whatever is needed, and it can also be
'used to pass a parameter into the function.. if needed.
'Attr is the color of the string to be displayed &h..bg..fg
'Attr.. pass in hex.. bg-fg..
 '1st hex digit contains bg & intensity..
 '2nd hex digit contains fg & blink
 'bg = 0-7 basic colors.. add 8 for hi-intensity
 'fg = 0-7 basic colors.. add 8 for blink --
DEFINT A-Z
DECLARE FUNCTION inpfun$ (Buffer$, Visible, Max, attr, ExitCode)
SCREEN 0
CLS
COLOR 7, &H1: CLS :
RESTORE Message
FOR i = 8 TO 25: READ x$: Cnt = Cnt + 1: LOCATE , 10: PRINT x$: NEXT
Cnt = 0
'Parameters to pass to inpfun:
Row = 20: Col = 20: Visible = 35: Max = 100: attr = &HC2
DIM Instring$(2)
Instring$(0) = "Visible can be up to 80 characters.  Max can be "
Instring$(1) = "several hundred or maybe several thousand characters. "
Instring$(2) = "I did not fully test it. Depends on string space      "
'end of passed parameters
COLOR 10, &HC
FOR i = LBOUND(Instring$) TO UBOUND(Instring$)
 LOCATE Row + Cnt, Col: PRINT LEFT$(Instring$(i), Visible)
 Cnt = Cnt + 1
NEXT i
Cnt = 0
LOCATE Row, Col
DO
 Buffer$ = Instring$(Cnt)
 Instring$(Cnt) = inpfun(Buffer$, Visible, Max, attr, ExitCode)
 IF ExitCode = -72 THEN Cnt = Cnt - 1 ELSE Cnt = Cnt + 1
 IF Cnt > UBOUND(Instring$) THEN Cnt = UBOUND(Instring$)
 IF Cnt < LBOUND(Instring$) THEN Cnt = LBOUND(Instring$)
 LOCATE Row + Cnt, Col
LOOP UNTIL (ExitCode = -45)
LOCATE Row - 1, Col - 6:
PRINT "Demo display of 1st 55 chars of each stored string:>";
COLOR 3, 9:
Cnt = 0
FOR i = LBOUND(Instring$) TO UBOUND(Instring$)
 LOCATE Row + Cnt, 17, 0: PRINT LEFT$(Instring$(i), 55)
 Cnt = Cnt + 1
NEXT i
COLOR 11, 9
LOCATE Row + Cnt, 17: PRINT "Whole string is passed back to program."
END
Message:
DATA"                    Inpfun.Bas                           "
DATA"                By Charles Godard                        "
DATA"                  August 6, 1996
DATA"Here is a sample of how you could use this input function"
DATA"to make a  data entry screen.   Alt-X  quits the  program"
DATA"                                                         "
DATA"Editing Keys:                                            "
DATA"    Ctl-Lt/Rt arrow..  Ctl-A..  Ctl-F  =  Word Left/Right"
DATA"    Home..  End..  Ctl-Home..  Ctl-End.. Up/Dn arrow.. CR"
DATA"    Insert or Ctl-R toggles Insert  &  affects  backspace"
DATA"    Ctl-B and Backspace key both will backspace          "
DATA"    Esc restores the default string,  Atl-X quits program"
DATA"    Hi ascii characters are enabled.  Try Alt-171 for 1/2"
DATA"                                                         "
DATA"    You can edit the  'Valid'  string$ and restrict input"
DATA"    to the type of string$ input that you need.   You can"
DATA"    control the length of the  visible display and length"
DATA"    of the editing string,  and the  position on  screen."
úÿ [ Continued In Next Message... ]
...
 þ SPEED 2.00 #2781 þ ... Growing old is mandatory; growing up is optional!!
--- Telegard/QWK v3.02
---------------
* Origin: The Circle Circus * Dale City, VA * 703-730-3115 (1:265/124)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.