widget::calendar

Introduction to ::widget::calendar

A graphical calendar widget to select a date. Usable with mouse and keyboard. Current version 1.0.1.

Documentation: https://core.tcl.tk/tklib/doc/trunk/embedded/www/tklib/files/modules/widget/widget_calendar.html


WikiDbImage widget_calendar.png
Screenshot of the calendar widget and the dateentry

Questions/Remarks

  • Is it possible to "drive" this widget without using a mouse? I didn't see any key bindings...
    • LV I do not see any bind commands in the code for keyboard shortcuts
    • hae 2009-09-26 bindings are there. See CVS.
      • Up/Down move week
      • Right/Left move day
      • Control-Right/Left move month
      • Control-Up/Down Move year
      • Home jump to current date
  • Did a few tests with -textvariable. The coupling didn't seem to work (changes in the var are not reflected and vice versa)...?
    • I tried the following:
$ tclsh8.6
% package require widget::calendar
0.91
% set t [widget::calendar -textvariable ::a .t]
unknown subcommand "-textvariable": namespace ::widget::calendar does not export any commands
% set t [widget::calendar .t -textvariable ::a]
.t
% pack .t
% set ::a 9/25/2009
9/25/2009
% puts $::a
09/21/2009
% puts $::a
09/26/2009
% set ::a 10/10/2010
10/10/2010
% 

When I clicked on different days on the widget, $::a changed value. HOWEVER, as you noticed, when I change the text variable, the widget does not change. Sounds like time for a bug report.

hae 2009-09-25 Added traces to watch the changes of -textvariable. Grab the latest version from CVS.

MHo After teacup update I did a new test. The required trick is to give a ::globalvar with -textvariable. Otherwise it won't work. I still see no keyboard bindings, though...

hae 2009-10-22 This is not a trick. It is common with all widgets that have a -textvariable option. see entry Keyboard bindings are there you need to give the focus to the widget (click on it once, then press left or right). But the bindings have a bug that throws a Tcl error. Will fix it tonight.

MHo: With 'trick' I ment that I had to explicitely specify ::. The var already was a global before (without :: notation), since I not used any procs...

hae 2009-10-22 Ah, I see. Fixed the bug with the key bindings and the trick. Don't know when you will see it in teacup but it is in CVS now.

MHo 2009-10-22 Thanx it works now. But I have to include 100-400k of snit code for it to work...

hae 2009-10-23 Bugfix for handling of -textvariables in namespace


kpv 2011-09-03 : it seems the textvariable is not being updated if you used keyboard navigation

hae 2011-11-17 : version 1.00 is available that fixes it and provides a key binding for the home-key to jump to the current date.


See also tklib and widget.