home *** CD-ROM | disk | FTP | other *** search
/ Amoszine 10 / Amoszine 10 (Disk 3 of 3).adf / Amos_Procs.lha / Xinput.proc / Xinput.amosSourceCode
Encoding:
AMOS Source Code  |  1991-12-03  |  1.0 KB  |  51 lines

  1. Procedure XINPUT[XX,X,Y,PN,BG]
  2.    ' By John Smit 
  3.    ' Used to gain greater control over the input into a program.
  4.    ' xx = The maximum number of characters that can be input
  5.    ' X/Y = Location where Text is Printed 
  6.    ' pn = colour to print in  
  7.    ' bg = Background colour 
  8.    ' String returned to veriable Param$ 
  9.    '
  10.    If XX<1 Then Pop Proc
  11.    Clear Key 
  12.    Locate X,Y
  13.    Paper BG
  14.    Cline XX
  15.    Pen PN
  16.    X1=X
  17.    '  
  18.    Z=0
  19.    Z$=""
  20.    Curs On 
  21.    Repeat 
  22.       X$=""
  23.       If Z<>XX Then Curs On 
  24.       While X$=""
  25.          X$=Inkey$
  26.       Wend 
  27.       Curs Off 
  28.       SC=Scancode
  29.       If SC=65 or SC=70
  30.          If Len(Z$)<>0
  31.             Z$=Left$(Z$,(Len(Z$)-1))
  32.             Dec Z
  33.             Dec X1
  34.             Print At(X,Y)+Z$+" "
  35.             Locate X1,Y
  36.          End If 
  37.       End If 
  38.       If Asc(X$)>31 and Asc(X$)<127 and Z<XX
  39.          Z$=Z$+X$
  40.          Inc Z
  41.          Inc X1
  42.          Print At(X,Y)+Z$
  43.          Locate X1,Y
  44.       End If 
  45.    Until Asc(X$)=13
  46.    Curs Off 
  47. End Proc[Z$]
  48. '
  49. ' example
  50. XINPUT[5,5,5,5,8]
  51. Print At(1,1)+Param$