home *** CD-ROM | disk | FTP | other *** search
- 'Name: Finput()
- 'Purpose: This function creates a screen input same as
- ' smart 3.1 but tracks the function keys pressed these
- ' Function keys are in a variable $key also the text
- ' input is updated to variable $textvar. After
- ' using the function finput() test for $key and
- ' write $textvar to your use variable.
- ' Note: this function must be loaded in memory
- ' prior to its use.
-
- 'Example: finput(row,column,forground,background,length)
- ' finput(10,15,10,0,8)
- ' This would give input at row = 10, column = 15
- ' forground = 10, background = 0, and length = 8
-
-
- ''VARIABLE NAME DECLARATIONS
- public $text[1,10] finput(5)
- PUBLIC $key,$cl,$rw,$fg,$bg $clmax $array# $arraymax $textvar
- PUBLIC $clmin $length
- LOCK module public
- 'END DECLARATIONS
-
- function finput($rw,$cl,$fg,$bg,$length)
- quiet on
- redimension $text[1,$length]
- let $cl = $cl
- let $arraymax = $length
- let $clmin = $cl
- let $clmax = $cl + $length
- let $array# = 1
- let $textvar = null
- let $key = null
- screen clear box $rw $cl $rw $clmax $fg $bg no-border
- f1help off
-
- label askkey
- locate $rw $cl 1
- let $key = inchar
-
- if $key >= {f1} and $key <= {f10}
- jump writeit
- elseif $key = {enter} or $key = {esc}
- jump writeit
- elseif $key = {bs}
- if $clmin < $cl
- let $cl = $cl -1
- screen clear box $rw $cl $rw $cl $fg $bg no-border
- error off
- let $text[1,$array#] = null
- let $array# = $array# -1
- let $text[1,$array#] = null
- end if
- jump askkey
- elseif $key < {space} or $key > {~}
- jump askkey
- else
- if $cl < $clmax
- screen print $rw $cl $fg $bg chr($key)
- let $cl = $cl+ 1
- else
- beep 2
- end if
- if $array# < $arraymax + 1
- let $text[1,$array#] = str(chr($key))
- let $array# = $array# +1
- end if
- jump askkey
- end if
-
- label writeit
- for $array# = 1 to $length
- let $textvar = $textvar|$text[1,$array#]
- end for
-
- end function