home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PROGRAMS / UTILS / TECLADO / FINPUT.ZIP / FINPUT.PF3 next >
Encoding:
Text File  |  1990-03-12  |  2.2 KB  |  77 lines

  1. 'Name:                    Finput()
  2. 'Purpose:                 This function creates a screen input same as
  3. '                         smart 3.1 but tracks the function keys pressed these
  4. '                         Function keys are in a variable $key also the text
  5. '                         input is updated to variable $textvar. After
  6. '                         using the function finput() test for $key and
  7. '                         write $textvar to your use variable.
  8. '                         Note: this function must be loaded in memory
  9. '                         prior to its use.
  10.  
  11. 'Example:                  finput(row,column,forground,background,length)
  12. '                          finput(10,15,10,0,8)
  13. '                          This would give input at row = 10, column = 15
  14. '                          forground = 10, background = 0, and length = 8
  15.  
  16.  
  17. ''VARIABLE NAME DECLARATIONS
  18. public $text[1,10] finput(5)
  19. PUBLIC $key,$cl,$rw,$fg,$bg $clmax $array# $arraymax $textvar
  20. PUBLIC $clmin $length
  21. LOCK module public
  22. 'END DECLARATIONS
  23.  
  24. function finput($rw,$cl,$fg,$bg,$length)
  25. quiet on
  26. redimension $text[1,$length]
  27. let $cl       = $cl
  28. let $arraymax = $length
  29. let $clmin    = $cl
  30. let $clmax    = $cl + $length
  31. let $array#   = 1
  32. let $textvar  = null
  33. let $key      = null
  34. screen clear box $rw $cl $rw $clmax $fg $bg no-border
  35. f1help off
  36.  
  37. label askkey
  38. locate $rw $cl 1
  39. let $key = inchar
  40.  
  41. if $key >= {f1} and $key <= {f10}
  42.      jump writeit
  43. elseif $key = {enter} or $key = {esc}
  44.      jump writeit
  45. elseif $key = {bs}
  46.     if $clmin < $cl
  47.         let $cl = $cl -1
  48.         screen clear box $rw $cl $rw $cl $fg $bg no-border
  49.           error off
  50.           let $text[1,$array#] = null
  51.           let $array# = $array# -1
  52.           let $text[1,$array#] = null
  53.     end if
  54.    jump askkey
  55. elseif $key < {space} or $key > {~}
  56.    jump askkey
  57. else
  58.    if $cl < $clmax
  59.       screen print $rw $cl $fg $bg chr($key)
  60.       let $cl = $cl+ 1
  61.    else
  62.       beep 2
  63.    end if
  64.    if $array# < $arraymax + 1
  65.      let $text[1,$array#] = str(chr($key))
  66.      let $array# = $array# +1
  67.    end if
  68.    jump askkey
  69. end if
  70.  
  71. label writeit
  72.    for $array# = 1 to $length
  73.       let $textvar = $textvar|$text[1,$array#]
  74.    end for
  75.  
  76. end function
  77.