Input mask & auto-tab

B

Brian

I have a text box for entering a time. It defaults to the current time. The
intent is that the user keys in just four numbers (24-hour format) for the
current time, and it then auto-tabs to the next control.

Input mask: 00:00;0;_
Auto-tab: True
Default value: Format(Time(),"Short Time")

However, the auto-tab works only when the time in the box (at the point
where the user enters the box to type in the time) has all four characters.
If the current hour has two digits (10:00 - 23:49), then it works. If the
current hour has only a single digit (0:00 - 9:59), then it does not work,
regardless of what time the user keys into the box.

Evidently, this has something to do with the fact that, when the box already
has four characters, the hour/minute separator colon is in the correct
(third) position for the input; however, when the hour in the box is a single
digit, the colon is in the second position and never appears into the third
position as the user types; it simply disappears. This, in turn, seems to
prevents the input mask & therefore auto-tab from functioning.
 
B

Brian

Thank you, Dirk.

Let me clarify. I don't think it is coming from the default value, per se.
Regardless of the default value, the value in the box when I enter the box
determines whether the auto-tab works or not.

If the control displays fewer than four digits in the time when I enter the
control to enter the time, the ":" separator and "_" placeholder never appear
while typing, and it does not auto-tab after the fourth character. I can
press Tab manually, and it fulfills the Input Mask, though. For example, if
I manually type "0132" in the box, then Tab to the next control, it then
displays "1:31". If I then click or Shift-Tab back to the control and type
"0141", the ":" and "_" from the input mask never appear.

However, if I type "1052" in the control, it (correctly) displays "10:52".
If I then click or Shift-tab to the control and type "0141", the ":" and "_"
appear in the correct places, and it it auto-tabs after the fourth character.

I had already tried setting the Format property of the box to hh:nn, but it
simply converts that to Short Time, which leaves out the leading zero when I
input anything before 10:00.

Having said all of this, I just went into the Windows Reginal and Language
Options -> Regional Options tab -> Customize -> Time tab and changed the Time
format from h:mm:ss tt to hh:mm:ss tt. This forced the leading zero to be in
my control with Short Time format, but it still does not quite explain why
the input mask & auto-tab did not function quite correctly without it set
this way.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Time format hh:nn drops leading zero 0
Paragraph numbering in Word 1
Input Mask 2
Remove input mask format 4
Input Mask - quick question 6
date+time input mask 3
Setting time input mask 4
Input mask 2

Top