Data Access Worldwide Knowledge Base
Article ID 1998 Article Title HOWTO: Test if user pressed Alphanumeric key in numeric window Article URL http://www.dataaccess.com/kbasepublic/kbprint.asp?ArticleID=1998 KBase Category VDF (GENERAL) Date Created 04/15/2004 Last Edit Date 04/19/2004
Article Text
QUESTION:
If a user presses an alphanumeric key in a numeric window (form_datatype is set to a value between 0 and 8), can I be informed of this?
ANSWER:
You can trap the KEY procedure. If the keyvalue is below 255 it is a value from the ASCII table. Values above 255 are functionkeys.
This is an example of how you can implement that:
Object oForm1 is a Form
Set Size to 13 85
Set Location to 41 95
Set Form_DataType to 0
//AB-StoreStart
Procedure Key Integer iKeyVal
Integer iDecSep
Get_Attribute DF_DECIMAL_SEPARATOR To iDecSep
If (iKeyVal >= 48 And iKeyVal <= 57 Or iKeyVal = iDecSep Or iKeyVal > 255) Begin
Forward Send Key iKeyVal
End
Else Begin
Send Info_Box "Numeric values only!"
End
End_Procedure // Key
//AB-StoreEnd
End_Object // oForm1
Contributed By:
Vincent Oorsprong
Company: Data Access Worldwide
email: vincent.oorsprong@dataaccess.eu
Web Site: http://www.dataaccess.eu
Email this Article
Email this Article to a Colleague
Send Feedback on this Article to Data Access Worldwide
Copyright ©2010 Data Access Corporation. All rights reserved.
The information provided in the Data Access Technical Knowledge Base is provided "as is" without warranty of any kind. Data Access Corporation disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. In no event shall Data Access Corporation or its suppliers be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages, even if Data Access Corporation or its suppliers have been advised of the possibility of such damages. Some states do not allow the exclusion or limitation of liability for consequential or incidental damages so the foregoing limitation may not apply.