'*********************************************************
' GET STRING FROM KEY OR SCAN
'*********************************************************
Function fGetkey$(Max%,strType$)
s$=""
While 1
Key$=Input$(1)
Beep ,,,0
Select Key$
Case Chr$(27) 'ESC
fGetkey$=Chr$(27)
Exit Function
Case Chr$(13) 'ENTER
If s$<>"" Then
fGetkey$=s$
Exit Function
End If
Case Chr$(8) 'BACKSPACEE
If Len(s$) Then
Print Chr$(8);
s$=Left$(s$,Len(s$)-1)
End If
If Len(s$)=0 Then
fGetkey$=Chr$(28)
Exit Function
End If
Case Chr$(24) 'CANCEL
While Len(s$)
Print chr$(8); 'CHR$(24) WILL CLEAR ALL
s$=Left$(s$,Len(s$)-1)
Wend
fGetkey$=CHR$(28)
Exit Function
Case Chr$(65)
If cur%=0 Or cur%=1 Or cur%=5 Then
fGetkey$=Chr$(65)
Exit Function
End If
Case Chr$(68)
If strType$<>"" And ModiQTY%=1 Then
Call sbModify$(strType$,"")
fGetkey$=CHR$(68)
Exit Function
End If
Case Else 'OTHER
If Len(s$) Print Key$;
s$=s$+Key$
End If
End Select
Wend
End Function
Function fGetstring$(Max%,scan$,strType$)
sc$=scan$
While 1
If sc$="1" Then 'SCAN
Open "BAR:" as #16 CODE "A","M","N","I","K","L","H"
Wait 0, 3 'Wait SCAN PORT
If Loc(#16) Then
Beep
s$=Input$(Max%,16)
fGetstring$=s$
Print s$;
Close #16
Exit Function
Else
Close #16
sc$="0" 'SCAN FILE FAIL,READ KEY
End If
End If
If sc$="0" Then 'KEYBOARD
s$=fGetKey$(Max%,strType$)
If s$<>Chr$(28) Then
fGetstring$=s$
Exit Function
Else
sc$=scan$
End If
End If
Wend
End Function
阅读(1405) | 评论(0) | 转发(0) |