calendar

Purpose: to discuss items known as calendar in the Tcl world.`

Unfortunately, this name is used both as a widget that is part of incr Widgets as well as a package in tcllib.

Iwidgets calendar widget

http://incrtcl.sourceforge.net/iwidgets/iwidgets/calendar.gif

Docs for the iwidgets widget can be found at http://incrtcl.sourceforge.net/iwidgets/iwidgets/calendar.html and http://purl.org/tcl/home/man/iwidgets3.0/calendar.n.html

GWM Note that the iwidgets calendar uses the same date formula as used by Unix. This uses a 4 byte integer to specify seconds since 1900 (or 1901 maybe). Attempts to move a calendar widget beyond 2037/38 results in the integer overflowing, and the calendar fails, sometimes catastrophically (this is trapped in the iwidgets code so that the year cannot pass 2037). This needs to be addressed in the next 24 years, in the short term a calendar does not need second precision (time does of course). So I think best would be to use 2 variables - the day (from which year can be derived)and seconds of day (perhaps with millisecond or microsecond precision). Both these values could be held in 4 byte integers, with year resolution up to 5,800,000 CE and better than 1 millisecond time resolution. The day can be used to infer the year, and from the year the first day (Mon-Sun) of January is simply found. Then a calendar can easily be constructed for any month (allowing for leap years).


http://tkfp.sourceforge.net/calendar.jpg

Alex Caldwell I was using the iwidgets calendar for a project which required entering patient's birth dates into a GUI form. The default iwidgets calendar seemed to only increment by months, which is very inconvenient when you need to increment it backwards to like 1925. I did not see an option for changing the increment interval. So I made a modification to the iwidgets calendar.itk file that allows you to use a small drop down menu to reset the increment interval to months, years, or decades. In the image above, it is set to Y which stands for years. So the blue arrow buttons will now increment the calendar date in 1 year jumps. Thus you can increment backwards to 1925 in only about 15-20 clicks instead of 75-100 clicks. What an improvement! :-) You can get the modified calandar.itk file from [1 ] I only tested it on Iwidgets 3.1.0, so I don't know if it will work on later versions. The file goes in the scripts directory of the Iwidget library file and would replace the stock version there. Be sure to keep a backup copy of your original file.


Tcllib calendar module

The tcllib group of modules contains some calendar support code (but that code is no longer installed as part of the standard tcllib install process due to being deprecated and out of date). It does not have any reference docs.

tcllib calendar module has a number of calendar printing functions, similar to the unix "cal" command. Despite the name of this page, it is not actually part of the tcllib. Well, yes and no. The code IS a part of the tcllib source code distribution. It is not, however, currently installed, and so one won't find it in , say, a Batteries Included distribution unless someone does something special for it. A recent message on the tcllib mailing list says that the tcllib calendar module has been abandoned as the functionality was moved into the Tcl 8.5 core.

Other occurrences of calendar in the Tcl community

BLT comes with a calendar example and efftcl has a calendar example. BLT comes with a calendar example? Where would that be found? LV Look in BLT's examples directory - it is called calendar.tcl .

Miscellaneous discussions

MHo: Long time ago I experimented with this widget, and if I remember right, there was a lack of international support in that only the day or the month names could be changed (don't remember exactly...). I find it confusing for german users to present Mo, Th, We... etc.

MHo Where can I find the documentation for widget::calendar?

JH At http://docs.activestate.com/activetcl/8.5/tklib/widget/widget_calendar.html

MHo Sorry, what I really meant was this: Is there a page on this wiki discussing that widget... I already found the doc in my local 8.5 help... I had some questions regarding this widget, which I had posted now at widget::calendar.

hae See the screenshot at hae


See also: