Time entry
Josh Mellicker
josh at dvcreators.net
Tue Feb 23 00:12:10 EST 2010
Here is a text entry field so that a user can enter a time in a field in a "shorthand" and get a full, properly formatted date out of it.
Here are some examples:
enter this = get this
1 = 1:00 PM
12 = 12:00 PM
123 = 1:23 PM
1234 = 12:34 PM
add an "a" at the end for am, like:
1a = 1:00 AM
We have been using this for a few years and everyone really likes it, it seems intuitive and faster than any other method of entering a time.
field script:
ON enterInField
convertTime
END enterInField
ON returnInField
convertTime
END returnInField
ON closeField
convertTime
END closeField
put this somewhere in the message path:
ON convertTime
put the text of the target into t
IF (char -1 to -2 of t = "am") OR (char -1 of t = "a") THEN
put "AM" into ampm
ELSE
put "PM" into ampm
END IF
REPEAT for each char c in t
IF c is a number THEN put c after t2
END REPEAT
SWITCH
CASE the number of chars of t2 < 3
put ":00" after t2
break
CASE the number of chars of t2 = 3
put char 1 of t2 & ":" & char 2 to 3 of t2 into t2
break
CASE the number of chars of t2 = 4
put char 1 to 2 of t2 & ":" & char 3 to 4 of t2 into t2
break
END SWITCH
put space & ampm after t2
put t2 into the target
END convertTime
On Feb 22, 2010, at 10:21 AM, Peter Haworth wrote:
> Thanks Scott. The clock face is certainly the most familiar for users and does take up less real estate. I haven't entirely discounted it but I feel it doesn't lend itself very well to time entry on a computer. It really needs two hands for it to be the familiar clock face we're all used to (which I'm guessing would complicate the code quite a bit) and clock faces in general don't differentiate between AM and PM times. I guess that's why I'm leaning more towards the slider approach - certainly less familiar than a clock face but feels very comfortable nonetheless and I think I can find the real estate. I'll probably implement it as a small button (maybe looking like a clock!) that will popup a window with the sliders in it.
>
> Either way, thanks a lot for the code.
>
> Pete Haworth
>
>
>
> On Feb 22, 2010, at 10:00 AM, use-revolution-request at lists.runrev.com wrote:
>
>> From: Scott Rossi <scott at tactilemedia.com>
>> Subject: Re: Time entry
>> To: How to use Revolution <use-revolution at lists.runrev.com>
>> Message-ID: <DA31EFFE-AB54-4F3B-B216-ABFA4A60C516 at tactilemedia.com>
>> Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes
>>
>> Hi Pete:
>>
>> FWIW, if you have a small amount of real estate for the time entry
>> control, a clock face is a lot more efficient than a slider.
>> Regardless, yes 48 is the number of 15 minute intervals. The other
>> thing you may need to adjust is the width of the slider base graphic
>> -- it's currently wide enough to evenly accommodate tick marks for the 48 intervals.
>>
>> Regards,
>>
>> Scott Rossi
>> Creative Director
>> Tactile Media, UX Design
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list