Applying mask to text field

The LR states:

In my experience, that is not correct. Applying that mask to a textArea REQUIRES the user to begin by typing a “(”. Otherwise a system beep is issued.
How can I create a mask or format the input so that the user can enter nothing but numbers and the output will be (555) 121-2121?

I have make a test with a simple window a textfiled and in the open event i put this TextField1.Mask="(###) ###-####"
Working ok with results (234) 342-4323…
Try by code?

Loannis, you’re saying that you do NOT have to start by typing “(” first. You can just type 2343424323 and you get the correct results entered in the textfield?

Yes i put only numbers

Mac or Win?

On mac el capitan 10.11.5
and last xojo

Then can anyone explain to me why my textfield with me.Mask = “(###) ###-####” in the open event requires me to type “(” before accepting any other input? Also 10.11.5 and Xojo 2016r1.1

Ok i have reproduce the error you get.
If you run the app for first time is working,after you must put the “(” to work…

One solution i have test
In my window open event and working perfect.

TextField1.Mask="##########" TextField1.Format= "(###)###\\-####"

The format property of the Textfield is the key. I haven’t got it working to my satisfaction yet, but using format without the mask is the right track. I think the documentation is incomplete or just wrong on this.

You can use the mask, but in order to restore the initial state you need code, e.g., in the TextChange event:

if me.Text="" then me.Text="(" // the fixed character(s) at the beginning of me.mask me.SelStart=Len(me.Text) me.SelLength=0 end if