Function FilterKeyDown(ByVal hWndControl As Dword,ByVal chCharCode As Long,ByVal NoMinusSign As Byte,ByVal NoDecimal As Byte) As Byte
Dim tmpResult As Byte
tmpresult=%true
Select Case chCharCode
Case 48 To 57 'Number
tmpResult=%false
Case 8 'BackSpace
tmpResult=%false
Case 13 'Enter
tmpResult=%false
Case Asc(".") 'Decimal
If NoDecimal=0 Then
If CheckCharExsit(chCharCode,hWndControl)=%false Then
tmpResult=%false
End If
End If
Case Asc("-")
If NoMinusSign=0 Then
If CheckCharExsit(chCharCode,hWndControl)=%false Then
tmpResult=%false
End If
End If
Case 127 'Del
tmpResult=%false
Case 28 To 31 'Arrow Key
tmpResult=%false
Case 27 'Esc
tmpResult=%false
End Select
Function=tmpResult
End Function
檢查重複的小數點及負號
Function CheckCharExsit(ByVal hWndControl As Dword,ByVal chCharCode As Long) As Byte
Local intX As Integer
Local tmpResult As Byte
Local tmpText As String
tmpresult=%false
tmptext=FF_TextBox_GetText( hWndControl )
If Len(tmpText) >0 Then
For intX = 1 To Len(tmpText)
If Chr$(chCharCode) = Mid$(tmpText, intX, 1) Then
tmpResult = %True
Exit For
End If
Next
End If
Function = tmpresult
End Function