If you are interested in having a textfield that auto formats 10 Digit NANP phone numbers then you might want into this project. I also saw some work related to my project in the past (https://forum.xojo.com/32791-applying-mask-to-textfield-part-deux/0)
This is a custom class that is subclassed from TextField class in order to provide complete filtering and formatting for Phone Numbers (10 Digit NANP Only). The Phone Formatting Textfield will automatically format while the user is typing in their 10 digit phone number. All guardrails have been put into place so users ONLY type in their digits and see a nice formatted output of (XXX)XXX-XXXX automatically.
NOTE: This project in its original state does not support International number support - Only 10 Digit NANP numbers at this point. Feel free to fork this project, extend the code base, and then make a pull request if you would like to contribute.
If you find bugs please open an issues ticket at https://github.com/IntelligentVisibility/PhoneFormattingTextfield/issues.
GitHub Project:
https://github.com/IntelligentVisibility/PhoneFormattingTextfield
Screen Shot:
post photo