gettingstarted
[Top] [All Lists]

RE: Single Key entry ( was: masking)

To: gettingstarted at lists dot realsoftware dot com
Subject: RE: Single Key entry ( was: masking)
From: "Lennox Jacob" <lenpartico at hotmail dot com>
Date: Fri, 25 Feb 2005 01:52:18 +0000
Delivered-to: gettingstarted at lists dot realsoftware dot com
Yes Terry,Thanks very much. This is what I wanted.
Thanks again.
Lennox.

From: Terry Ford <tmford at shaw dot ca>
Reply-To: Getting Started <gettingstarted at lists dot realsoftware dot com>
To: Getting Started <gettingstarted at lists dot realsoftware dot com>
Subject: Single Key entry ( was: masking)
Date: Thu, 24 Feb 2005 11:32:45 -0800

If you wish to force the user to enter a "0" before any single number keypress (for the numbers 6 to 9), Joe's solution will work. If, on the other hand, you wish any number in a single keypress to be entered then other steps must be taken. The following code will work. A string property must also be added to remember the first keypress. Let's name it aKey As String.

In a Right aligned editfield (Looks nicer :-) :

Function KeyDown(Key As String) As Boolean
   If me.SelStart=0 then
      aKey=Key
      Return False // This will save the first keypress
   End if

   If me.SelStart=1 and val(aKey+Key) >59 Then
      Beep
      Return True // If the number is greater than 59 it will be blocked.
   End If
End Function

This will allow you to Tab, Delete and enter 6 to 9 or 06 to 09 but not allow 60+.

Just an option. :-)

Terry Ford

PS. There's a bug in Windows 2000 and XP that allows the characters x,c and v to be entered in a "##" mask. The workaround here would be to *not* use the mask and simply "LimitText" the editfield to two characters.

<http://www.realsoftware.com/feedback/viewreport.php?reportid=zpmdgzzk>


On 24-Feb-05, at 9:58 AM, Joseph J. Strout wrote:

At 5:38 PM +0000 2/24/05, Lennox Jacob wrote:

One little problem, after inputting the data and it gets accepted, I cannot Tab to the next EditField, or delete.

When in this state, put a breakpoint on the first line of the KeyDown event, then Resume your app, and Step through the code to see what's going on.

You probably just need to make the if-test more specific, i.e., change

  Key >= "6"

to

  Key >= "6" and Key <= "9"

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>