Time Mask for a TextField

I want to set a TextField as a Time (HH:MM:SS) field.

So, I tried to set a mask of “00:00:00”, but I get a beep, and two dates in the TextField.

BTW: this is not related to date, think Duration instead (probably only minutes and seconds, but who knows, one hour can be set, one day).

Help is needed here. TIA.

Xojo 2019r3.1 (if this matters).

what about “CC:CC:CC” ?

Thank you Jean-Yves.

Xojo do not like it: it beeps.

Is the Mask Property is located at:
Vaidation Mask

What I want to do is to write 2:35 to say the song duration is 2 minutes and 35 seconds. I am not sure for the "CC:CC:CC"…

Here is another way. Since you are starting from a date object (it would be the same with a datetime object), you could do something like:

textfield.text = str(myDate.hour)  + ":" + str(myDate.minute) + ":" +str(myDate.second)

I would create a small method that extends the date or datetime object to do it so that I don’t have to type the whole thing multiple times in the application. Something like this:

HHMMSS (extends N as Date) as string Dim T as string T = format(N.hour, "00") + ":" + format(N.minute, "00") + ":" +format(N.second, "00") return T

then it would be as simple as textfield.text = myDate.HHMMSS

Hi Louis,

thank you for the help, but it is a matter of Duration (length of a song or music).

As I wrote above (just before you sent your entry), I want to write 2:35 (and read it 2 minutes and 35 seconds).

you tried 99:99:99

Hi Markus,


Curious, I just tried “9999-99-99” to test the mask as I know it works in API1. But, no, it does not works in API2 (Xojo 2019r3.1). I only get beeps when I type a number.


I set that mask in another TextField, and it react the same (except tehe quote character): beeps everywhere !

i test this validation mask at a new desktop project with r3.1 and windows 10
it make only bling if input is wrong or all places are filled.

your input is correct in other textbox? caps lock/num lock key?

The only thing I do not tested is Paste (macOS).

I rebooted on High Sierra (from El Capitan); I will make more tests in few minutes.

yes of course… I read the exact opposite. Oh well. back to the cave.

No Louis, go to the Park and get a bit of sun !

Back from 10.13.6 (17G65) test: beep all along.

Xojo 2019r3.1 fresh install.

i can test it tomorrow on my mac mini if it beeps there.

It is pure hazard that I hear the beeps. Usually, the sound is off here (mainly because of Xojo and I do not want to wake up someone, when I use my computer in the middle of the night).

The problem is Xojo reject my numbers from the keyboard :wink:

I found the solution: do not place quotes !

BUT: 9999-99-99 works fine while 99:99:99 do not.

That explain why I got no beep and I get the quote when I type the quote key on the keyboard !

And here is what I got (instead of a Duration):

0021/10/2001 18:0021/10/2001 18:00

For this mask: 00:00:00

The following Mask behave differently; maybe the solution (inspired from the ~ entry in the LR):

Wheres my hat ? I am hungry.