Timebox update: -command option
Sun Mar 30 13:34:12 CDT 2008
I added a -command option to [timebox]. The argument to
-command is a script to which the new time is appended. The time is
expressed as seconds since the epoch. This script is executed whenever the
timebox is used to change the time. Notice in the demo that the printout
only occurs when the bottom timebox is used.
This feature is by request of Peter Turner. Thanks! I don't know why I
didn't think of this myself.
Timebox, a Tcl/Tk time entry widget
Sun Jul 01 19:00:35 CDT 2007
Timebox is a time entry "megawidget"
for Tcl/Tk. It's a bit different from the
average megawidget in that it is in fact just a spinbox, rather
than a bunch of widgets packed into a frame. At any
rate, it facilitates entry of time and date, and it supports many of the
same field format codes as [clock].
Timebox requires Tcl/Tk 8.5a6. You may need to download and build the
latest CVS.
Neat features:
-
Text entry. Typing in a time value works fairly naturally.
Typing is destructive, overwriting text already present. Backspace
works like the left arrow key.
-
Spinner entry. The up and down arrows and the spinner buttons
increment and decrement the currently selected field, so you can easily
advance through days, months, and years.
-
Linked variables. A timebox can be linked to procedures or other
widgets via linked variables. Linked variables can be numeric (seconds
since 1970) or textual (formatted time string). This linkage works
both ways; setting the linked variable will update the timebox as well.
-
Copy and paste. Copy and paste work. Pasted text replaces text
already in the timebox widget.
-
Validation. The time is constantly validated. No keypress
which would result in an invalid time is allowed. Somehow timebox
manages to do this without being annoying, and anyone who has had
experience with key validation knows that's an impressive feat.
The most important feature is timebox supports date entry as well as
time-of-day entry.