Paradox Community

Items in pnews.paradox-programming

Subject:Re: Move to to Library
Date:Mon, 3 Dec 2018 04:23:23 -0500
From:"Kevin Baker" <shcsbaker@gmail.com>
Newsgroups:pnews.paradox-programming
Hi Leslie,

This application is a membership database, so 99.99% of the records would 
not have this style of phone number.  In my review of the error.log for 
several different customers, I've noticed there are many "invalid character" 
errors on the phone fields.  My guess is with the many different sizes 
keyboards come in people are having a difficult time hitting just the 
numbers.

Kevin

"Leslie"  wrote in message news:5c048825$1@pnews.thedbcommunity.com...

Hi Kevin,

Assuming I am reading this correctly, then it appears you are limiting
the input to: 0 to 9 - space and ().

If I have got that wrong then ignore the rest of this reply, but if not.....

can I ask why you are not allowing a value such as 1300-TAXI in the
phone number field. These sorts of phone numbers are very common in
Australia and it is simple to convert a valid character to a number
should you ever need to dial-out.

Either way, forgive any ignorance as I am very weak in Paradox coding
nowadays.
Leslie.


On 1/12/2018 8:38 PM, Kevin Baker wrote:
> Hi Everyone,
>
> In a phone field I have the following code:
>
> =====================================================
> method keyChar(var eventInfo KeyEvent)
>
> var
>   curChar string
> endvar
>
> curChar = eventInfo.char()
>
> switch
>   case curChar >="0" and curChar <="9"      :
>   case curChar = "-" or curChar = " "             :
>   case curChar = "(" or curChar = ")"         :
>   case curChar = "VK_RETURN"                 :
>   case curChar = "VK_TAB"                        :
>   otherwise                                                :
> disableDefault return
> endSwitch
> endMethod
> =====================================================
>
> This works PERFECT, however, I'd like to move this code to a existing
> library (and a library I already open on init or the form).  Here's the
> updated code on the form:
>
> =====================================================
> method keyChar(var eventInfo KeyEvent)
>
> lib.ckPhone(eventInfo.char())
> endMethod
> =====================================================
>
> And this is the code in the library
> =====================================================
> method ckPhone(x string)
>
> switch
>   case x >="0" and x <="9"    :
>   case x = "-" or x = " "         :
>   case x = "(" or x = ")"        :
>   case x = "VK_RETURN"            :
>   case x = "VK_TAB"                :
>   otherwise                        : disableDefault return
> endSwitch
> =====================================================
>
> I'm getting a error on the disableDefault (message in status bar reads:
> Error: Cannot use EVENT statement in this context)
>
> Any ideals of how to work around this?  In a nutshell, when the code is
> on the field if the user presses any key not listed, nothing happens, no
> beeps, no error messages, which is what I need.  I'm just trying to move
> this code into a library so I can reuse on other forms.
>
> Thanks,
> Kevin

---
This email has been checked for viruses by AVG.
https://www.avg.com 


Copyright © 2004 thedbcommunity.com