home *** CD-ROM | disk | FTP | other *** search
- ;----------------------------------------------------------------------------
- ; Copyright(C) 1996, The AEGiS Corporation
- ;----------------------------------------------------------------------------
- ;
- ; FUNCTION InputLine()
- ;
- ; Inputs a line at specified coordinates, with optionnal default line and
- ; auto upcase
- ;
- ; value returned: the line entered by the user
- ;
- ; inputLinecontrol retains a control code uppon keys used to exit :
- ;
- ; ENTER = 0
- ; ESC = 1
- ; UP = 2
- ; DOWN = 3
- ;
- ;----------------------------------------------------------------------------
- #lib
- Declare Function InputLine(Integer Col, Integer Row, Integer StrLen, String DefaultStr, String CharsAllowed, Boolean ConvertToUpcase) String
- Integer InputLineControl
-
- ;----------------------------------------------------------------------------
- Function InputLine(Integer Col, Integer Row, Integer StrLen, String DefaultStr, String CharsAllowed, Boolean ConvertToUpcase) String
-
- Integer il_L
- String il_Line
- String k
-
- InputLineControl = 0
- AnsiPos Col, Row
-
- Print "@X0B"+DefaultStr
- il_L = Len(DefaultStr)
- il_Line = DefaultStr
-
- While (True) Do
- k = Inkey()
- If (ConvertToUpcase) k = Upper(k)
- Select Case k
-
- Case Chr(27)
- InputLine = il_Line;""
- InputLineControl = 1
- Break
-
- Case "UP"
- InputLine = il_line;""
- InputLineControl = 2
- Break
-
- Case "DOWN"
- InputLine = il_line;""
- InputLineControl = 3
- Break
-
- Case Chr(13)
- InputLineControl = 0
- InputLine = il_Line
- Break
-
- Case Chr(8)
- If (il_Line <> "") Then
- il_Line = Left(il_Line,len(il_Line)-1)
- Backup 1
- Print "@X0F."
- Backup 1
- Endif
-
- Case Else
- If (Len(il_Line) < StrLen & Len(k) = 1 & Asc(k) > 31) Then
- If (InStr(CharsAllowed, k)) Then
- If (Right(Il_Line,1) = " ") k = Upper(K)
- il_Line = il_Line + k
- Print "@X0B"+k
- If (len(il_Line) = StrLen) Then
- InputLine = il_Line
- Break
- Endif
- Endif
- Endif
-
- End Select
- Endwhile
-
- EndFunc
-