It’s about TextField’s Mask

The following Mask (example): code ###-####[/code] is nice as a developer.

But, as a user, when you enter a bunch (5, 10 , 100…) brand new Records with Phone numbers, the Delete (Backward Delete) Key(s) are not usable to change a Phone number.

Selecting ONE digit at a time is what can be done.

What can also be done is to clear the field and type a brand new number, but experience show this is not a REAL good idea. Imagine you are entering all Doctors in New Yord: the leftmost digits are the same… Other cases exists.

Is there a different solution ?

Seperate Fields for the Number and the Prefix?

In France, phone numbers are 10 digits (only for domestic calls, not int’l).

I can use 10 PopupMenus with 10 Rows (0~9), but this may be boring at use. :wink:

Sure … and i can think of dozends even more boring ways to handle Number input :wink:

Don’t apply a mask for format… just limit input to numbers, and format it AFTER the user has entered it…

Dave:
How do I replace “##-##-##-##-##” by * ?

I am using an application I built with 2013r4 (why so old ?) that do not have this limit: I can select two digits and change them; the mask there is for an SQLDate (####-##-##).

I cannot say more because I do not have memory to run Xojo right now to look at what mask did I used 5 years ago… (I am watching TV and downloading with Firefox… and I had to quit the Finder to be able to do that on a 8 GB laptop.).

Thanks.

  • “99-99-99-99” ?

I wrongly understand a digit (I used 0) may do that, and I trashed the idea.

remove it completely… leave it blank

add a KEYDOWN event to reject anything that isn’t a number. you can also limit the length in the same event

Thanks Dave, I still had the Mask in my head and do not understand.

I will try tomorrow (it’s 1h07 (night), a bit late for coding (but not for downloading: it does not need too many brain % time to do downloadings) ;).

Have a nice day all.

I’ve done that months ago in a DB oriented project to reject some characters from user Listbox Headings I took as db column names…

Something like

If InStr(Char_Var,"0123456789") <> 0 Then Char_Var = "" End If

I forgot the environment, but it certainly was in a loop that scan the original string (I also had the 26 alphabet characters I do not need here in my original project).

I DL’ed a class a year or so ago by Tim Parnell called “iPhone Field” which I use in 2 of my apps (with credit given of course) and it works very nicely for my desktop apps. Don’t remember where I found it, but I can send you a copy if you wish.

This was the solution: I was able to select two digits and replace them with two other digits (or same too)…

Of course, in a date entering field, you still be allowed to enter a wrong month (or day) number, but for a Phone # it is OK.