Chinaunix首页 | 论坛 | 博客
  • 博客访问: 502791
  • 博文数量: 114
  • 博客积分: 5022
  • 博客等级: 大校
  • 技术积分: 1355
  • 用 户 组: 普通用户
  • 注册时间: 2006-08-09 18:01
文章分类

全部博文(114)

文章存档

2012年(1)

2011年(3)

2010年(1)

2009年(16)

2008年(23)

2007年(39)

2006年(31)

我的朋友

分类:

2006-09-09 09:30:58

'*********************************************************
' 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
阅读(1362) | 评论(0) | 转发(0) |
0

上一篇:bht8000.src

下一篇:Child Menu 菜单选定界面

给主人留下些什么吧!~~