Error processing request

Parameters

CONTENT_LENGTH0
REQUEST_METHODGET
REQUEST_URI/revision/A+calendar+Widget?V=47
QUERY_STRINGV=47
CONTENT_TYPE
DOCUMENT_URI/revision/A+calendar+Widget
DOCUMENT_ROOT/var/www/nikit/nikit/nginx/../docroot
SCGI1
SERVER_PROTOCOLHTTP/1.1
HTTPSon
REMOTE_ADDR172.69.6.22
REMOTE_PORT19320
SERVER_PORT4443
SERVER_NAMEwiki.tcl-lang.org
HTTP_HOSTwiki.tcl-lang.org
HTTP_CONNECTIONKeep-Alive
HTTP_ACCEPT_ENCODINGgzip, br
HTTP_X_FORWARDED_FOR3.12.153.31
HTTP_CF_RAY88573833bded61f0-ORD
HTTP_X_FORWARDED_PROTOhttps
HTTP_CF_VISITOR{"scheme":"https"}
HTTP_ACCEPT*/*
HTTP_USER_AGENTMozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; [email protected])
HTTP_REFERERhttp://wiki.tcl.tk/revision/A+calendar+Widget?V=47
HTTP_CF_CONNECTING_IP3.12.153.31
HTTP_CDN_LOOPcloudflare
HTTP_CF_IPCOUNTRYUS

Body


Error

Unknow state transition: LINE -> END

-code

1

-level

0

-errorstack

INNER {returnImm {Unknow state transition: LINE -> END} {}} CALL {my render_wikit {A calendar Widget} **Calendar\ Widget**\n\n***Introduction***\n8\ Feb.\ 2005\ \[Jaf\]\n\nA\ configurable\ calendar\ widget.\n----\nI\ wanted\ to\ configure\ the\ start\ of\ the\ week\ e.g\ Sunday/Monday\ in\ a\ calendar\ and\ ended\ up\ writing\ a\ \nwidget.\ At\ least\ it\ allowed\ me\ to\ learn\ about\ namespaces.\n----\n\n****Example****\n\nFor\ the\ impatient:\n======\n\ \ package\ require\ Tk\n\ \ package\ require\ callib\n\ \ calwid\ .test\n\ \ pack\ .test\n\n\ \ #\ Now,\ here\ are\ the\ error\ msgs\n\ \ .test\ configure\ -foo\n\ \ .test\ bar\n======\n\ or\ a\ \ \[better\ example\]\ :\ \n======\n\nCalling\ the\ widget\ with\ wrong\ arguments\ makes\ it\ complain\ and\ spew\ a\ bit\ of\nhelp.\n\nFor\ Documentation:\ see\ below\n\nNamespace\ stuff\ from\ \[Clif\ Flynt\]'s\ book.\n----\n***Comments***\n\[MAK\]\ Suggests\ using\ labels\ rather\ than\ buttons.\ \ Under\ Aqua,\ there\ are\ no\ groove/flat\ button\ reliefs.\n\n\n\[Jaf\],\ I\ think\ I\ would\ lose\ the\ callback\ capability.\ But\ it\ is\ worth\ looking\ into.\ Thanks.\n\n\n\[MG\]\ If\ you\ switch\ to\ labels,\ I\ think\ you'd\ just\ need\ to\ do\n\ \ label\ \$parent.\$col\$row\ -padx\ 0\ -pady\ 0\ -highlightthickness\ 2\ \;#\ create\ the\ widget\n\ \ bind\ \$parent.\$col\$row\ <Button-1>\ \[list\ callib::callback\ \$parent\ \$col\ \$row\]\ \;#\ bind\ to\ \n\t\t\t\t\t\t\t#\ mouse-click\ for\ the\ callback\nrather\ than\ using\ the\ \[button\]\ as\ you\ do\ now.\n\n\[Jaf\]:\ I\ made\ a\ compromise:\ I\ just\ made\ the\ ''relief''\ a\ configuration\ item.\ I\ think\ this\ should\ be\ OK\ (?)\ Cheers\n\n\[MAK\]:\ Not\ exactly.\ \ What\ I\ meant\ in\ the\ original\ statement\ was\ that,\ even\ if\ you\ configure\ a\ button\ with\ -relief\ flat,\ under\ Aqua\ it\ still\ shows\ up\ as\ a\ normal\ elongated\ round\ 3D\ button,\ not\ flat\ like\ a\ label.\ \ Through\ some\ oddity\ with\ the\ minimum\ size\ of\ the\ buttons\ and\ the\ space\ alloted\ them\ by\ grid,\ there\ are\ other\ artifacts\ that\ make\ it\ just\ look\ wrong.\n\n\[Jaf\]\ OK,\ I\ see\ the\ problem.\ I\ started\ reworking\ the\ widget.\ The\ labels\ make\ it\ a\ bit\ more\ difficult\ to\ implement\ the\nactivebackground\ stuff,\ I'll\ bind\ these\ too\ to\ the\ Enter/Leave\ events,\ that\ should\ be\ OK.\ Cheers.\n\n\[Jaf\]\ 24\ Feb\ 2005:\ changed\ the\ buttons\ to\ labels,\ functionality\ the\ same.\ Should\ be\ right\ under\ Aqua.\ Cheers.\n\n\[Jaf\]\ 03\ March\ 2005:\ Fixed\ a\ bug\ associated\ with\ setting\ the\ background\ color\n\n\[RH\]\ 19\ Oct\ 2005:\ removed\ additional\ characters\ in\ proc\ balloon_show\ that\ caused\ a\ tcl\ error\n\nWouldn't\ it\ be\ better\ to\ use\ the\ tooltip\ package\ of\ tklib\ instead\ of\ reimplementing\ the\ wheel,\ ahem\ tooltip.\n\n\nSee\ also\ \[An\ i15d\ date\ chooser\]\n\n\n\[Jaf\]\ Yes\ I\ had\ a\ look\ at\ it.\ That\ gave\ hints\ on\ how\ to\ do\ things,\ thanks\ a\ lot.\n\n----\n\[LV\]\ Have\ you\ considered\ making\ use\ of\ \[Tile\]\ so\ that\ your\ widgets\ look\ more\ native?\n\n\[LV\]\ A\ nice\ addition\ would\ be\ adding\ the\ code\ (from\ somewhere\ here\ on\ the\ wiki)\ so\ that\ month\ and\ day\ names\ and\ abbreviations\ are\ internationalized\ (or\ is\ that\ localized?),\ etc.\n\n----\n\[ofv\ 27-may-2008\]\ Correction:\ Calls\ the\ callback\ with\ 6\ arguments,\ as\ per\ the\ documentation,\ not\ with\ a\ list\ of\ six\ elements.\n\n----\n***Code***\n\n======\n\ package\ provide\ callib\ 0.3\n\n\ proc\ calwid\ \{args\}\ \{\n\ ##############################################\n\ #\ provides\ api\ for\ creating\ calendar\ widgets\ #\n\ ##############################################\n\ \ \ #\ creation\ of\ the\ widget\n\ \ \ set\ newWidget\ \[\ eval\ callib::MakecalendarWid\ \$args\]\n\n\ \ \ #\ create\ body\ for\ the\ new\ widget\ proc\n\ \ \ set\ newCmd\ \[format\ \{return\ \[namespace\ eval\ %s\ %s\ %s\ \$args\]\}\ \\\n\t\t\t\t\t\ \ \ \ \ callib\ \ \ \ \ \\\n\t\t\t\t\t\ \ \ \ \ calproc\ \ \ \ \\\n\t\t\t\t\t\ \ \ \ \ \$newWidget\ \]\n\ \ \ #\ declare\ new\ proc\ to\ be\ called\ when\ the\ widget\ is\ accessed\n\ \ \ proc\ \$newWidget\ \{args\}\ \$newCmd\n\n\ \ \ return\ \$newWidget\n\ \}\ \;#\ END\ calwid\n\n\ namespace\ eval\ callib\ \{\n\ \ \ \ #\ config\ data\ for\ every\ calwid\ widget\n\ \ \ \ variable\ calState\n\n\ \ \ \ set\ calState(unique)\ 0\n\n\ \ \ \ proc\ MakecalendarWid\ \{args\}\ \{\n\ \ \ \ ##################################\n\ \ \ \ #\ procedure\ to\ create\ a\ calendar\ #\n\ \ \ \ ##################################\n\tvariable\ calState\n\n\t#make\ unique\ name\ per\ default\n\tset\ holder\ .calwid_\$calState(unique)\n\tincr\ calState(unique)\n\t#if\ a\ window\ name\ was\ given\ on\ the\ command\ line\ then\ use\ it\n\t#overwriting\ the\ already\ computed\ name\n\tif\ \{\[string\ first\ \".\"\ \[lindex\ \$args\ 0\]\]\ ==\ 0\}\ \{\n\t\ \ \ \ #\ put\ the\ wanted\ name\ in\ holder\n\t\ \ \ \ set\ holder\ \[lindex\ \$args\ 0\]\ \n\t\ \ \ \ #\ remove\ the\ name\ from\ args\n\t\ \ \ \ set\ args\ \[lreplace\ \$args\ 0\ 0\]\n\t\ \ \}\;#\ END\ window\ path\ given\n\n\t#make\ defaults\ for\ the\ command\ line\ args\n\t#year\n\tset\ calState(\$holder.year)\ \[clock\ format\ \[clock\ scan\ now\]\ -format\ \"%Y\"\]\n\t#month\n\tset\ mon_num\ \[clock\ format\ \[clock\ scan\ now\]\ -format\ \"%m\"\]\n\t#month\ starts\ with\ 0,\ can\ be\ interpreted\ as\ octal\ ->remove\ leading\ 0\n\tset\ mon_num\ \[string\ trimleft\ \$mon_num\ \"0\"\]\n\tset\ calState(\$holder.month)\ \$mon_num\ \n\t#week\ starts\ on\ sunday\ in\ the\ us\ and\ on\ monday\ in\ germany\n\tset\ calState(\$holder.startsunday)\ 0\n\t#font\ defaults\n\tset\ calState(\$holder.font)\ \[list\ Lucidatypewriter\ 12\ normal\]\n\t#day\ names,\ change\ the\ defaults\ to\ the\ language\ needed\n\tset\ calState(\$holder.daynames)\ \[list\ \"So\"\ \"Mo\"\ \"Di\"\ \"Mi\"\ \"Do\"\ \"Fr\"\ \"Sa\"\]\n\t#day\ font\n\tset\ calState(\$holder.dayfont)\ \[list\ Lucidatypewriter\ 12\ bold\]\n\t#command\ registered\ as\ callback\n\tset\ calState(\$holder.callback)\ \"\"\n\t#\ marking\ list\ for\ days,\ a\ mark\ is\ a\ list\ containing\ a\ date\n\t#\ a\ mark\ priority\ and\ a\ mark\ color,\ if\ one\ day\ has\ multiple\ marks\n\t#\ the\ color\ of\ the\ highest\ priority\ is\ shown,\ if\ balloons\ are\ enabled\n\t#\ then\ all\ the\ marks\ texts\ in\ descending\ prio\ order\ are\ shown.\n\t#\ the\ list\ is\ \{day\ month\ year\ prio\ color\ label\}\n\tset\ calState(\$holder.mark)\ \{\}\n\t#\ this\ list\ contains\ the\ marks\ for\ the\ shown\ month\n\tset\ calState(\$holder.shownmarks)\ \{\}\n\t#\ last\ clicked\ gets\ row\ col\ address\ of\ the\ last\ clicked\ button\n\tset\ calState(\$holder.clicked)\ \{\}\n\t#\ last\ clicked\ gets\ the\ color\ of\ clicked\n\tset\ calState(\$holder.clickedcolor)\ \"yellow\"\n\t#\ default\ background\ goes\ here,\ as\ a\ default\ rootwindows\ background\n\t#\ is\ used\n\tset\ calState(\$holder.background)\ \[.\ cget\ -background\]\n\t#\ the\ default\ active\ background\ goes\ here,\ white\n\tset\ calState(\$holder.activebackground)\ \"white\"\n\t#\ progcallback:\ if\ set\ to\ 1,\ setting\ clicked\ will\ invoke\ callback\n\t#\t\ \ \ \ \ \ \ if\ set\ to\ 0,\ setting\ clicked\ will\ not\ invoke\ callback\n\t#\ defaults\ to\ 1\n\tset\ calState(\$holder.progcallback)\ 1\n\t#\ balloons\ containing\ the\ mark\ texts,\ 1\ enabled,\ 0\ disables\n\tset\ calState(\$holder.balloon)\ \ \ \ \ \ 1\n\t#\ set\ the\ delay\ for\ the\ balloon\ here\n\tset\ calState(\$holder.delay)\ \ \ \ \ 1000\n\t#\ set\ the\ relief\ \n\tset\ calState(\$holder.relief)\ \ \ \ groove\n\t#\ set\ the\ relief\ \n\tset\ calState(\$holder.foreground)\ \ \ \ black\n\n\t#\ check\ whether\ options\ are\ valid\n\tforeach\ \{opt\ val\}\ \$args\ \{\n\t\ \ \ \ #\ get\ rid\ of\ leading\ -\n\t\ \ \ \ set\ option\ \[string\ range\ \$opt\ 1\ end\]\ \n\t\ \ \ \ if\ \{!\[info\ exists\ calState(\$holder.\$option)\]\}\ \{\n\t\t#\ create\ oklist\ containing\ the\ possible\ commands\n\t\tregsub\ -all\ \"\$holder.\"\ \[array\ names\ calState\ \$holder.*\]\ \\\n\t\t\t\ \ \ \ \"\"\t\ oklist\n\n\t\terror\ \"Bad\ Option,\ '\$option'\\n\ Valid\ options\ are\ \$oklist\"\n\t\ \ \ \ \ \ \}\;#\ END:\ if\ option\ not\ in\ the\ calendar\ state\ array\n\t\ \ \ \ set\ calState(\$holder.\$option)\ \$val\ \ \n\t\ \ \}\;#\ END:\ foreach\ option\ value\ pair\n\n\t#\ make\ a\ frame\ to\ hold\ it\ all.\ Declare\ the\ class\ as\ being\ Calendar\n\tframe\ \$holder\ -class\ Calendar\ \n\t#\ make\ the\ frames\ innards\n\tDraw\ \$holder\n\t#\ rename\ the\ frame\ to\ give\ the\ widget\ the\ name\ \$holder\n\tuplevel\ #0\ rename\ \$holder\ \$holder.fr\n\t#call\ the\ update\ procedure\ to\ use\ configuration\ options\ given\ at\ start\n\tupdate_cal\ \ \$holder\n\t#\ clean\ up\ after\ destruction\ of\ the\ widget\n\t#\ TODO\ unset\ the\ associated\ array\ elements\ \n\t#\ TODO\ implement\ a\ cleanup\ proc\ to\ take\ care\ of\ cleaning\ up\n\tbind\ \$holder\ <Destroy>\ \"+\ rename\ \$holder\ \{\}\"\n\t#\ return\ the\ name\ of\ the\ new\ widget\n\treturn\ \$holder\n\ \ \ \ \ \ \}\;#\ END\ MakecalendarWid\n\ \ \ \ \n\ \ \ \ proc\ Draw\ \{parent\}\ \{\n\ \ \ \ ###########################################################\n\ \ \ \ #\ this\ proc\ takes\ care\ of\ drawing\ and\ packing\ the\ widgets\ #\ \ \ \ \ \ \n\ \ \ \ ###########################################################\n\tvariable\ calState\n\n\t#\ make\ the\ weekday\ list\n\tset\ weekdays\ \$calState(\$parent.daynames)\n\tif\ \{\$calState(\$parent.startsunday)\ !=\ 1\}\ \{\n\t\ \ \ \ set\ weekdays\ \[roll_left\ \$weekdays\]\n\t\ \ \}\;#\ END\ if\ not\ start\ on\ sunday\ ->\ start\ on\ monday\ \n\t#\ make\ labels\ for\ the\ days\ header\n\tset\ colcount\ 0\n\tforeach\ day\ \$weekdays\ \{\n\t\ \ \ \ set\ daylabel\ \$parent.\$colcount\n\t\ \ \ \ label\ \$daylabel\ \n\t\ \ \ \ grid\ \ \$daylabel\ \ -row\ 1\ -column\ \$colcount\ -ipadx\ 0\ -ipady\ 0\n\t\ \ \ \ incr\ colcount\n\t\ \ \}\;#END:\ foreach\ day\ in\ weekday\ \n\t#\ get\ monthlist\ according\ to\ startsunday\ variable\n\tset\ month\ \$calState(\$parent.month)\n\tset\ year\ \ \$calState(\$parent.year)\n\tset\ monthlist\ \[cal_list_month\ \$month\ \\\n\t\t\t\t\ \ \ \ \ \ \$year\ \ \\\n\t\t\t\t\ \ \ \ \ \ \$calState(\$parent.startsunday)\ \]\n\t#\ make\ the\ buttons\ for\ the\ calendar,\ buttons\ needed\ \n\t#\ as\ there\ will\ be\ commands\ associated\ with\ them\n\t#\ was\ button,\ switched\ to\ labels\ bacause\ buttons\ look\ \n\t#\ ugly\ under\ Aqua,\ callbacks\ &\ activebackground\ implemented\ \n\t#\ via\ bind\n\tfor\ \{set\ row\ 0\}\ \{\$row<6\}\ \{incr\ row\}\ \{\n\t\ \ for\ \{set\ col\ 0\}\ \{\$col<7\}\ \{incr\ col\}\ \{\n\t\ \ \ \ \ \ label\ \$parent.\$col\$row\ -highlightthickness\ 2\ \ \n\t\ \ \ \ \ \ grid\ \$parent.\$col\$row\ -padx\ 0\ -pady\ 0\ -ipadx\ 0\ -ipady\ 0\ \\\n\t\t\t\t\ \ \ \ -row\ \[expr\ \{\$row+2\}\]\ -column\ \$col\ \n\t\ \ \ \ \}\;#END:\ col\n\t\ \ \}\;#END:\ row\n\ \ \ \ \ \ \}\;#\ END:\ draw\ the\ widgets\n\n\ \ \ \ proc\ callback\ \{parent\ col\ row\}\ \{\n\ \ \ \ ###############################################################\n\ \ \ \ #\ this\ procedure\ gets\ called\ whenever\ a\ day\ button\ is\ pressed\ #\n\ \ \ \ ###############################################################\n\tvariable\ calState\n\n\t#\ cleanup\ previously\ clicked\n\tset\ old_col\ \[lindex\ \$calState(\$parent.clicked)\ 0\]\ \ \n\tset\ old_row\ \[lindex\ \$calState(\$parent.clicked)\ 1\]\ \ \n\n\tif\ \{\$old_row\ !=\ \"\"\}\ \{\n\t\ \ \ \ set\ button_name\ \$parent.\$old_col\$old_row\n\t\ \ \ \ \$button_name\ configure\ -background\ \$calState(\$parent.background)\n\t\ \ \}\;#\ END:\ there\ was\ a\ clicked\ button\n\t#\ change\ the\ clicked\ button\ appropriately\n\tset\ calState(\$parent.clicked)\ \[list\ \$col\ \$row\]\n\tset\ button_name\ \$parent.\$col\$row\n\t\$button_name\ configure\ -background\ \$calState(\$parent.clickedcolor)\n\t\$button_name\ configure\ -background\ \$calState(\$parent.clickedcolor)\n\t#\ get\ the\ daynames\ from\ the\ state\ array\n\tset\ namelist\ \$calState(\$parent.daynames)\n\t#\ if\ start\ on\ monday\ roll\ the\ list\ \n\tif\ \{\$calState(\$parent.startsunday)\ !=\ 1\}\ \{\n\t\ \ \ \ set\ namelist\ \[roll_left\ \$namelist\]\n\t\ \ \}\n\t#\ make\ the\ arguments\ for\ the\ user\ defined\ callback\ procedure\ \ \n\tset\ callargs\ \[list\ \$calState(\$parent.year)\t\t\t\ \\\n\t\t\t\ \ \ \$calState(\$parent.month)\t\t\t\\\n\t\t\t\ \ \ \[string\ trimleft\ \[\$parent.\$col\$row\ cget\ -text\]\]\ \\\n\t\t\t\ \ \ \[lrange\ \$namelist\ \$col\ \$col\]\t\t\ \ \ \ \\\n\t\t\t\ \ \ \$col\t\t\t\t\t\ \ \ \ \\\n\t\t\t\ \ \ \$row\]\n\t\t\t\ \ \ \n\t#\ procedure\ name\t\t\ \ \ \n\tset\ procname\ \$calState(\$parent.callback)\n\t#\ if\ there\ is\ something\ registered\ as\ callback,\ call\ it\n\tif\ \{\$procname\ !=\ \"\"\}\ \{\n\t\ \ \ \ eval\ \$procname\ \$callargs\n\t\ \ \}\n\ \ \ \ \ \ \}\n\n\ \ \ \ proc\ update_cal\ \{parent\}\ \{\n\ \ \ \ ##################################################################\n\ \ \ \ #\ this\ proc\ updates\ the\ calendar\ shown\ according\ to\ the\ contents\ #\n\ \ \ \ #\ of\ the\ calState\ array\t\t\t\t\t\ \ #\n\ \ \ \ ##################################################################\n\tvariable\ calState\n\n\t#\ set\ the\ frame\ color\ to\ the\ background\n\t\$parent.fr\ configure\ -background\ \$calState(\$parent.background)\n\t#\ make\ the\ weekday\ list\n\tset\ weekdays\ \$calState(\$parent.daynames)\n\tif\ \{\$calState(\$parent.startsunday)\ !=\ 1\}\ \{\n\t\ \ \ \ set\ weekdays\ \[roll_left\ \$weekdays\]\n\t\ \ \}\;#\ END\ if\ not\ start\ on\ sunday\ ->\ start\ on\ monday\ \n\t#\ update\ labels\ for\ the\ days\ header\n\tset\ colcount\ 0\n\tforeach\ day\ \$weekdays\ \{\n\t\ \ \ \ set\ daylabel\ \$parent.\$colcount\n\t\ \ \ \ set\ day\ \[string\ range\ \$day\ 0\ 1\]\n\t\ \ \ \ \$daylabel\ configure\ -text\ \$day\ -width\ 2\t\t\ \ \ \ \ \ \ \\\n\t\t\t\t-font\ \$calState(\$parent.dayfont)\t\ \ \\\n\t\t\t\t-foreground\ \$calState(\$parent.foreground)\ \\\n\t\t\t\t-background\ \$calState(\$parent.background)\n\t\ \ \ \ incr\ colcount\n\t\ \ \}\;#END:\ foreach\ day\ in\ weekday\ \n\n\t#\ get\ monthlist\ according\ to\ startsunday\ variable\n\tset\ month\ \$calState(\$parent.month)\n\tset\ year\ \ \$calState(\$parent.year)\n\tset\ monthlist\ \[cal_list_month\ \$month\ \\\n\t\t\t\t\ \ \ \ \ \ \$year\ \ \\\n\t\t\t\t\ \ \ \ \ \ \$calState(\$parent.startsunday)\]\n\t#\ make\ an\ array\ with\ the\ day\ as\ index\ and\ the\ buttons\ coords\ as\ value\n\t#\ will\ be\ used\ while\ processing\ the\ marked\ days\n\t#\ first\ delete\ the\ array\n\tcatch\ \{unset\ index_arr\}\n\t#\ fill\ buttons\ with\ the\ stuff\n\tfor\ \{set\ row\ 0\}\ \{\$row<6\}\ \{incr\ row\}\ \{\n\t\ \ for\ \{set\ col\ 0\}\ \{\$col<7\}\ \{incr\ col\}\ \{\n\t\ \ \ \ \ \ set\ text\ \ \[lindex\ \$monthlist\ \[expr\ \{7*\$row+\$col\}\]\ \]\n\t\ \ \ \ \ \ set\ index_arr(\$text)\ \$col\$row\n\t\ \ \ \ \ \ #\ set\ default\ values,\ change\ them\ if\ day\ field\ is\ empty\n\t\ \ \ \ \ \ set\ reliefval\ \$calState(\$parent.relief)\n\t\ \ \ \ \ \ set\ stateval\ \ normal\n\t\ \ \ \ \ \ bind\ \$parent.\$col\$row\ <Any-Enter>\ \[list\ callib::enter_proc\ %W\]\ \n\t\ \ \ \ \ \ bind\ \$parent.\$col\$row\ <Any-Leave>\ \[list\ callib::leave_proc\ %W\]\ \n\t\ \ \ \ \ \ bind\ \$parent.\$col\$row\ <Button-1>\ \ \[list\ callib::callback\ \\\n\t\t\t\t\t\t\ \ \ \ \ \ \ \$parent\t\ \\\n\t\t\t\t\t\t\ \ \ \ \ \ \ \$col\t\ \ \ \ \\\n\t\t\t\t\t\t\ \ \ \ \ \ \ \$row\]\n\t\ \ \ \ \ \ if\ \{\$text\ ==\ \"\"\}\ \{\n\t\t\ \ set\ reliefval\ flat\n\t\t\ \ set\ stateval\ \ disabled\n\t\t\ \ bind\ \$parent.\$col\$row\ <Any-Enter>\ \{\}\n\t\t\ \ bind\ \$parent.\$col\$row\ <Any-Leave>\ \{\}\n\t\t\ \ bind\ \$parent.\$col\$row\ <Button-1>\ \ \{\}\n\t\t\}\;#\ END:\ if\ dayfield\ is\ empty\n\t\ \ \ \ \ \ #\ reconfigure\ the\ button\ \n\t\ \ \ \ \ \ \$parent.\$col\$row\ configure\ -relief\ \$reliefval\ -state\ \$stateval\ \\\n\t\t\t\t\t\ -borderwidth\ 2\t\t\ \ \ \ \ \ \\\n\t\t\t\t\t\ -width\ 2\t\t\t\ \ \ \ \\\n\t\t\t\t\t\ -background\t\t\t\ \\\n\t\t\t\t\t\ \ \ \$calState(\$parent.background)\ \ \ \ \ \\\n\t\t\t\t\t\ -highlightbackground\t\t\\\n\t\t\t\t\t\ \ \ \$calState(\$parent.background)\ \ \ \ \ \\\n\t\t\t\t\t\ -font\ \$calState(\$parent.font)\ \ \ \ \ \ \ \\\n\t\t\t\t\t\ -text\ \[format\ \"%2s\"\ \$text\]\t\ \ \\\n\t\t\t\t\t\ -justify\ center\t\t\ \ \ \ \ \\\n\t\t\t\t\t\ -foreground\t\t\t\ \\\n\t\t\t\t\t\ \ \ \$calState(\$parent.foreground)\n\t\ \ \ \ \}\;#END:\ col\n\t\ \ \}\;#END:\ row\n\t#\ check\ if\ there\ is\ a\ clicked\ day\ &\ update\ the\ color\ according\ to\ \n\t#\ calstate\ array\n\tset\ col\ \[lindex\ \$calState(\$parent.clicked)\ 0\]\ \ \n\tset\ row\ \[lindex\ \$calState(\$parent.clicked)\ 1\]\ \ \n\tif\ \{(\$row\ !=\ \"\")\ &&\ (\$col\ !=\ \"\")\}\ \{\n\t\ \ \ \ \$parent.\$col\$row\ configure\ -background\ \\\n\t\t\t\t\t\ \$calState(\$parent.clickedcolor)\n\t\ \ \}\n\t#\ check\ if\ there\ are\ days\ in\ the\ marked\ list\ that\ are\ displayed\n\t#\ right\ now\ and\ mark\ them\n\t#\ put\ the\ needed\ part\ of\ mark\ list\ into\ the\ shownmarks\ list\n\tset\ calState(\$parent.shownmarks)\ \{\}\n\tforeach\ Mlist\ \$calState(\$parent.mark)\ \{\n\t\ \ \ \ foreach\ \{Mday\ Mmonth\ Myear\ Mpri\ Mcol\ Mlabel\}\ \$Mlist\ \{\}\n\t\ \ \ \ if\ \{\$Myear\ ==\ \$calState(\$parent.year)\}\ \{\n\t\tif\ \{\$Mmonth\ ==\ \$calState(\$parent.month)\}\ \{\n\t\t\ \ \ \ lappend\ calState(\$parent.shownmarks)\ \$Mlist\n\t\t\ \ \}\n\t\ \ \ \ \ \ \}\n\t\ \ \}\n\t#\ sort\ the\ array\ in\ ascending\ order\ of\ prio\n\t#\ so\ that\ highest\ prio\ is\ at\ the\ end\n\tset\ calState(\$parent.shownmarks)\ \\\n\t\ \ \[lsort\ -index\ 3\ -integer\ \$calState(\$parent.shownmarks)\]\ \n\t#\ start\ @\ beginnig\ of\ array\ and\ reconfigure\ the\ buttons\ the\ \n\t#\ last\ marks\ will\ be\ of\ highest\ prio\ &\ will\ determine\ the\ marking\ color\n\t#\ automatically.\ Not\ blazingly\ fast,\ might\ tune\ later\n\tforeach\ Mlist\ \$calState(\$parent.shownmarks)\ \{\n\t\ \ \ \ #\ month\ &\ year\ are\ matching\ the\ shown\ ones,\ get\ the\ day\n\t\ \ \ \ foreach\ \{Mday\ Mmonth\ Myear\ Mpri\ Mcol\ Mlabel\}\ \$Mlist\ \{\}\n\t\ \ \ \ \$parent.\$index_arr(\$Mday)\ configure\ -highlightbackground\ \$Mcol\ \n\t\ \ \}\n\t#\ delete\ the\ array\ \ \n\tcatch\ \{unset\ index_arr\}\n\t#\ return\ used\ here\ to\ avoid\ returning\ the\ value\ of\ the\ catch\n\treturn\ \n\ \ \ \ \ \ \}\;#\ END\ update_cal\n\n\ \ \ \ proc\ enter_proc\ \{wname\}\ \{\n\ \ \ \ ###################################\n\ \ \ \ #\ gets\ called\ at\ each\ enter\ event\ #\n\ \ \ \ ###################################\n\tvariable\ calState\n\n\t#\ get\ parents\ name\n\tset\ parent\ \[winfo\ parent\ \$wname\]\n\t#\ set\ active\ color\n\t\$wname\ configure\ -background\ \$calState(\$parent.activebackground)\n\t#\ trigger\ the\ balloon\n\tafter\ \$calState(\$parent.delay)\ \[list\ callib::balloon_show\ \$wname\]\ \n\ \ \ \ \ \ \}\n\n\ \ \ \ proc\ leave_proc\ \{wname\}\ \{\n\ \ \ \ ###################################\n\ \ \ \ #\ gets\ called\ at\ each\ leave\ event\ #\n\ \ \ \ ###################################\n\tvariable\ calState\n\n\t#\ get\ parents\ name\n\tset\ parent\ \[winfo\ parent\ \$wname\]\n\t#\ set\ inactive\ color\n\t\$wname\ configure\ -background\ \$calState(\$parent.background)\n\t#\ check\ if\ the\ label\ was\ \"clicked\"\ and\ set\ the\ color\ to\ clickedcolor\n\tset\ col\ \[lindex\ \$calState(\$parent.clicked)\ 0\]\ \ \n\tset\ row\ \[lindex\ \$calState(\$parent.clicked)\ 1\]\ \ \n\tif\ \{\$row\ !=\ \"\"\}\ \{\n\t\ \ \ \ set\ label_name\ \$parent.\$col\$row\n\t\ \ \ \ \$label_name\ configure\ -background\ \$calState(\$parent.clickedcolor)\n\t\ \ \}\;#\ END:\ there\ was\ a\ clicked\ button\n\t#\ close\ the\ balloon\n\tballoon_dn\ \$wname\ \n\ \ \ \ \ \ \}\n\n\ \ \ \ proc\ balloon_show\ \{wname\}\ \{\n\ \ \ \ #######################################\n\ \ \ \ #\ triggers\ a\ balloon\ help\ like\ window\ #\n\ \ \ \ #######################################\n\tvariable\ calState\n\n\t#\ get\ parents\ name\n\tset\ parent\ \[winfo\ parent\ \$wname\]\n\t#\ in\ case\ the\ balloons\ \ are\ disabled\ do\ nothing\n\tif\ \{\$calState(\$parent.balloon)\ ==\ 0\}\ return\n\t#\ in\ case\ we\ already\ left\ the\ widget\ do\ nothing\n\tset\ currentwin\ \[eval\ winfo\ containing\ \[winfo\ pointerxy\ .\]\]\n\tif\ \{!\[string\ match\ \$currentwin\ \$wname\]\}\ return\n\t#\ make\ a\ string\ with\ the\ marks\ of\ the\ date\ shown\ by\ the\ requester\n\tset\ day\ \[string\ trim\ \[\$wname\ cget\ -text\]\]\n\tset\ message_str\ \"\"\n\tforeach\ Mlist\ \$calState(\$parent.shownmarks)\ \{\n\t\ \ \ \ foreach\ \{Mday\ Mmonth\ Myear\ Mpri\ Mcol\ Mlabel\}\ \$Mlist\ \{\}\n\t\ \ \ \ if\ \{(\$Mday\ ==\ \$day)\}\ \{append\ message_str\ \"\$Mpri\ \$Mlabel\\n\"\}\n\t\ \ \}\n\tset\ message_str\ \[string\ trim\ \$message_str\]\n\t#\ if\ there\ are\ no\ marks\ for\ requesters\ widget\ return\n\tif\ \{!\[string\ length\ \$message_str\]\}\ return\n\t#\ create\ a\ top\ level\ window\n\tset\ top\ \$parent.balloon\n\tcatch\ \{destroy\ \$top\}\n\ttoplevel\ \$top\ -borderwidth\ 1\ -background\ black\ -relief\ flat\n\twm\ overrideredirect\ \$top\ 1\n\t#\ create\ the\ message\ widget\n\tmessage\ \$top.msg\ -text\ \$message_str\ \ -width\ 3i\\\n\t\t\t\ -font\ \$calState(\$parent.font)\\\n\t\t\t\ -background\ yellow\ -foreground\ darkblue\n\tpack\ \$top.msg\n\t#\ get\ the\ geometry\ data\ of\ the\ requester\n\tset\ wmx\ \[expr\ \[winfo\ rootx\ \$wname\]+\[winfo\ width\ \ \$wname\]\]\n\tset\ wmy\ \[expr\ \[winfo\ rooty\ \$wname\]+\[winfo\ height\ \$wname\]\]\n\twm\ geometry\ \$top\ \\\n\t\ \ \[winfo\ reqwidth\ \$top.msg\]x\[winfo\ reqheight\ \$top.msg\]+\$wmx+\$wmy\n\t#\ raise\ so\ that\ win\ is\ really\ on\ top\n\traise\ \$top\n\ \ \ \ \ \ \}\;#\ end\ balloon_show\ \n\n\ \ \ \ proc\ balloon_dn\ \{wname\}\ \{\n\ \ \ \ ###############################\n\ \ \ \ #\ makes\ the\ balloon\ disappear\ #\n\ \ \ \ ###############################\n\tvariable\ calState\n\n\t#\ get\ parents\ name\n\tset\ parent\ \[winfo\ parent\ \$wname\]\n\t#\ in\ case\ the\ balloons\ \ are\ disabled\ do\ nothing\n\tif\ \{\$calState(\$parent.balloon)\ ==\ 0\}\ return\n\t#\ destroy\ the\ help\ balloon\n\tcatch\ \{destroy\ \$parent.balloon\}\n\ \ \ \ \ \ \}\;#\ end\ balloon_dn\n\n\ \ \ \ proc\ calproc\ \{parent\ args\}\ \{\n\ \ \ \ ################################################################\n\ \ \ \ #\ This\ proc\ takes\ care\ of\ all\ the\ configuration\ subcommands\ of\ #\n\ \ \ \ #\ the\ calendar\ widget\t\t\t\t\t\ \ #\n\ \ \ \ ################################################################\n\tvariable\ calState\n\n\t#\ make\ a\ list\ of\ allowed\ commands\n\t#\ new\ commands\ should\ be\ dropped\ here\ &\ processed\ in\ the\ switch\ \n\t#\ statement\ along\ with\ the\ possible\ subcommands\n\tset\ commList\ \[list\ \"nextmonth\"\ \"prevmonth\"\ \\\n\t\t\t\ \ \ \"nextyear\"\ \ \"prevyear\"\ \ \\\n\t\t\t\ \ \ \"configure\"\]\n\t#\ extract\ the\ first\ word\ in\ args,\ this\ must\ be\ in\ the\ commList\n\tset\ command\ \[lindex\ \$args\ 0\]\n\tif\ \{\[lsearch\ -exact\ \$commList\ \$command\]\ ==\ -1\}\ \{\n\t\ \ \ \ error\ \"unknown\ command\ for\ \$parent,\ possible\ command(s):\\n\\\n\t\t\ \ \ \$commList\"\n\t\ \ \}\;#\ END:\ check\ whether\ command\ is\ known\ to\ widget\n\n\t#\ remove\ the\ parent\ name\ from\ the\ args\ list\n\tset\ \ args\ \[lreplace\ \$args\ 0\ 0\]\n\n\tswitch\ --\ \$command\ \{\n\t\ \ \ \ \"configure\"\ \{\n\t\t#\ if\ there\ are\ no\ arguments\ to\ configure\n\t\t#\ then\ return\ a\ list\ with\ all\ the\ configuration\n\t\tif\ \{\$args\ ==\ \"\"\}\ \{\n\t\t\ \ \ \ set\ optlist\ \[array\ get\ calState\ \"\$parent.*\"\]\n\t\t\ \ \ \ set\ returnlist\ \"\"\n\t\t\ \ \ \ foreach\ \{opt\ val\}\ \$optlist\ \{\n\t\t\tregsub\ \"\$parent.\"\ \$opt\ \"\"\ opt\n\t\t\t#\ shownmarks\ is\ a\ private\ field,\ so\ leave\ it\ out\n\t\t\tif\ \{\$opt\ !=\ \"shownmarks\"\}\ \{\n\t\t\t\ \ \ \ lappend\ returnlist\ \[list\ \$opt\ \$val\]\n\t\t\t\ \ \}\ \ \n\t\t\ \ \ \ \ \ \}\n\t\t\ \ \ \ return\ \$returnlist\ \ \n\t\t\ \ \}\;#\ END:\ if\ no\ args\ for\ configure\n\t\tforeach\ \{opt\ val\}\ \$args\ \{\n\t\t\ \ \ \ switch\ --\ \$opt\ \{\n\t\t\t\"-font\"\ \{\n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"\"\}\ \{\n\t\t\t\treturn\ \$calState(\$parent.font)\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ if\ no\ font\ specified\n\t\t\t\ \ \ \ #\ might\ want\ to\ check\ whether\ font\ is\ available\ \ \n\t\t\t\ \ \ \ set\ calState(\$parent.font)\ \$val\n\t\t\t\ \ \}\n\t\t\t\"-background\"\ \{\n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"\"\}\ \{\n\t\t\t\treturn\ \$calState(\$parent.background)\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ if\ no\ color\ specified\n\t\t\t\ \ \ \ set\ er\ \[catch\ \{label\ .tmp\ -background\ \$val\}\ result\]\n\t\t\t\ \ \ \ destroy\ .tmp\ \ \ \n\t\t\t\ \ \ \ if\ \{\$er\}\ \{\n\t\t\t\terror\ \"Problem\ with\ the\ color\ value\\n\\\n\t\t\t\t\ \ \ \ \ \ color\ is\ \\\"\$val\\\"\"\n\t\t\t\treturn\n\t\t\t\ \ \ \ \ \ \}\n\t\t\t\ \ \ \ set\ calState(\$parent.background)\ \$val\n\t\t\t\ \ \}\n\t\t\t\"-foreground\"\ \{\n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"\"\}\ \{\n\t\t\t\treturn\ \$calState(\$parent.foreground)\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ if\ no\ color\ specified\n\t\t\t\ \ \ \ set\ er\ \[catch\ \{label\ .tmp\ -foreground\ \$val\}\ result\]\n\t\t\t\ \ \ \ destroy\ .tmp\ \ \ \n\t\t\t\ \ \ \ if\ \{\$er\}\ \{\n\t\t\t\terror\ \"Problem\ with\ the\ color\ value\\n\\\n\t\t\t\t\ \ \ \ \ \ color\ is\ \\\"\$val\\\"\"\n\t\t\t\treturn\n\t\t\t\ \ \ \ \ \ \}\n\t\t\t\ \ \ \ set\ calState(\$parent.foreground)\ \$val\n\t\t\t\ \ \}\n\t\t\t\"-activebackground\"\ \{\n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"\"\}\ \{\n\t\t\t\treturn\ \$calState(\$parent.activebackground)\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ if\ no\ color\ specified\n\t\t\t\ \ \ \ set\ er\ \[catch\ \{label\ .tmp\ -background\ \$val\}\ result\]\n\t\t\t\ \ \ \ destroy\ .tmp\ \ \ \n\t\t\t\ \ \ \ if\ \{\$er\}\ \{\n\t\t\t\terror\ \"Problem\ with\ the\ color\ value\\n\\\n\t\t\t\t\ \ \ \ \ \ color\ is\ \\\"\$val\\\"\"\n\t\t\t\treturn\n\t\t\t\ \ \ \ \ \ \}\n\t\t\t\ \ \ \ set\ calState(\$parent.activebackground)\ \$val\n\t\t\t\ \ \}\n\t\t\t\"-dayfont\"\ \{\n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"\"\}\ \{\n\t\t\t\treturn\ \$calState(\$parent.dayfont)\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ if\ no\ dayfont\ specified\n\t\t\t\ \ \ \ set\ calState(\$parent.dayfont)\ \$val\n\t\t\t\ \ \}\n\t\t\t\"-clickedcolor\"\ \{\n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"\"\}\ \{\n\t\t\t\treturn\ \$calState(\$parent.clickedcolor)\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ if\ no\ clicked\ color\ specified\n\t\t\t\ \ \ \ set\ er\ \[catch\ \{label\ .tmp\ -background\ \$val\}\ result\]\n\t\t\t\ \ \ \ destroy\ .tmp\ \ \ \n\t\t\t\ \ \ \ if\ \{\$er\}\ \{\n\t\t\t\terror\ \"Problem\ with\ the\ color\ value\\n\\\n\t\t\t\t\ \ \ \ \ \ color\ is\ \\\"\$val\\\"\"\n\t\t\t\treturn\n\t\t\t\ \ \ \ \ \ \}\n\t\t\t\ \ \ \ set\ calState(\$parent.clickedcolor)\ \$val\n\t\t\t\ \ \}\n\t\t\t\"-relief\"\ \{\n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"\"\}\ \{\n\t\t\t\treturn\ \$calState(\$parent.relief)\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ if\ no\ relief\ specified\n\t\t\t\ \ \ \ set\ er\ \[catch\ \{label\ .tmp\ -relief\ \$val\}\ result\]\n\t\t\t\ \ \ \ destroy\ .tmp\ \ \ \n\t\t\t\ \ \ \ if\ \{\$er\}\ \{\n\t\t\t\terror\ \"Problem\ with\ the\ relief\ value\\n\\\n\t\t\t\t\ \ \ \ \ \ relief\ is\ \\\"\$val\\\"\"\n\t\t\t\treturn\n\t\t\t\ \ \ \ \ \ \}\n\t\t\t\ \ \ \ set\ calState(\$parent.relief)\ \$val\n\t\t\t\ \ \}\n\t\t\t\"-startsunday\"\ \{\n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"\"\}\ \{\n\t\t\t\treturn\ \$calState(\$parent.startsunday)\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ \ if\ no\ value\ for\ start\ sunday\n\t\t\t\ \ \ \ set\ calState(\$parent.startsunday)\ 0\ \ \n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"1\"\}\ \{\n\t\t\t\tset\ calState(\$parent.startsunday)\ 1\n\t\t\t\ \ \ \ \ \ \}\ \n\t\t\t\ \ \ \ #\ get\ rid\ of\ clicked\ state\ as\ calendar\ is\ going\n\t\t\t\ \ \ \ #\ to\ change\ layout\n\t\t\t\ \ \ \ set\ calState(\$parent.clicked)\ \{\}\ \ \n\t\t\t\ \ \}\n\t\t\t\"-balloon\"\ \{\n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"\"\}\ \{\n\t\t\t\treturn\ \$calState(\$parent.balloon)\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ \ if\ no\ value\ for\ balloon\n\t\t\t\ \ \ \ set\ calState(\$parent.balloon)\ 0\ \ \n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"1\"\}\ \{\n\t\t\t\tset\ calState(\$parent.balloon)\ 1\n\t\t\t\ \ \ \ \ \ \}\ \n\t\t\t\ \ \}\n\t\t\t\"-delay\"\ \{\n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"\"\}\ \{\n\t\t\t\treturn\ \$calState(\$parent.delay)\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ \ if\ no\ value\ for\ balloon\ delay\n\t\t\t\ \ \ \ #\ delay\ check:\ must\ be\ integer\n\t\t\t\ \ \ \ set\ er\ \[catch\ \{incr\ val\ 0\}\]\n\t\t\t\ \ \ \ if\ \{\$er\}\ \{\n\t\t\t\terror\ \"Problem\ with\ the\ delay\ value\\n\\\n\t\t\t\t\ \ \ \ \ \ most\ likely\ a\ non\ integer\ value\ \\n\\\n\t\t\t\t\ \ \ \ \ \ given\ delay\ is\ \\\"\$val\\\"\"\n\t\t\t\treturn\n\t\t\t\ \ \ \ \ \ \}\n\t\t\t\ \ \ \ if\ \{\$val\ <\ 0\}\ \{\n\t\t\t\terror\ \"Problem\ with\ negative\ delay\ value\\n\\\n\t\t\t\t\ \ \ \ \ \ given\ delay\ is\ \\\"\$val\\\"\"\n\t\t\t\treturn\n\t\t\t\ \ \ \ \ \ \}\n\t\t\t\ \ \ \ set\ calState(\$parent.delay)\ \$val\ \n\t\t\t\ \ \}\n\t\t\t\"-progcallback\"\ \{\n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"\"\}\ \{\n\t\t\t\treturn\ \$calState(\$parent.progcallback)\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ \ if\ no\ value\ for\ progcallback\n\t\t\t\ \ \ \ set\ calState(\$parent.progcallback)\ 0\ \ \n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"1\"\}\ \{\n\t\t\t\tset\ calState(\$parent.progcallback)\ 1\n\t\t\t\ \ \ \ \ \ \}\ \n\t\t\t\ \ \}\n\t\t\t\"-mark\"\ \{\n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"\"\}\ \{\n\t\t\t\treturn\ \$calState(\$parent.mark)\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ if\ no\ marking\ list\ given\n\t\t\t\ \ \ \ if\ \{\[llength\ \$val\]\ !=\ 6\}\ \{\n\t\t\t\terror\ \"The\ mark\ list\ must\ have\ 6\ elements\\n\\\n\t\t\t\t\ \ \ \ \ \ \ a\ mark\ list\ should\ be\ like\ this:\ \ \\n\\\n\t\t\t\t\ \ \ \ \ \ \ \{day\ month\ year\ prio\ color\ label\}\"\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ if\ mark\ list\ not\ properly\ constructed\n\t\t\t\ \ \ \ \n\t\t\t\ \ \ \ #\ assign\ temp_vars\ \ \n\t\t\t\ \ \ \ foreach\ \{Mday\ Mmonth\ Myear\ Mpri\ Mcol\ Mlabel\}\ \$val\ \{\}\n\t\t\t\ \ \ \ \n\t\t\t\ \ \ \ #\ check\ the\ list\ fields\ for\ consistency\ \ \n\t\t\t\ \ \ \ #\ check\ the\ month\n\t\t\t\ \ \ \ if\ \{(\$Mmonth\ <\ 1)\ ||\ (\$Mmonth\ >\ 12)\}\ \{\n\t\t\t\terror\ \"Month\ out\ of\ range\"\n\t\t\t\treturn\n\t\t\t\ \ \ \ \ \ \}\n\t\t\t\ \ \ \ #\ check\ year\ and\ month,\ compute\ the\ number\ of\ days\n\t\t\t\ \ \ \ #\ of\ the\ given\ month\n\t\t\t\ \ \ \ set\ er\ \[catch\ \{cal_month_length\ \$Mmonth\ \$Myear\}\ Ml\]\n\t\t\t\ \ \ \ if\ \{\$er\}\ \{\n\t\t\t\terror\ \"Problem\ computing\ month\ length,\\n\\\n\t\t\t\t\ \ \ \ \ \ year\ out\ of\ clock's\ range\ or\ erroneous\\n\\\n\t\t\t\t\ \ \ \ \ \ month\ value\"\n\t\t\t\treturn\n\t\t\t\ \ \ \ \ \ \}\n\t\t\t\ \ \ \ #\ day\ check\n\t\t\t\ \ \ \ if\ \{(\$Mday\ <\ 1)\ ||\ (\$Mday\ >\ \$Ml)\}\ \{\n\t\t\t\terror\ \"Day\ of\ month\ out\ of\ range\"\n\t\t\t\treturn\n\t\t\t\ \ \ \ \ \ \}\n\t\t\t\ \ \ \ #\ prio\ check:\ must\ be\ integer\n\t\t\t\ \ \ \ set\ er\ \[catch\ \{incr\ Mpri\ 0\}\]\n\t\t\t\ \ \ \ if\ \{\$er\}\ \{\n\t\t\t\terror\ \"Problem\ with\ the\ priority\ value\\n\\\n\t\t\t\t\ \ \ \ \ \ most\ likely\ a\ non\ integer\ value\ \\n\\\n\t\t\t\t\ \ \ \ \ \ prio\ is\ \\\"\$Mpri\\\"\"\n\t\t\t\treturn\n\t\t\t\ \ \ \ \ \ \}\n\t\t\t\ \ \ \ #\ check\ that\ color\ is\ acceptable\n\t\t\t\ \ \ \ set\ er\ \[catch\ \{label\ .tmp\ -background\ \$Mcol\}\ result\]\n\t\t\t\ \ \ \ destroy\ .tmp\ \ \ \n\t\t\t\ \ \ \ if\ \{\$er\}\ \{\n\t\t\t\terror\ \"Problem\ with\ the\ color\ value\\n\\\n\t\t\t\t\ \ \ \ \ \ color\ is\ \\\"\$Mcol\\\"\"\n\t\t\t\treturn\n\t\t\t\ \ \ \ \ \ \}\n\t\t\t\ \ \ \ #\ all\ consistency\ checks\ went\ OK\n\t\t\t\ \ \ \ #\ append\ mark\ to\ mark\ list\n\t\t\t\ \ \ \ lappend\ calState(\$parent.mark)\ \$val\n\t\t\t\ \ \}\n\t\t\t\"-daynames\"\ \{\n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"\"\}\ \{\n\t\t\t\treturn\ \$calState(\$parent.daynames)\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ if\ no\ list\ with\ daynames\ specified\n\t\t\t\ \ \ \ if\ \{\[llength\ \$val\]\ !=\ 7\}\ \{\n\t\t\t\terror\ \"The\ list\ given\ to\ -daynames\ must\ have\\n\\\n\t\t\t\t\ \ \ \ \ \ \ 7\ \ elements,\ \[llength\ \$val\]\ elements\ \\n\\\n\t\t\t\t\ \ \ \ \ \ \ were\ specified\ in\ \$val\"\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ if\ list\ didn't\ have\ 7\ elements\n\t\t\t\ \ \ \ set\ calState(\$parent.daynames)\ \$val\ \ \n\t\t\t\ \ \}\n\t\t\t\"-clicked\"\ \{\n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"\"\}\ \{\n\t\t\t\treturn\ \$calState(\$parent.clicked)\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ if\ no\ list\ with\ \ calendar\ coordinates\ \n\t\t\t\ \ \ \ if\ \{\[llength\ \$val\]\ !=\ 2\}\ \{\n\t\t\t\terror\ \"The\ list\ given\ to\ -clicked\ must\ have\\n\\\n\t\t\t\t\ \ \ \ \ \ \ 2\ \ elements,\ \[llength\ \$val\]\ elements\ \\n\\\n\t\t\t\t\ \ \ \ \ \ \ were\ specified\ in\ \$val\"\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ if\ list\ didn't\ have\ 2\ elements\n\t\t\t\ \ \ \ set\ tmp_col\ \[lindex\ \$val\ 0\]\n\t\t\t\ \ \ \ set\ tmp_row\ \[lindex\ \$val\ 1\]\n\t\t\t\ \ \ \ if\ \{\ (\$tmp_col\ <\ 0)\ ||\ (\$tmp_col\ >\ 6)\}\ \{\n\t\t\t\terror\ \"column\ value\ for\ clicked\ cell\ invalid\\n\\\n\t\t\t\t\ \ \ \ \ \ \ 0<=\ col\ <\ 7\ allowed,\ given:\ \$tmp_col\"\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ if\ coord\ isn't\ in\ right\ range\n\t\t\t\ \ \ \ if\ \{\ (\$tmp_row\ <\ 0)\ ||\ (\$tmp_row\ >\ 5)\}\ \{\n\t\t\t\terror\ \"row\ value\ for\ clicked\ cell\ invalid\\n\\\n\t\t\t\t\ \ \ \ \ \ \ 0<=\ col\ <\ 5\ allowed,\ given:\ \$tmp_col\"\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ if\ coord\ isn't\ in\ right\ range\n\t\t\t\ \ \ \ set\ Cstate\ \[\$parent.\$tmp_col\$tmp_row\ cget\ -state\]\n\t\t\t\ \ \ \ if\ \{\$Cstate\ ==\ \"normal\"\}\ \{\t\ \ \ \ \ \ \n\t\t\t\tset\ calState(\$parent.clicked)\ \$val\ \ \n\t\t\t\t#\ call\ the\ callback\ as\ if\ the\ appropriate\ button\n\t\t\t\t#\ was\ clicked.\ \n\t\t\t\tif\ \{\$calState(\$parent.progcallback)==\"1\"\}\ \{\n\t\t\t\t\ \ \ \ callback\ \$parent\ \$tmp_col\ \$tmp_row\ \ \ \n\t\t\t\t\ \ \}\;#\ end:\ if\ programm\ callback\ enabled\ \ \n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ if\ cell\ is\ not\ disabled\n\t\t\t\ \ \}\ \ \ \ \n\t\t\t\"-month\"\ \{\n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"\"\}\ \{\n\t\t\t\treturn\ \$calState(\$parent.month)\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ if\ no\ month\ specified\n\t\t\t\ \ \ \ if\ \{(\$val\ >\ 0)\ &&\ (\$val\ <\ 13)\}\ \{\n\t\t\t\tset\ calState(\$parent.month)\ \$val\n\t\t\t\ \ \ \ \ \ \}\ else\ \{\n\t\t\t\terror\ \"Month\ value\ must\ be\ between\ 1\ and\ 12\"\n\t\t\t\ \ \ \ \ \ \}\n\t\t\t\ \ \ \ set\ calState(\$parent.clicked)\ \{\}\ \ \n\t\t\t\ \ \}\n\t\t\t\"-year\"\ \{\n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"\"\}\ \{\n\t\t\t\treturn\ \$calState(\$parent.year)\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ if\ no\ year\ specified\n\t\t\t\ \ \ \ set\ calState(\$parent.year)\ \$val\n\t\t\t\ \ \ \ set\ calState(\$parent.clicked)\ \{\}\ \ \n\t\t\t\ \ \}\ \ \ \ \ \n\t\t\t\"-callback\"\ \{\n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"\"\}\ \{\n\t\t\t\treturn\ \$calState(\$parent.callback)\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ if\ no\ year\ specified\n\t\t\t\ \ \ \ set\ calState(\$parent.callback)\ \$val\n\t\t\t\ \ \}\ \ \ \ \ \n\t\t\tdefault\ \{\n\t\t\t\ \ \ \ error\ \"Bad\ option:\ \$opt\\n\\\n\t\t\t\t\ \ \ allowed\ option(s)\ for\ configure\ are:\ \ \ \ \\n\\\n\t\t\t\t\ \ \ -font\ -startsunday\ -daynames\ -month\ \ \ \ \ \\n\\\n\t\t\t\t\ \ \ -year\ -dayfont\ -callback\ -clickedcolor\ \ \\n\\\n\t\t\t\t\ \ \ -background\ -clicked\ -mark\ -balloon\ \ \ \ \ \\n\\\n\t\t\t\t\ \ \ -progcallback\ -activebackground\ -delay\ \ \\n\\\n\t\t\t\t\ \ \ -foreground\"\ \n\t\t\t\ \ \}\n\t\t\ \ \ \ \ \ \}\n\t\t\ \ \}\n\t\tupdate_cal\ \$parent\ \ \n\t\ \ \ \ \ \ \}\n\t\ \ \ \ \"nextmonth\"\ \{\n\t\tif\ \{\[llength\ \$args\]\}\ \{\n\t\t\ \ \ \ error\ \"nextmonth\ not\ allowed\ to\ have\ arguments\"\n\t\t\ \ \}\;#\ END:\ check\ number\ of\ arguments\ error\ if\ !=\ 0\n\t\tincr\ calState(\$parent.month)\n\t\tif\ \{\$calState(\$parent.month)\ ==\ 13\}\ \{\n\t\t\ \ \ \ set\ calState(\$parent.month)\ 1\n\t\t\ \ \ \ incr\ calState(\$parent.year)\n\t\t\ \ \}\;#\ END:\ if\ month\ crossed\ year\ boundary\ to\ next\ year\n\t\tset\ calState(\$parent.clicked)\ \{\}\ \ \n\t\tupdate_cal\ \$parent\ \ \n\t\treturn\ \[list\ \$calState(\$parent.year)\ \$calState(\$parent.month)\]\n\t\ \ \ \ \ \ \}\n\t\ \ \ \ \"prevmonth\"\ \{\n\t\tif\ \{\[llength\ \$args\]\}\ \{\n\t\t\ \ \ \ error\ \"prevmonth\ not\ allowed\ to\ have\ arguments\"\n\t\t\ \ \}\;#\ END:\ check\ number\ of\ arguments\ error\ if\ !=\ 0\n\t\tincr\ calState(\$parent.month)\ -1\n\t\tif\ \{\$calState(\$parent.month)\ ==\ 0\}\ \{\n\t\t\ \ \ \ set\ calState(\$parent.month)\ 12\n\t\t\ \ \ \ incr\ calState(\$parent.year)\ -1\n\t\t\ \ \}\;#\ END:\ if\ month\ crossed\ year\ boundary\ to\ previous\ year\n\t\tset\ calState(\$parent.clicked)\ \{\}\ \ \n\t\tupdate_cal\ \$parent\ \ \n\t\treturn\ \[list\ \$calState(\$parent.year)\ \$calState(\$parent.month)\]\n\t\ \ \ \ \ \ \}\n\t\ \ \ \ \"nextyear\"\ \{\n\t\tif\ \{\[llength\ \$args\]\}\ \{\n\t\t\ \ \ \ error\ \"nextyear\ not\ allowed\ to\ have\ arguments\"\n\t\t\ \ \}\;#\ END:\ check\ number\ of\ arguments\ error\ if\ !=\ 0\n\t\tincr\ calState(\$parent.year)\n\t\tset\ calState(\$parent.clicked)\ \{\}\ \ \n\t\tupdate_cal\ \$parent\ \ \n\t\treturn\ \[list\ \$calState(\$parent.year)\ \$calState(\$parent.month)\]\n\t\ \ \ \ \ \ \}\n\t\ \ \ \ \"prevyear\"\ \{\n\t\tif\ \{\[llength\ \$args\]\}\ \{\n\t\t\ \ \ \ error\ \"prevyear\ not\ allowed\ to\ have\ arguments\"\n\t\t\ \ \}\;#\ END:\ check\ number\ of\ arguments\ error\ if\ !=\ 0\n\t\tincr\ calState(\$parent.year)\ -1\n\t\tset\ calState(\$parent.clicked)\ \{\}\ \ \n\t\tupdate_cal\ \$parent\ \ \n\t\treturn\ \[list\ \$calState(\$parent.year)\ \$calState(\$parent.month)\]\n\t\ \ \ \ \ \ \}\ \ \ \n\t\ \ \ \ default\ \{\n\t\terror\ \"You\ should\ never\ have\ reached\ this\ point\\n\\\n\t\t\ \ \ \ \ \ \ The\ state\ of\ the\ widget\ might\ be\ mangled\\n\\\n\t\t\ \ \ \ \ \ \ Bailing\ out,\ bye\\n\"\n\t\ \ \ \ \ \ \}\n\t\ \ \}\;#\ END:\ switch\ --\ \$command\n\ \ \ \ \ \ \}\;#\ END:\ calproc\n\n\ #\ utilities\ start\ here\n\ #\ anything\ needing\ calState\ does\ not\ belong\ below\n\ \ \ \ proc\ roll_left\ \{listvar\ \{rollby\ 1\}\}\ \{\n\ \ \ \ ##############################################\n\ \ \ \ #\ helper\ function\ to\ roll\ a\ list\ to\ the\ left\ #\n\ \ \ \ ##############################################\n\tset\ newlist\ \$listvar\n\tfor\ \{set\ counter\ 0\}\ \{\$counter\ <\ \$rollby\}\ \{incr\ counter\}\ \{\n\t\ \ \ \ set\ firstelem\ \[lindex\ \$newlist\ 0\]\n\t\ \ \ \ set\ newlist\ \ \ \[lreplace\ \$newlist\ 0\ 0\]\n\t\ \ \ \ set\ newlist\ \ \ \[lappend\ newlist\ \$firstelem\]\n\t\ \ \}\n\treturn\ \$newlist\n\ \ \ \ \ \ \}\;#\ END\ roll_left\n\n\ \ \ \ proc\ cal_start_weekday\ \{\ month\ year\ \}\ \{\n\ \ \ \ ############################################\n\ \ \ \ #\ returns\ the\ weekday\ as\ an\ ordinal\ number\ #\n\ \ \ \ #\ sunday\ is\ 0\t\t\t\ \ \ \ \ \ #\n\ \ \ \ ############################################\n\t#\ obvious,\ needed\ as\ a\ wrapper\ for\ future\ \n\t#\ sophistication\ of\ the\ proc\n\tset\ startday\ \[clock\ scan\ \"\$month/1/\$year\"\]\n\treturn\ \[clock\ format\ \$startday\ -format\ \"%w\"\]\n\ \ \ \ \ \ \}\;#\ END:\ cal_start_weekday\n\n\ \ \ \ proc\ cal_month_length\ \{\ monthvar\ yearvar\ \}\ \{\n\ \ \ \ #################################\n\ \ \ \ #\ returns\ the\ length\ of\ a\ month\ #\n\ \ \ \ #################################\n\t#\ get\ clock\ ticks\n\t#\ make\ sure\ to\ stay\ in\ same\ month\ to\ stay\ in\ same\ year\n\tset\ startdate\ \ \ \ \[clock\ scan\ \"\$monthvar/1/\$yearvar\"\]\n\tset\ enddate\ \ \ \ \ \ \[clock\ scan\ \"+1\ month\"\ -base\ \$startdate\]\n\tset\ lastmonthday\ \[clock\ scan\ \"yesterday\"\ \ -base\ \$enddate\]\n\n\t#\ get\ day\ numbers\ from\ ticks\n\tset\ lastday\ \ \ \ \ \ \[clock\ format\ \$lastmonthday\ -format\ \"%d\"\]\n\n\t#\ get\ rid\ of\ leading\ zeroes\ as\ tcl\ interpret\ them\ as\ octal\n\tset\ lastday\ \ \[\ string\ trimleft\ \$lastday\ \ \"0\"\]\n\n\t#\ actually\ not\ needed\ (clock\ ...\ %d\ returns\ min.\ 01)\n\t#\ but\ keep\ sane\ state\ for\ the\ variables\n\tif\ \{\$lastday\ \ ==\ \"\"\}\ \{set\ lastday\ \ \"0\"\}\n\t#\ return\n\treturn\ \ \ \$lastday\ \n\ \ \ \ \ \ \}\;#\ END:\ cal_month_length\n\n\ \ \ \ proc\ cal_build_month\ \{\ month\ year\ \}\ \{\n\ \ \ \ ######################################################\n\ \ \ \ #\ returns\ a\ list\ of\ 35\ elements\ containing\ the\ month\ #\n\ \ \ \ #\ start\ day\ of\ week\ is\ sunday\ by\ default\t\ \ \ \ \ #\n\ \ \ \ ######################################################\n\tset\ startday\ \[cal_start_weekday\ \$month\ \$year\]\n\tset\ numdays\ \ \[cal_month_length\ \ \$month\ \$year\]\n\n\t#\ put\ month\ there\n\tfor\ \{set\ counter\ 1\}\ \{\$counter\ <=\ \$numdays\}\ \{incr\ counter\}\ \{\n\t\ \ \ \ set\ monthlist\ \[lappend\ monthlist\ \$counter\]\n\t\ \ \}\n\t#\ make\ empty\ preceeding\ days\ if\ needed\n\tif\ \{\$startday\ !=\ 0\}\ \{\n\t\ \ \ \ for\ \{set\ counter\ 0\}\ \{\$counter\ <\ \$startday\}\ \{incr\ counter\}\ \{\n\t\tset\ prelist\ \[lappend\ prelist\ \"\"\]\n\t\ \ \ \ \ \ \}\n\t\ \ \ \ return\ \[concat\ \$prelist\ \$monthlist\]\n\t\ \ \}\n\n\treturn\ \$monthlist\n\ \ \ \ \ \ \}\;#\ END:\ cal_build_month\n\n\ \ \ \ #############################################################\n\ \ \ \ #\ return\ the\ monthlist\ with\ start\ either\ mondays\ or\ sundays\ #\n\ \ \ \ #############################################################\n\ \ \ \ proc\ cal_list_month\ \{\ month\ year\ \{startsunday\ 1\}\}\ \{\n\t#\ get\ the\ default\ (start\ sunday)\ list\n\tset\ monthlist\ \[cal_build_month\ \$month\ \$year\ \]\n\n\tif\ \{\$startsunday\ !=\ 1\}\ \{\n\t#\ start\ week\ as\ in\ Europe\n\t\ \ \ \ set\ firstday\ \[cal_start_weekday\ \$month\ \$year\]\n\t\ \ \ \ if\ \{\$firstday\ ==\ 0\}\ \{\n\t\tset\ monthlist\ \[linsert\ \$monthlist\ 0\ \{\}\ \{\}\ \{\}\ \{\}\ \{\}\ \{\}\]\n\t\ \ \ \ \ \ \}\ else\ \{\n\t\tset\ monthlist\ \[roll_left\ \$monthlist\]\n\t\ \ \ \ \ \ \}\n\t\ \ \}\n\n\treturn\ \$monthlist\n\ \ \ \ \ \ \}\;#\ END:\ cal_list_month\n\n\ \ \}\;#\ END\ namespace\ callib\n\n======\n***Documentation***\n\n----\n\[Jaf\]\ Here\ is\ a\ bit\ of\ documentation:\n\n'''Name'''\n\n''calwid''\ -\ Create\ and\ manipulate\ calendar\ widgets\n\ \n'''Synopsis'''\n\n''calwid''\ pathName\ ?options?\n\n'''Widget\ commands:'''\n\n''nextmonth''\ Advances\ the\ shown\ calendar\ by\ one\ month\n\n''nextyear''\ Advances\ the\ shown\ calendar\ by\ one\ year.\ The\ month\ shown\ remains\ the\ same\n\n''prevmonth''\ Goes\ back\ one\ month\n\n''nextyear''\ Goes\ back\ one\ year.\ The\ month\ shown\ remains\ the\ same\n\n'''configure'''\n\n''Arguments''\ see\ below\n\nWithout\ any\ arguments,\ dumps\ the\ current\ configuration\n\n\n'''Configure\ options'''\n\nNote:\ all\ options\ return\ their\ current\ value\ if\ they\ are\ called\ without\ arguments\n\n''-font\ font''\ Sets\ the\ font\ for\ the\ daynumbers\ in\ the\ calendar\n\n''-background\ color''\ Sets\ the\ background\ colour\n\n''-activebackground\ color''\ Sets\ the\ color\ of\ the\ day\ the\ cursor\ is\ hovering\ over\n\n''-dayfont\ font''\ Sets\ the\ font\ used\ for\ the\ day\ names\n\n''-clickedcolor\ color''\ Sets\ the\ color\ a\ day\ field\ gets\ after\ a\ mouse\ click.\n''\t\t\ \ \ ''\ Note\ that\ there\ is\ no\ way\ yet\ to\ get\ rid\ of\ a\ \"clicked\"\n''\t\t\ \ \ ''\ day,\ a\ workaround\ is\ to\ jump\ to\ the\ next\ month\ and\ back.\n\n''-startsunday\ val''\ val=1:\ Sets\ the\ starting\ day\ of\ the\ week\ to\ sunday.\ val=0:\ Sets\ the\ starting\ day\ of\ the\ week\ to\ monday.\ \"clicked\"\ days\ revert\ to\ the\ background\ color.\n\n''-balloon\ val''\ val=1:\ enables\ balloons.\ val=0:\ disables\ balloons.\ Balloons\ are\ shown\ if\ the\ mouse\ hovers\ a\ certain\ amount\ of\ time\ over\ a\ day\ which\ has\ marks.\ The\ balloon\ contains\ a\ list\ of\ the\ mark\ prios\ and\ texts\ in\ ascending\ order.\ The\ delay\ is\ set\ using\ -delay\ (see\ below).\ The\ marks\ are\ set\ using\ -mark\ (see\ below)\n\n''-delay\ val''\ Delay\ im\ ms\ to\ wait\ until\ a\ balloon\ containing\ the\ days\ marks\ are\ shown\n\n''-callback\ procname''\ Procname\ gets\ called\ at\ each\ mouse\ click\ event\ on\ a\ day\ field.\ The\ callback\ is\ called\ and\ gets\ 6\ arguments:\ ''\{year\ month\ day\ dayname\ column\ row\}''\n\n''-clicked\ \{elem1\ elem2\}''\ Sets\ the\ day\ at\ coordinates\ column=elem1\ and\ row=elem2\ to\ the\ \"clicked\"\ state.\ Coordinates\ start\ with\ 0\n\n''-progcallback\ val''\ Enables/disables\ triggering\ of\ the\ callback\ if\ the\ -clicked\ option\ is\ used.\ val=1:\ enabled.\ val=0:\ disabled\n\n''-mark\ \{day\ month\ year\ prio\ color\ text\}''\ Sets\ a\ mark\ on\ the\ date\ given\ by\ day,\ month\ and\ year.\ Prio\ sets\ the\ priority\ of\ the\ mark.\ Color\ sets\ the\ color\ shown\ around\ the\ marked\ day,\ if\ the\ associated\ mark\ has\ highest\ priority.\ Text\ is\ shown\ in\ the\ balloon\ if\ balloons\ are\ enabled.\n\n''-daynames\ \{So\ Mo\ Di\ Mi\ Do\ Fr\ Sa\}''\ Sets\ the\ daynames\ shown\ in\ the\ calendar.\ The\ list\ starts\ with\ Sunday,\ the\ calendar\ uses\ the\ first\ 2\ chars\ of\ each\ list\ element.\ The\ callback\ gets\ the\ whole\ list\ element.\n\n''-month\ val''\ sets\ the\ month\ shown\ by\ the\ calendar\n\n''-year\ val''\ sets\ the\ year\ shown\ by\ the\ calendar\n\n''-relief\ val''\ sets\ the\ relief\ the\ calendar\ day\n\n----\n***Future\ Feature\ discussion***\n\n\[Jaf\]:\ Does\ somebody\ know\ how\ to\ contact\ a\ MS\ exchange\ server?\ It\ would\ be\ nice\ to\ fill\ the\ marks\ with\ appointments.\nCheers.\n\n\[MAKR\]:\ Via\ IMAP\ maybe?\ At\ my\ company\ the\ Exchange\ servers\ can\ be\ queried\ via\ IMAP\ and\ return\ an\ email\ with\ a\ vCalendar\ MIME\ part.\n\n\[LV\]\ This\ would\ be\ a\ '''great'''\ topic\ to\ pursue.\ \ If\ someone\ could\ build\ a\ cross\ platform\nTcl\ extension\ to\ interact\ with\ the\ calendaring\ portion\ of\ the\ MS\ server\ environment,\ it\nwould\ be\ a\ great\ ''selling''\ point\ for\ the\ language.\n\n\[Jaf\]:\ I've\ been\ experimenting\ a\ bit\ with\ the\ RFC244\{5,6,7\}\ sending\ schedule\ requests\ from\ my\ sun\ to\ my\ M\$\ e-mail\ account.\ I\ could\ get\ an\ appointment\ scheduled\ but\ never\ got\ an\ answer\ to\ my\ free/busy\ requests.\ Still\ ongoing\ though...,\ Cheers.\n\n\[LV\]\ Sure\ wish\ this\ could\ be\ a\ two\ way\ bridge.\ I\ use\ Sun's\ calendaring,\ but\ my\ task\ leader\ uses\ exchange.\ So\ we\ never\ can\ see\ each\ other's\ appointments.\n\ \n\n----\n!!!!!!\n%|\ \[Category\ Widget\]\ |\ \[Category\ Date\ and\ Time\]\ |%\n!!!!!! regexp2} CALL {my render {A calendar Widget} **Calendar\ Widget**\n\n***Introduction***\n8\ Feb.\ 2005\ \[Jaf\]\n\nA\ configurable\ calendar\ widget.\n----\nI\ wanted\ to\ configure\ the\ start\ of\ the\ week\ e.g\ Sunday/Monday\ in\ a\ calendar\ and\ ended\ up\ writing\ a\ \nwidget.\ At\ least\ it\ allowed\ me\ to\ learn\ about\ namespaces.\n----\n\n****Example****\n\nFor\ the\ impatient:\n======\n\ \ package\ require\ Tk\n\ \ package\ require\ callib\n\ \ calwid\ .test\n\ \ pack\ .test\n\n\ \ #\ Now,\ here\ are\ the\ error\ msgs\n\ \ .test\ configure\ -foo\n\ \ .test\ bar\n======\n\ or\ a\ \ \[better\ example\]\ :\ \n======\n\nCalling\ the\ widget\ with\ wrong\ arguments\ makes\ it\ complain\ and\ spew\ a\ bit\ of\nhelp.\n\nFor\ Documentation:\ see\ below\n\nNamespace\ stuff\ from\ \[Clif\ Flynt\]'s\ book.\n----\n***Comments***\n\[MAK\]\ Suggests\ using\ labels\ rather\ than\ buttons.\ \ Under\ Aqua,\ there\ are\ no\ groove/flat\ button\ reliefs.\n\n\n\[Jaf\],\ I\ think\ I\ would\ lose\ the\ callback\ capability.\ But\ it\ is\ worth\ looking\ into.\ Thanks.\n\n\n\[MG\]\ If\ you\ switch\ to\ labels,\ I\ think\ you'd\ just\ need\ to\ do\n\ \ label\ \$parent.\$col\$row\ -padx\ 0\ -pady\ 0\ -highlightthickness\ 2\ \;#\ create\ the\ widget\n\ \ bind\ \$parent.\$col\$row\ <Button-1>\ \[list\ callib::callback\ \$parent\ \$col\ \$row\]\ \;#\ bind\ to\ \n\t\t\t\t\t\t\t#\ mouse-click\ for\ the\ callback\nrather\ than\ using\ the\ \[button\]\ as\ you\ do\ now.\n\n\[Jaf\]:\ I\ made\ a\ compromise:\ I\ just\ made\ the\ ''relief''\ a\ configuration\ item.\ I\ think\ this\ should\ be\ OK\ (?)\ Cheers\n\n\[MAK\]:\ Not\ exactly.\ \ What\ I\ meant\ in\ the\ original\ statement\ was\ that,\ even\ if\ you\ configure\ a\ button\ with\ -relief\ flat,\ under\ Aqua\ it\ still\ shows\ up\ as\ a\ normal\ elongated\ round\ 3D\ button,\ not\ flat\ like\ a\ label.\ \ Through\ some\ oddity\ with\ the\ minimum\ size\ of\ the\ buttons\ and\ the\ space\ alloted\ them\ by\ grid,\ there\ are\ other\ artifacts\ that\ make\ it\ just\ look\ wrong.\n\n\[Jaf\]\ OK,\ I\ see\ the\ problem.\ I\ started\ reworking\ the\ widget.\ The\ labels\ make\ it\ a\ bit\ more\ difficult\ to\ implement\ the\nactivebackground\ stuff,\ I'll\ bind\ these\ too\ to\ the\ Enter/Leave\ events,\ that\ should\ be\ OK.\ Cheers.\n\n\[Jaf\]\ 24\ Feb\ 2005:\ changed\ the\ buttons\ to\ labels,\ functionality\ the\ same.\ Should\ be\ right\ under\ Aqua.\ Cheers.\n\n\[Jaf\]\ 03\ March\ 2005:\ Fixed\ a\ bug\ associated\ with\ setting\ the\ background\ color\n\n\[RH\]\ 19\ Oct\ 2005:\ removed\ additional\ characters\ in\ proc\ balloon_show\ that\ caused\ a\ tcl\ error\n\nWouldn't\ it\ be\ better\ to\ use\ the\ tooltip\ package\ of\ tklib\ instead\ of\ reimplementing\ the\ wheel,\ ahem\ tooltip.\n\n\nSee\ also\ \[An\ i15d\ date\ chooser\]\n\n\n\[Jaf\]\ Yes\ I\ had\ a\ look\ at\ it.\ That\ gave\ hints\ on\ how\ to\ do\ things,\ thanks\ a\ lot.\n\n----\n\[LV\]\ Have\ you\ considered\ making\ use\ of\ \[Tile\]\ so\ that\ your\ widgets\ look\ more\ native?\n\n\[LV\]\ A\ nice\ addition\ would\ be\ adding\ the\ code\ (from\ somewhere\ here\ on\ the\ wiki)\ so\ that\ month\ and\ day\ names\ and\ abbreviations\ are\ internationalized\ (or\ is\ that\ localized?),\ etc.\n\n----\n\[ofv\ 27-may-2008\]\ Correction:\ Calls\ the\ callback\ with\ 6\ arguments,\ as\ per\ the\ documentation,\ not\ with\ a\ list\ of\ six\ elements.\n\n----\n***Code***\n\n======\n\ package\ provide\ callib\ 0.3\n\n\ proc\ calwid\ \{args\}\ \{\n\ ##############################################\n\ #\ provides\ api\ for\ creating\ calendar\ widgets\ #\n\ ##############################################\n\ \ \ #\ creation\ of\ the\ widget\n\ \ \ set\ newWidget\ \[\ eval\ callib::MakecalendarWid\ \$args\]\n\n\ \ \ #\ create\ body\ for\ the\ new\ widget\ proc\n\ \ \ set\ newCmd\ \[format\ \{return\ \[namespace\ eval\ %s\ %s\ %s\ \$args\]\}\ \\\n\t\t\t\t\t\ \ \ \ \ callib\ \ \ \ \ \\\n\t\t\t\t\t\ \ \ \ \ calproc\ \ \ \ \\\n\t\t\t\t\t\ \ \ \ \ \$newWidget\ \]\n\ \ \ #\ declare\ new\ proc\ to\ be\ called\ when\ the\ widget\ is\ accessed\n\ \ \ proc\ \$newWidget\ \{args\}\ \$newCmd\n\n\ \ \ return\ \$newWidget\n\ \}\ \;#\ END\ calwid\n\n\ namespace\ eval\ callib\ \{\n\ \ \ \ #\ config\ data\ for\ every\ calwid\ widget\n\ \ \ \ variable\ calState\n\n\ \ \ \ set\ calState(unique)\ 0\n\n\ \ \ \ proc\ MakecalendarWid\ \{args\}\ \{\n\ \ \ \ ##################################\n\ \ \ \ #\ procedure\ to\ create\ a\ calendar\ #\n\ \ \ \ ##################################\n\tvariable\ calState\n\n\t#make\ unique\ name\ per\ default\n\tset\ holder\ .calwid_\$calState(unique)\n\tincr\ calState(unique)\n\t#if\ a\ window\ name\ was\ given\ on\ the\ command\ line\ then\ use\ it\n\t#overwriting\ the\ already\ computed\ name\n\tif\ \{\[string\ first\ \".\"\ \[lindex\ \$args\ 0\]\]\ ==\ 0\}\ \{\n\t\ \ \ \ #\ put\ the\ wanted\ name\ in\ holder\n\t\ \ \ \ set\ holder\ \[lindex\ \$args\ 0\]\ \n\t\ \ \ \ #\ remove\ the\ name\ from\ args\n\t\ \ \ \ set\ args\ \[lreplace\ \$args\ 0\ 0\]\n\t\ \ \}\;#\ END\ window\ path\ given\n\n\t#make\ defaults\ for\ the\ command\ line\ args\n\t#year\n\tset\ calState(\$holder.year)\ \[clock\ format\ \[clock\ scan\ now\]\ -format\ \"%Y\"\]\n\t#month\n\tset\ mon_num\ \[clock\ format\ \[clock\ scan\ now\]\ -format\ \"%m\"\]\n\t#month\ starts\ with\ 0,\ can\ be\ interpreted\ as\ octal\ ->remove\ leading\ 0\n\tset\ mon_num\ \[string\ trimleft\ \$mon_num\ \"0\"\]\n\tset\ calState(\$holder.month)\ \$mon_num\ \n\t#week\ starts\ on\ sunday\ in\ the\ us\ and\ on\ monday\ in\ germany\n\tset\ calState(\$holder.startsunday)\ 0\n\t#font\ defaults\n\tset\ calState(\$holder.font)\ \[list\ Lucidatypewriter\ 12\ normal\]\n\t#day\ names,\ change\ the\ defaults\ to\ the\ language\ needed\n\tset\ calState(\$holder.daynames)\ \[list\ \"So\"\ \"Mo\"\ \"Di\"\ \"Mi\"\ \"Do\"\ \"Fr\"\ \"Sa\"\]\n\t#day\ font\n\tset\ calState(\$holder.dayfont)\ \[list\ Lucidatypewriter\ 12\ bold\]\n\t#command\ registered\ as\ callback\n\tset\ calState(\$holder.callback)\ \"\"\n\t#\ marking\ list\ for\ days,\ a\ mark\ is\ a\ list\ containing\ a\ date\n\t#\ a\ mark\ priority\ and\ a\ mark\ color,\ if\ one\ day\ has\ multiple\ marks\n\t#\ the\ color\ of\ the\ highest\ priority\ is\ shown,\ if\ balloons\ are\ enabled\n\t#\ then\ all\ the\ marks\ texts\ in\ descending\ prio\ order\ are\ shown.\n\t#\ the\ list\ is\ \{day\ month\ year\ prio\ color\ label\}\n\tset\ calState(\$holder.mark)\ \{\}\n\t#\ this\ list\ contains\ the\ marks\ for\ the\ shown\ month\n\tset\ calState(\$holder.shownmarks)\ \{\}\n\t#\ last\ clicked\ gets\ row\ col\ address\ of\ the\ last\ clicked\ button\n\tset\ calState(\$holder.clicked)\ \{\}\n\t#\ last\ clicked\ gets\ the\ color\ of\ clicked\n\tset\ calState(\$holder.clickedcolor)\ \"yellow\"\n\t#\ default\ background\ goes\ here,\ as\ a\ default\ rootwindows\ background\n\t#\ is\ used\n\tset\ calState(\$holder.background)\ \[.\ cget\ -background\]\n\t#\ the\ default\ active\ background\ goes\ here,\ white\n\tset\ calState(\$holder.activebackground)\ \"white\"\n\t#\ progcallback:\ if\ set\ to\ 1,\ setting\ clicked\ will\ invoke\ callback\n\t#\t\ \ \ \ \ \ \ if\ set\ to\ 0,\ setting\ clicked\ will\ not\ invoke\ callback\n\t#\ defaults\ to\ 1\n\tset\ calState(\$holder.progcallback)\ 1\n\t#\ balloons\ containing\ the\ mark\ texts,\ 1\ enabled,\ 0\ disables\n\tset\ calState(\$holder.balloon)\ \ \ \ \ \ 1\n\t#\ set\ the\ delay\ for\ the\ balloon\ here\n\tset\ calState(\$holder.delay)\ \ \ \ \ 1000\n\t#\ set\ the\ relief\ \n\tset\ calState(\$holder.relief)\ \ \ \ groove\n\t#\ set\ the\ relief\ \n\tset\ calState(\$holder.foreground)\ \ \ \ black\n\n\t#\ check\ whether\ options\ are\ valid\n\tforeach\ \{opt\ val\}\ \$args\ \{\n\t\ \ \ \ #\ get\ rid\ of\ leading\ -\n\t\ \ \ \ set\ option\ \[string\ range\ \$opt\ 1\ end\]\ \n\t\ \ \ \ if\ \{!\[info\ exists\ calState(\$holder.\$option)\]\}\ \{\n\t\t#\ create\ oklist\ containing\ the\ possible\ commands\n\t\tregsub\ -all\ \"\$holder.\"\ \[array\ names\ calState\ \$holder.*\]\ \\\n\t\t\t\ \ \ \ \"\"\t\ oklist\n\n\t\terror\ \"Bad\ Option,\ '\$option'\\n\ Valid\ options\ are\ \$oklist\"\n\t\ \ \ \ \ \ \}\;#\ END:\ if\ option\ not\ in\ the\ calendar\ state\ array\n\t\ \ \ \ set\ calState(\$holder.\$option)\ \$val\ \ \n\t\ \ \}\;#\ END:\ foreach\ option\ value\ pair\n\n\t#\ make\ a\ frame\ to\ hold\ it\ all.\ Declare\ the\ class\ as\ being\ Calendar\n\tframe\ \$holder\ -class\ Calendar\ \n\t#\ make\ the\ frames\ innards\n\tDraw\ \$holder\n\t#\ rename\ the\ frame\ to\ give\ the\ widget\ the\ name\ \$holder\n\tuplevel\ #0\ rename\ \$holder\ \$holder.fr\n\t#call\ the\ update\ procedure\ to\ use\ configuration\ options\ given\ at\ start\n\tupdate_cal\ \ \$holder\n\t#\ clean\ up\ after\ destruction\ of\ the\ widget\n\t#\ TODO\ unset\ the\ associated\ array\ elements\ \n\t#\ TODO\ implement\ a\ cleanup\ proc\ to\ take\ care\ of\ cleaning\ up\n\tbind\ \$holder\ <Destroy>\ \"+\ rename\ \$holder\ \{\}\"\n\t#\ return\ the\ name\ of\ the\ new\ widget\n\treturn\ \$holder\n\ \ \ \ \ \ \}\;#\ END\ MakecalendarWid\n\ \ \ \ \n\ \ \ \ proc\ Draw\ \{parent\}\ \{\n\ \ \ \ ###########################################################\n\ \ \ \ #\ this\ proc\ takes\ care\ of\ drawing\ and\ packing\ the\ widgets\ #\ \ \ \ \ \ \n\ \ \ \ ###########################################################\n\tvariable\ calState\n\n\t#\ make\ the\ weekday\ list\n\tset\ weekdays\ \$calState(\$parent.daynames)\n\tif\ \{\$calState(\$parent.startsunday)\ !=\ 1\}\ \{\n\t\ \ \ \ set\ weekdays\ \[roll_left\ \$weekdays\]\n\t\ \ \}\;#\ END\ if\ not\ start\ on\ sunday\ ->\ start\ on\ monday\ \n\t#\ make\ labels\ for\ the\ days\ header\n\tset\ colcount\ 0\n\tforeach\ day\ \$weekdays\ \{\n\t\ \ \ \ set\ daylabel\ \$parent.\$colcount\n\t\ \ \ \ label\ \$daylabel\ \n\t\ \ \ \ grid\ \ \$daylabel\ \ -row\ 1\ -column\ \$colcount\ -ipadx\ 0\ -ipady\ 0\n\t\ \ \ \ incr\ colcount\n\t\ \ \}\;#END:\ foreach\ day\ in\ weekday\ \n\t#\ get\ monthlist\ according\ to\ startsunday\ variable\n\tset\ month\ \$calState(\$parent.month)\n\tset\ year\ \ \$calState(\$parent.year)\n\tset\ monthlist\ \[cal_list_month\ \$month\ \\\n\t\t\t\t\ \ \ \ \ \ \$year\ \ \\\n\t\t\t\t\ \ \ \ \ \ \$calState(\$parent.startsunday)\ \]\n\t#\ make\ the\ buttons\ for\ the\ calendar,\ buttons\ needed\ \n\t#\ as\ there\ will\ be\ commands\ associated\ with\ them\n\t#\ was\ button,\ switched\ to\ labels\ bacause\ buttons\ look\ \n\t#\ ugly\ under\ Aqua,\ callbacks\ &\ activebackground\ implemented\ \n\t#\ via\ bind\n\tfor\ \{set\ row\ 0\}\ \{\$row<6\}\ \{incr\ row\}\ \{\n\t\ \ for\ \{set\ col\ 0\}\ \{\$col<7\}\ \{incr\ col\}\ \{\n\t\ \ \ \ \ \ label\ \$parent.\$col\$row\ -highlightthickness\ 2\ \ \n\t\ \ \ \ \ \ grid\ \$parent.\$col\$row\ -padx\ 0\ -pady\ 0\ -ipadx\ 0\ -ipady\ 0\ \\\n\t\t\t\t\ \ \ \ -row\ \[expr\ \{\$row+2\}\]\ -column\ \$col\ \n\t\ \ \ \ \}\;#END:\ col\n\t\ \ \}\;#END:\ row\n\ \ \ \ \ \ \}\;#\ END:\ draw\ the\ widgets\n\n\ \ \ \ proc\ callback\ \{parent\ col\ row\}\ \{\n\ \ \ \ ###############################################################\n\ \ \ \ #\ this\ procedure\ gets\ called\ whenever\ a\ day\ button\ is\ pressed\ #\n\ \ \ \ ###############################################################\n\tvariable\ calState\n\n\t#\ cleanup\ previously\ clicked\n\tset\ old_col\ \[lindex\ \$calState(\$parent.clicked)\ 0\]\ \ \n\tset\ old_row\ \[lindex\ \$calState(\$parent.clicked)\ 1\]\ \ \n\n\tif\ \{\$old_row\ !=\ \"\"\}\ \{\n\t\ \ \ \ set\ button_name\ \$parent.\$old_col\$old_row\n\t\ \ \ \ \$button_name\ configure\ -background\ \$calState(\$parent.background)\n\t\ \ \}\;#\ END:\ there\ was\ a\ clicked\ button\n\t#\ change\ the\ clicked\ button\ appropriately\n\tset\ calState(\$parent.clicked)\ \[list\ \$col\ \$row\]\n\tset\ button_name\ \$parent.\$col\$row\n\t\$button_name\ configure\ -background\ \$calState(\$parent.clickedcolor)\n\t\$button_name\ configure\ -background\ \$calState(\$parent.clickedcolor)\n\t#\ get\ the\ daynames\ from\ the\ state\ array\n\tset\ namelist\ \$calState(\$parent.daynames)\n\t#\ if\ start\ on\ monday\ roll\ the\ list\ \n\tif\ \{\$calState(\$parent.startsunday)\ !=\ 1\}\ \{\n\t\ \ \ \ set\ namelist\ \[roll_left\ \$namelist\]\n\t\ \ \}\n\t#\ make\ the\ arguments\ for\ the\ user\ defined\ callback\ procedure\ \ \n\tset\ callargs\ \[list\ \$calState(\$parent.year)\t\t\t\ \\\n\t\t\t\ \ \ \$calState(\$parent.month)\t\t\t\\\n\t\t\t\ \ \ \[string\ trimleft\ \[\$parent.\$col\$row\ cget\ -text\]\]\ \\\n\t\t\t\ \ \ \[lrange\ \$namelist\ \$col\ \$col\]\t\t\ \ \ \ \\\n\t\t\t\ \ \ \$col\t\t\t\t\t\ \ \ \ \\\n\t\t\t\ \ \ \$row\]\n\t\t\t\ \ \ \n\t#\ procedure\ name\t\t\ \ \ \n\tset\ procname\ \$calState(\$parent.callback)\n\t#\ if\ there\ is\ something\ registered\ as\ callback,\ call\ it\n\tif\ \{\$procname\ !=\ \"\"\}\ \{\n\t\ \ \ \ eval\ \$procname\ \$callargs\n\t\ \ \}\n\ \ \ \ \ \ \}\n\n\ \ \ \ proc\ update_cal\ \{parent\}\ \{\n\ \ \ \ ##################################################################\n\ \ \ \ #\ this\ proc\ updates\ the\ calendar\ shown\ according\ to\ the\ contents\ #\n\ \ \ \ #\ of\ the\ calState\ array\t\t\t\t\t\ \ #\n\ \ \ \ ##################################################################\n\tvariable\ calState\n\n\t#\ set\ the\ frame\ color\ to\ the\ background\n\t\$parent.fr\ configure\ -background\ \$calState(\$parent.background)\n\t#\ make\ the\ weekday\ list\n\tset\ weekdays\ \$calState(\$parent.daynames)\n\tif\ \{\$calState(\$parent.startsunday)\ !=\ 1\}\ \{\n\t\ \ \ \ set\ weekdays\ \[roll_left\ \$weekdays\]\n\t\ \ \}\;#\ END\ if\ not\ start\ on\ sunday\ ->\ start\ on\ monday\ \n\t#\ update\ labels\ for\ the\ days\ header\n\tset\ colcount\ 0\n\tforeach\ day\ \$weekdays\ \{\n\t\ \ \ \ set\ daylabel\ \$parent.\$colcount\n\t\ \ \ \ set\ day\ \[string\ range\ \$day\ 0\ 1\]\n\t\ \ \ \ \$daylabel\ configure\ -text\ \$day\ -width\ 2\t\t\ \ \ \ \ \ \ \\\n\t\t\t\t-font\ \$calState(\$parent.dayfont)\t\ \ \\\n\t\t\t\t-foreground\ \$calState(\$parent.foreground)\ \\\n\t\t\t\t-background\ \$calState(\$parent.background)\n\t\ \ \ \ incr\ colcount\n\t\ \ \}\;#END:\ foreach\ day\ in\ weekday\ \n\n\t#\ get\ monthlist\ according\ to\ startsunday\ variable\n\tset\ month\ \$calState(\$parent.month)\n\tset\ year\ \ \$calState(\$parent.year)\n\tset\ monthlist\ \[cal_list_month\ \$month\ \\\n\t\t\t\t\ \ \ \ \ \ \$year\ \ \\\n\t\t\t\t\ \ \ \ \ \ \$calState(\$parent.startsunday)\]\n\t#\ make\ an\ array\ with\ the\ day\ as\ index\ and\ the\ buttons\ coords\ as\ value\n\t#\ will\ be\ used\ while\ processing\ the\ marked\ days\n\t#\ first\ delete\ the\ array\n\tcatch\ \{unset\ index_arr\}\n\t#\ fill\ buttons\ with\ the\ stuff\n\tfor\ \{set\ row\ 0\}\ \{\$row<6\}\ \{incr\ row\}\ \{\n\t\ \ for\ \{set\ col\ 0\}\ \{\$col<7\}\ \{incr\ col\}\ \{\n\t\ \ \ \ \ \ set\ text\ \ \[lindex\ \$monthlist\ \[expr\ \{7*\$row+\$col\}\]\ \]\n\t\ \ \ \ \ \ set\ index_arr(\$text)\ \$col\$row\n\t\ \ \ \ \ \ #\ set\ default\ values,\ change\ them\ if\ day\ field\ is\ empty\n\t\ \ \ \ \ \ set\ reliefval\ \$calState(\$parent.relief)\n\t\ \ \ \ \ \ set\ stateval\ \ normal\n\t\ \ \ \ \ \ bind\ \$parent.\$col\$row\ <Any-Enter>\ \[list\ callib::enter_proc\ %W\]\ \n\t\ \ \ \ \ \ bind\ \$parent.\$col\$row\ <Any-Leave>\ \[list\ callib::leave_proc\ %W\]\ \n\t\ \ \ \ \ \ bind\ \$parent.\$col\$row\ <Button-1>\ \ \[list\ callib::callback\ \\\n\t\t\t\t\t\t\ \ \ \ \ \ \ \$parent\t\ \\\n\t\t\t\t\t\t\ \ \ \ \ \ \ \$col\t\ \ \ \ \\\n\t\t\t\t\t\t\ \ \ \ \ \ \ \$row\]\n\t\ \ \ \ \ \ if\ \{\$text\ ==\ \"\"\}\ \{\n\t\t\ \ set\ reliefval\ flat\n\t\t\ \ set\ stateval\ \ disabled\n\t\t\ \ bind\ \$parent.\$col\$row\ <Any-Enter>\ \{\}\n\t\t\ \ bind\ \$parent.\$col\$row\ <Any-Leave>\ \{\}\n\t\t\ \ bind\ \$parent.\$col\$row\ <Button-1>\ \ \{\}\n\t\t\}\;#\ END:\ if\ dayfield\ is\ empty\n\t\ \ \ \ \ \ #\ reconfigure\ the\ button\ \n\t\ \ \ \ \ \ \$parent.\$col\$row\ configure\ -relief\ \$reliefval\ -state\ \$stateval\ \\\n\t\t\t\t\t\ -borderwidth\ 2\t\t\ \ \ \ \ \ \\\n\t\t\t\t\t\ -width\ 2\t\t\t\ \ \ \ \\\n\t\t\t\t\t\ -background\t\t\t\ \\\n\t\t\t\t\t\ \ \ \$calState(\$parent.background)\ \ \ \ \ \\\n\t\t\t\t\t\ -highlightbackground\t\t\\\n\t\t\t\t\t\ \ \ \$calState(\$parent.background)\ \ \ \ \ \\\n\t\t\t\t\t\ -font\ \$calState(\$parent.font)\ \ \ \ \ \ \ \\\n\t\t\t\t\t\ -text\ \[format\ \"%2s\"\ \$text\]\t\ \ \\\n\t\t\t\t\t\ -justify\ center\t\t\ \ \ \ \ \\\n\t\t\t\t\t\ -foreground\t\t\t\ \\\n\t\t\t\t\t\ \ \ \$calState(\$parent.foreground)\n\t\ \ \ \ \}\;#END:\ col\n\t\ \ \}\;#END:\ row\n\t#\ check\ if\ there\ is\ a\ clicked\ day\ &\ update\ the\ color\ according\ to\ \n\t#\ calstate\ array\n\tset\ col\ \[lindex\ \$calState(\$parent.clicked)\ 0\]\ \ \n\tset\ row\ \[lindex\ \$calState(\$parent.clicked)\ 1\]\ \ \n\tif\ \{(\$row\ !=\ \"\")\ &&\ (\$col\ !=\ \"\")\}\ \{\n\t\ \ \ \ \$parent.\$col\$row\ configure\ -background\ \\\n\t\t\t\t\t\ \$calState(\$parent.clickedcolor)\n\t\ \ \}\n\t#\ check\ if\ there\ are\ days\ in\ the\ marked\ list\ that\ are\ displayed\n\t#\ right\ now\ and\ mark\ them\n\t#\ put\ the\ needed\ part\ of\ mark\ list\ into\ the\ shownmarks\ list\n\tset\ calState(\$parent.shownmarks)\ \{\}\n\tforeach\ Mlist\ \$calState(\$parent.mark)\ \{\n\t\ \ \ \ foreach\ \{Mday\ Mmonth\ Myear\ Mpri\ Mcol\ Mlabel\}\ \$Mlist\ \{\}\n\t\ \ \ \ if\ \{\$Myear\ ==\ \$calState(\$parent.year)\}\ \{\n\t\tif\ \{\$Mmonth\ ==\ \$calState(\$parent.month)\}\ \{\n\t\t\ \ \ \ lappend\ calState(\$parent.shownmarks)\ \$Mlist\n\t\t\ \ \}\n\t\ \ \ \ \ \ \}\n\t\ \ \}\n\t#\ sort\ the\ array\ in\ ascending\ order\ of\ prio\n\t#\ so\ that\ highest\ prio\ is\ at\ the\ end\n\tset\ calState(\$parent.shownmarks)\ \\\n\t\ \ \[lsort\ -index\ 3\ -integer\ \$calState(\$parent.shownmarks)\]\ \n\t#\ start\ @\ beginnig\ of\ array\ and\ reconfigure\ the\ buttons\ the\ \n\t#\ last\ marks\ will\ be\ of\ highest\ prio\ &\ will\ determine\ the\ marking\ color\n\t#\ automatically.\ Not\ blazingly\ fast,\ might\ tune\ later\n\tforeach\ Mlist\ \$calState(\$parent.shownmarks)\ \{\n\t\ \ \ \ #\ month\ &\ year\ are\ matching\ the\ shown\ ones,\ get\ the\ day\n\t\ \ \ \ foreach\ \{Mday\ Mmonth\ Myear\ Mpri\ Mcol\ Mlabel\}\ \$Mlist\ \{\}\n\t\ \ \ \ \$parent.\$index_arr(\$Mday)\ configure\ -highlightbackground\ \$Mcol\ \n\t\ \ \}\n\t#\ delete\ the\ array\ \ \n\tcatch\ \{unset\ index_arr\}\n\t#\ return\ used\ here\ to\ avoid\ returning\ the\ value\ of\ the\ catch\n\treturn\ \n\ \ \ \ \ \ \}\;#\ END\ update_cal\n\n\ \ \ \ proc\ enter_proc\ \{wname\}\ \{\n\ \ \ \ ###################################\n\ \ \ \ #\ gets\ called\ at\ each\ enter\ event\ #\n\ \ \ \ ###################################\n\tvariable\ calState\n\n\t#\ get\ parents\ name\n\tset\ parent\ \[winfo\ parent\ \$wname\]\n\t#\ set\ active\ color\n\t\$wname\ configure\ -background\ \$calState(\$parent.activebackground)\n\t#\ trigger\ the\ balloon\n\tafter\ \$calState(\$parent.delay)\ \[list\ callib::balloon_show\ \$wname\]\ \n\ \ \ \ \ \ \}\n\n\ \ \ \ proc\ leave_proc\ \{wname\}\ \{\n\ \ \ \ ###################################\n\ \ \ \ #\ gets\ called\ at\ each\ leave\ event\ #\n\ \ \ \ ###################################\n\tvariable\ calState\n\n\t#\ get\ parents\ name\n\tset\ parent\ \[winfo\ parent\ \$wname\]\n\t#\ set\ inactive\ color\n\t\$wname\ configure\ -background\ \$calState(\$parent.background)\n\t#\ check\ if\ the\ label\ was\ \"clicked\"\ and\ set\ the\ color\ to\ clickedcolor\n\tset\ col\ \[lindex\ \$calState(\$parent.clicked)\ 0\]\ \ \n\tset\ row\ \[lindex\ \$calState(\$parent.clicked)\ 1\]\ \ \n\tif\ \{\$row\ !=\ \"\"\}\ \{\n\t\ \ \ \ set\ label_name\ \$parent.\$col\$row\n\t\ \ \ \ \$label_name\ configure\ -background\ \$calState(\$parent.clickedcolor)\n\t\ \ \}\;#\ END:\ there\ was\ a\ clicked\ button\n\t#\ close\ the\ balloon\n\tballoon_dn\ \$wname\ \n\ \ \ \ \ \ \}\n\n\ \ \ \ proc\ balloon_show\ \{wname\}\ \{\n\ \ \ \ #######################################\n\ \ \ \ #\ triggers\ a\ balloon\ help\ like\ window\ #\n\ \ \ \ #######################################\n\tvariable\ calState\n\n\t#\ get\ parents\ name\n\tset\ parent\ \[winfo\ parent\ \$wname\]\n\t#\ in\ case\ the\ balloons\ \ are\ disabled\ do\ nothing\n\tif\ \{\$calState(\$parent.balloon)\ ==\ 0\}\ return\n\t#\ in\ case\ we\ already\ left\ the\ widget\ do\ nothing\n\tset\ currentwin\ \[eval\ winfo\ containing\ \[winfo\ pointerxy\ .\]\]\n\tif\ \{!\[string\ match\ \$currentwin\ \$wname\]\}\ return\n\t#\ make\ a\ string\ with\ the\ marks\ of\ the\ date\ shown\ by\ the\ requester\n\tset\ day\ \[string\ trim\ \[\$wname\ cget\ -text\]\]\n\tset\ message_str\ \"\"\n\tforeach\ Mlist\ \$calState(\$parent.shownmarks)\ \{\n\t\ \ \ \ foreach\ \{Mday\ Mmonth\ Myear\ Mpri\ Mcol\ Mlabel\}\ \$Mlist\ \{\}\n\t\ \ \ \ if\ \{(\$Mday\ ==\ \$day)\}\ \{append\ message_str\ \"\$Mpri\ \$Mlabel\\n\"\}\n\t\ \ \}\n\tset\ message_str\ \[string\ trim\ \$message_str\]\n\t#\ if\ there\ are\ no\ marks\ for\ requesters\ widget\ return\n\tif\ \{!\[string\ length\ \$message_str\]\}\ return\n\t#\ create\ a\ top\ level\ window\n\tset\ top\ \$parent.balloon\n\tcatch\ \{destroy\ \$top\}\n\ttoplevel\ \$top\ -borderwidth\ 1\ -background\ black\ -relief\ flat\n\twm\ overrideredirect\ \$top\ 1\n\t#\ create\ the\ message\ widget\n\tmessage\ \$top.msg\ -text\ \$message_str\ \ -width\ 3i\\\n\t\t\t\ -font\ \$calState(\$parent.font)\\\n\t\t\t\ -background\ yellow\ -foreground\ darkblue\n\tpack\ \$top.msg\n\t#\ get\ the\ geometry\ data\ of\ the\ requester\n\tset\ wmx\ \[expr\ \[winfo\ rootx\ \$wname\]+\[winfo\ width\ \ \$wname\]\]\n\tset\ wmy\ \[expr\ \[winfo\ rooty\ \$wname\]+\[winfo\ height\ \$wname\]\]\n\twm\ geometry\ \$top\ \\\n\t\ \ \[winfo\ reqwidth\ \$top.msg\]x\[winfo\ reqheight\ \$top.msg\]+\$wmx+\$wmy\n\t#\ raise\ so\ that\ win\ is\ really\ on\ top\n\traise\ \$top\n\ \ \ \ \ \ \}\;#\ end\ balloon_show\ \n\n\ \ \ \ proc\ balloon_dn\ \{wname\}\ \{\n\ \ \ \ ###############################\n\ \ \ \ #\ makes\ the\ balloon\ disappear\ #\n\ \ \ \ ###############################\n\tvariable\ calState\n\n\t#\ get\ parents\ name\n\tset\ parent\ \[winfo\ parent\ \$wname\]\n\t#\ in\ case\ the\ balloons\ \ are\ disabled\ do\ nothing\n\tif\ \{\$calState(\$parent.balloon)\ ==\ 0\}\ return\n\t#\ destroy\ the\ help\ balloon\n\tcatch\ \{destroy\ \$parent.balloon\}\n\ \ \ \ \ \ \}\;#\ end\ balloon_dn\n\n\ \ \ \ proc\ calproc\ \{parent\ args\}\ \{\n\ \ \ \ ################################################################\n\ \ \ \ #\ This\ proc\ takes\ care\ of\ all\ the\ configuration\ subcommands\ of\ #\n\ \ \ \ #\ the\ calendar\ widget\t\t\t\t\t\ \ #\n\ \ \ \ ################################################################\n\tvariable\ calState\n\n\t#\ make\ a\ list\ of\ allowed\ commands\n\t#\ new\ commands\ should\ be\ dropped\ here\ &\ processed\ in\ the\ switch\ \n\t#\ statement\ along\ with\ the\ possible\ subcommands\n\tset\ commList\ \[list\ \"nextmonth\"\ \"prevmonth\"\ \\\n\t\t\t\ \ \ \"nextyear\"\ \ \"prevyear\"\ \ \\\n\t\t\t\ \ \ \"configure\"\]\n\t#\ extract\ the\ first\ word\ in\ args,\ this\ must\ be\ in\ the\ commList\n\tset\ command\ \[lindex\ \$args\ 0\]\n\tif\ \{\[lsearch\ -exact\ \$commList\ \$command\]\ ==\ -1\}\ \{\n\t\ \ \ \ error\ \"unknown\ command\ for\ \$parent,\ possible\ command(s):\\n\\\n\t\t\ \ \ \$commList\"\n\t\ \ \}\;#\ END:\ check\ whether\ command\ is\ known\ to\ widget\n\n\t#\ remove\ the\ parent\ name\ from\ the\ args\ list\n\tset\ \ args\ \[lreplace\ \$args\ 0\ 0\]\n\n\tswitch\ --\ \$command\ \{\n\t\ \ \ \ \"configure\"\ \{\n\t\t#\ if\ there\ are\ no\ arguments\ to\ configure\n\t\t#\ then\ return\ a\ list\ with\ all\ the\ configuration\n\t\tif\ \{\$args\ ==\ \"\"\}\ \{\n\t\t\ \ \ \ set\ optlist\ \[array\ get\ calState\ \"\$parent.*\"\]\n\t\t\ \ \ \ set\ returnlist\ \"\"\n\t\t\ \ \ \ foreach\ \{opt\ val\}\ \$optlist\ \{\n\t\t\tregsub\ \"\$parent.\"\ \$opt\ \"\"\ opt\n\t\t\t#\ shownmarks\ is\ a\ private\ field,\ so\ leave\ it\ out\n\t\t\tif\ \{\$opt\ !=\ \"shownmarks\"\}\ \{\n\t\t\t\ \ \ \ lappend\ returnlist\ \[list\ \$opt\ \$val\]\n\t\t\t\ \ \}\ \ \n\t\t\ \ \ \ \ \ \}\n\t\t\ \ \ \ return\ \$returnlist\ \ \n\t\t\ \ \}\;#\ END:\ if\ no\ args\ for\ configure\n\t\tforeach\ \{opt\ val\}\ \$args\ \{\n\t\t\ \ \ \ switch\ --\ \$opt\ \{\n\t\t\t\"-font\"\ \{\n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"\"\}\ \{\n\t\t\t\treturn\ \$calState(\$parent.font)\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ if\ no\ font\ specified\n\t\t\t\ \ \ \ #\ might\ want\ to\ check\ whether\ font\ is\ available\ \ \n\t\t\t\ \ \ \ set\ calState(\$parent.font)\ \$val\n\t\t\t\ \ \}\n\t\t\t\"-background\"\ \{\n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"\"\}\ \{\n\t\t\t\treturn\ \$calState(\$parent.background)\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ if\ no\ color\ specified\n\t\t\t\ \ \ \ set\ er\ \[catch\ \{label\ .tmp\ -background\ \$val\}\ result\]\n\t\t\t\ \ \ \ destroy\ .tmp\ \ \ \n\t\t\t\ \ \ \ if\ \{\$er\}\ \{\n\t\t\t\terror\ \"Problem\ with\ the\ color\ value\\n\\\n\t\t\t\t\ \ \ \ \ \ color\ is\ \\\"\$val\\\"\"\n\t\t\t\treturn\n\t\t\t\ \ \ \ \ \ \}\n\t\t\t\ \ \ \ set\ calState(\$parent.background)\ \$val\n\t\t\t\ \ \}\n\t\t\t\"-foreground\"\ \{\n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"\"\}\ \{\n\t\t\t\treturn\ \$calState(\$parent.foreground)\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ if\ no\ color\ specified\n\t\t\t\ \ \ \ set\ er\ \[catch\ \{label\ .tmp\ -foreground\ \$val\}\ result\]\n\t\t\t\ \ \ \ destroy\ .tmp\ \ \ \n\t\t\t\ \ \ \ if\ \{\$er\}\ \{\n\t\t\t\terror\ \"Problem\ with\ the\ color\ value\\n\\\n\t\t\t\t\ \ \ \ \ \ color\ is\ \\\"\$val\\\"\"\n\t\t\t\treturn\n\t\t\t\ \ \ \ \ \ \}\n\t\t\t\ \ \ \ set\ calState(\$parent.foreground)\ \$val\n\t\t\t\ \ \}\n\t\t\t\"-activebackground\"\ \{\n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"\"\}\ \{\n\t\t\t\treturn\ \$calState(\$parent.activebackground)\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ if\ no\ color\ specified\n\t\t\t\ \ \ \ set\ er\ \[catch\ \{label\ .tmp\ -background\ \$val\}\ result\]\n\t\t\t\ \ \ \ destroy\ .tmp\ \ \ \n\t\t\t\ \ \ \ if\ \{\$er\}\ \{\n\t\t\t\terror\ \"Problem\ with\ the\ color\ value\\n\\\n\t\t\t\t\ \ \ \ \ \ color\ is\ \\\"\$val\\\"\"\n\t\t\t\treturn\n\t\t\t\ \ \ \ \ \ \}\n\t\t\t\ \ \ \ set\ calState(\$parent.activebackground)\ \$val\n\t\t\t\ \ \}\n\t\t\t\"-dayfont\"\ \{\n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"\"\}\ \{\n\t\t\t\treturn\ \$calState(\$parent.dayfont)\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ if\ no\ dayfont\ specified\n\t\t\t\ \ \ \ set\ calState(\$parent.dayfont)\ \$val\n\t\t\t\ \ \}\n\t\t\t\"-clickedcolor\"\ \{\n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"\"\}\ \{\n\t\t\t\treturn\ \$calState(\$parent.clickedcolor)\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ if\ no\ clicked\ color\ specified\n\t\t\t\ \ \ \ set\ er\ \[catch\ \{label\ .tmp\ -background\ \$val\}\ result\]\n\t\t\t\ \ \ \ destroy\ .tmp\ \ \ \n\t\t\t\ \ \ \ if\ \{\$er\}\ \{\n\t\t\t\terror\ \"Problem\ with\ the\ color\ value\\n\\\n\t\t\t\t\ \ \ \ \ \ color\ is\ \\\"\$val\\\"\"\n\t\t\t\treturn\n\t\t\t\ \ \ \ \ \ \}\n\t\t\t\ \ \ \ set\ calState(\$parent.clickedcolor)\ \$val\n\t\t\t\ \ \}\n\t\t\t\"-relief\"\ \{\n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"\"\}\ \{\n\t\t\t\treturn\ \$calState(\$parent.relief)\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ if\ no\ relief\ specified\n\t\t\t\ \ \ \ set\ er\ \[catch\ \{label\ .tmp\ -relief\ \$val\}\ result\]\n\t\t\t\ \ \ \ destroy\ .tmp\ \ \ \n\t\t\t\ \ \ \ if\ \{\$er\}\ \{\n\t\t\t\terror\ \"Problem\ with\ the\ relief\ value\\n\\\n\t\t\t\t\ \ \ \ \ \ relief\ is\ \\\"\$val\\\"\"\n\t\t\t\treturn\n\t\t\t\ \ \ \ \ \ \}\n\t\t\t\ \ \ \ set\ calState(\$parent.relief)\ \$val\n\t\t\t\ \ \}\n\t\t\t\"-startsunday\"\ \{\n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"\"\}\ \{\n\t\t\t\treturn\ \$calState(\$parent.startsunday)\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ \ if\ no\ value\ for\ start\ sunday\n\t\t\t\ \ \ \ set\ calState(\$parent.startsunday)\ 0\ \ \n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"1\"\}\ \{\n\t\t\t\tset\ calState(\$parent.startsunday)\ 1\n\t\t\t\ \ \ \ \ \ \}\ \n\t\t\t\ \ \ \ #\ get\ rid\ of\ clicked\ state\ as\ calendar\ is\ going\n\t\t\t\ \ \ \ #\ to\ change\ layout\n\t\t\t\ \ \ \ set\ calState(\$parent.clicked)\ \{\}\ \ \n\t\t\t\ \ \}\n\t\t\t\"-balloon\"\ \{\n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"\"\}\ \{\n\t\t\t\treturn\ \$calState(\$parent.balloon)\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ \ if\ no\ value\ for\ balloon\n\t\t\t\ \ \ \ set\ calState(\$parent.balloon)\ 0\ \ \n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"1\"\}\ \{\n\t\t\t\tset\ calState(\$parent.balloon)\ 1\n\t\t\t\ \ \ \ \ \ \}\ \n\t\t\t\ \ \}\n\t\t\t\"-delay\"\ \{\n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"\"\}\ \{\n\t\t\t\treturn\ \$calState(\$parent.delay)\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ \ if\ no\ value\ for\ balloon\ delay\n\t\t\t\ \ \ \ #\ delay\ check:\ must\ be\ integer\n\t\t\t\ \ \ \ set\ er\ \[catch\ \{incr\ val\ 0\}\]\n\t\t\t\ \ \ \ if\ \{\$er\}\ \{\n\t\t\t\terror\ \"Problem\ with\ the\ delay\ value\\n\\\n\t\t\t\t\ \ \ \ \ \ most\ likely\ a\ non\ integer\ value\ \\n\\\n\t\t\t\t\ \ \ \ \ \ given\ delay\ is\ \\\"\$val\\\"\"\n\t\t\t\treturn\n\t\t\t\ \ \ \ \ \ \}\n\t\t\t\ \ \ \ if\ \{\$val\ <\ 0\}\ \{\n\t\t\t\terror\ \"Problem\ with\ negative\ delay\ value\\n\\\n\t\t\t\t\ \ \ \ \ \ given\ delay\ is\ \\\"\$val\\\"\"\n\t\t\t\treturn\n\t\t\t\ \ \ \ \ \ \}\n\t\t\t\ \ \ \ set\ calState(\$parent.delay)\ \$val\ \n\t\t\t\ \ \}\n\t\t\t\"-progcallback\"\ \{\n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"\"\}\ \{\n\t\t\t\treturn\ \$calState(\$parent.progcallback)\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ \ if\ no\ value\ for\ progcallback\n\t\t\t\ \ \ \ set\ calState(\$parent.progcallback)\ 0\ \ \n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"1\"\}\ \{\n\t\t\t\tset\ calState(\$parent.progcallback)\ 1\n\t\t\t\ \ \ \ \ \ \}\ \n\t\t\t\ \ \}\n\t\t\t\"-mark\"\ \{\n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"\"\}\ \{\n\t\t\t\treturn\ \$calState(\$parent.mark)\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ if\ no\ marking\ list\ given\n\t\t\t\ \ \ \ if\ \{\[llength\ \$val\]\ !=\ 6\}\ \{\n\t\t\t\terror\ \"The\ mark\ list\ must\ have\ 6\ elements\\n\\\n\t\t\t\t\ \ \ \ \ \ \ a\ mark\ list\ should\ be\ like\ this:\ \ \\n\\\n\t\t\t\t\ \ \ \ \ \ \ \{day\ month\ year\ prio\ color\ label\}\"\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ if\ mark\ list\ not\ properly\ constructed\n\t\t\t\ \ \ \ \n\t\t\t\ \ \ \ #\ assign\ temp_vars\ \ \n\t\t\t\ \ \ \ foreach\ \{Mday\ Mmonth\ Myear\ Mpri\ Mcol\ Mlabel\}\ \$val\ \{\}\n\t\t\t\ \ \ \ \n\t\t\t\ \ \ \ #\ check\ the\ list\ fields\ for\ consistency\ \ \n\t\t\t\ \ \ \ #\ check\ the\ month\n\t\t\t\ \ \ \ if\ \{(\$Mmonth\ <\ 1)\ ||\ (\$Mmonth\ >\ 12)\}\ \{\n\t\t\t\terror\ \"Month\ out\ of\ range\"\n\t\t\t\treturn\n\t\t\t\ \ \ \ \ \ \}\n\t\t\t\ \ \ \ #\ check\ year\ and\ month,\ compute\ the\ number\ of\ days\n\t\t\t\ \ \ \ #\ of\ the\ given\ month\n\t\t\t\ \ \ \ set\ er\ \[catch\ \{cal_month_length\ \$Mmonth\ \$Myear\}\ Ml\]\n\t\t\t\ \ \ \ if\ \{\$er\}\ \{\n\t\t\t\terror\ \"Problem\ computing\ month\ length,\\n\\\n\t\t\t\t\ \ \ \ \ \ year\ out\ of\ clock's\ range\ or\ erroneous\\n\\\n\t\t\t\t\ \ \ \ \ \ month\ value\"\n\t\t\t\treturn\n\t\t\t\ \ \ \ \ \ \}\n\t\t\t\ \ \ \ #\ day\ check\n\t\t\t\ \ \ \ if\ \{(\$Mday\ <\ 1)\ ||\ (\$Mday\ >\ \$Ml)\}\ \{\n\t\t\t\terror\ \"Day\ of\ month\ out\ of\ range\"\n\t\t\t\treturn\n\t\t\t\ \ \ \ \ \ \}\n\t\t\t\ \ \ \ #\ prio\ check:\ must\ be\ integer\n\t\t\t\ \ \ \ set\ er\ \[catch\ \{incr\ Mpri\ 0\}\]\n\t\t\t\ \ \ \ if\ \{\$er\}\ \{\n\t\t\t\terror\ \"Problem\ with\ the\ priority\ value\\n\\\n\t\t\t\t\ \ \ \ \ \ most\ likely\ a\ non\ integer\ value\ \\n\\\n\t\t\t\t\ \ \ \ \ \ prio\ is\ \\\"\$Mpri\\\"\"\n\t\t\t\treturn\n\t\t\t\ \ \ \ \ \ \}\n\t\t\t\ \ \ \ #\ check\ that\ color\ is\ acceptable\n\t\t\t\ \ \ \ set\ er\ \[catch\ \{label\ .tmp\ -background\ \$Mcol\}\ result\]\n\t\t\t\ \ \ \ destroy\ .tmp\ \ \ \n\t\t\t\ \ \ \ if\ \{\$er\}\ \{\n\t\t\t\terror\ \"Problem\ with\ the\ color\ value\\n\\\n\t\t\t\t\ \ \ \ \ \ color\ is\ \\\"\$Mcol\\\"\"\n\t\t\t\treturn\n\t\t\t\ \ \ \ \ \ \}\n\t\t\t\ \ \ \ #\ all\ consistency\ checks\ went\ OK\n\t\t\t\ \ \ \ #\ append\ mark\ to\ mark\ list\n\t\t\t\ \ \ \ lappend\ calState(\$parent.mark)\ \$val\n\t\t\t\ \ \}\n\t\t\t\"-daynames\"\ \{\n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"\"\}\ \{\n\t\t\t\treturn\ \$calState(\$parent.daynames)\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ if\ no\ list\ with\ daynames\ specified\n\t\t\t\ \ \ \ if\ \{\[llength\ \$val\]\ !=\ 7\}\ \{\n\t\t\t\terror\ \"The\ list\ given\ to\ -daynames\ must\ have\\n\\\n\t\t\t\t\ \ \ \ \ \ \ 7\ \ elements,\ \[llength\ \$val\]\ elements\ \\n\\\n\t\t\t\t\ \ \ \ \ \ \ were\ specified\ in\ \$val\"\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ if\ list\ didn't\ have\ 7\ elements\n\t\t\t\ \ \ \ set\ calState(\$parent.daynames)\ \$val\ \ \n\t\t\t\ \ \}\n\t\t\t\"-clicked\"\ \{\n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"\"\}\ \{\n\t\t\t\treturn\ \$calState(\$parent.clicked)\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ if\ no\ list\ with\ \ calendar\ coordinates\ \n\t\t\t\ \ \ \ if\ \{\[llength\ \$val\]\ !=\ 2\}\ \{\n\t\t\t\terror\ \"The\ list\ given\ to\ -clicked\ must\ have\\n\\\n\t\t\t\t\ \ \ \ \ \ \ 2\ \ elements,\ \[llength\ \$val\]\ elements\ \\n\\\n\t\t\t\t\ \ \ \ \ \ \ were\ specified\ in\ \$val\"\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ if\ list\ didn't\ have\ 2\ elements\n\t\t\t\ \ \ \ set\ tmp_col\ \[lindex\ \$val\ 0\]\n\t\t\t\ \ \ \ set\ tmp_row\ \[lindex\ \$val\ 1\]\n\t\t\t\ \ \ \ if\ \{\ (\$tmp_col\ <\ 0)\ ||\ (\$tmp_col\ >\ 6)\}\ \{\n\t\t\t\terror\ \"column\ value\ for\ clicked\ cell\ invalid\\n\\\n\t\t\t\t\ \ \ \ \ \ \ 0<=\ col\ <\ 7\ allowed,\ given:\ \$tmp_col\"\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ if\ coord\ isn't\ in\ right\ range\n\t\t\t\ \ \ \ if\ \{\ (\$tmp_row\ <\ 0)\ ||\ (\$tmp_row\ >\ 5)\}\ \{\n\t\t\t\terror\ \"row\ value\ for\ clicked\ cell\ invalid\\n\\\n\t\t\t\t\ \ \ \ \ \ \ 0<=\ col\ <\ 5\ allowed,\ given:\ \$tmp_col\"\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ if\ coord\ isn't\ in\ right\ range\n\t\t\t\ \ \ \ set\ Cstate\ \[\$parent.\$tmp_col\$tmp_row\ cget\ -state\]\n\t\t\t\ \ \ \ if\ \{\$Cstate\ ==\ \"normal\"\}\ \{\t\ \ \ \ \ \ \n\t\t\t\tset\ calState(\$parent.clicked)\ \$val\ \ \n\t\t\t\t#\ call\ the\ callback\ as\ if\ the\ appropriate\ button\n\t\t\t\t#\ was\ clicked.\ \n\t\t\t\tif\ \{\$calState(\$parent.progcallback)==\"1\"\}\ \{\n\t\t\t\t\ \ \ \ callback\ \$parent\ \$tmp_col\ \$tmp_row\ \ \ \n\t\t\t\t\ \ \}\;#\ end:\ if\ programm\ callback\ enabled\ \ \n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ if\ cell\ is\ not\ disabled\n\t\t\t\ \ \}\ \ \ \ \n\t\t\t\"-month\"\ \{\n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"\"\}\ \{\n\t\t\t\treturn\ \$calState(\$parent.month)\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ if\ no\ month\ specified\n\t\t\t\ \ \ \ if\ \{(\$val\ >\ 0)\ &&\ (\$val\ <\ 13)\}\ \{\n\t\t\t\tset\ calState(\$parent.month)\ \$val\n\t\t\t\ \ \ \ \ \ \}\ else\ \{\n\t\t\t\terror\ \"Month\ value\ must\ be\ between\ 1\ and\ 12\"\n\t\t\t\ \ \ \ \ \ \}\n\t\t\t\ \ \ \ set\ calState(\$parent.clicked)\ \{\}\ \ \n\t\t\t\ \ \}\n\t\t\t\"-year\"\ \{\n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"\"\}\ \{\n\t\t\t\treturn\ \$calState(\$parent.year)\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ if\ no\ year\ specified\n\t\t\t\ \ \ \ set\ calState(\$parent.year)\ \$val\n\t\t\t\ \ \ \ set\ calState(\$parent.clicked)\ \{\}\ \ \n\t\t\t\ \ \}\ \ \ \ \ \n\t\t\t\"-callback\"\ \{\n\t\t\t\ \ \ \ if\ \{\$val\ ==\ \"\"\}\ \{\n\t\t\t\treturn\ \$calState(\$parent.callback)\n\t\t\t\ \ \ \ \ \ \}\;#\ END:\ if\ no\ year\ specified\n\t\t\t\ \ \ \ set\ calState(\$parent.callback)\ \$val\n\t\t\t\ \ \}\ \ \ \ \ \n\t\t\tdefault\ \{\n\t\t\t\ \ \ \ error\ \"Bad\ option:\ \$opt\\n\\\n\t\t\t\t\ \ \ allowed\ option(s)\ for\ configure\ are:\ \ \ \ \\n\\\n\t\t\t\t\ \ \ -font\ -startsunday\ -daynames\ -month\ \ \ \ \ \\n\\\n\t\t\t\t\ \ \ -year\ -dayfont\ -callback\ -clickedcolor\ \ \\n\\\n\t\t\t\t\ \ \ -background\ -clicked\ -mark\ -balloon\ \ \ \ \ \\n\\\n\t\t\t\t\ \ \ -progcallback\ -activebackground\ -delay\ \ \\n\\\n\t\t\t\t\ \ \ -foreground\"\ \n\t\t\t\ \ \}\n\t\t\ \ \ \ \ \ \}\n\t\t\ \ \}\n\t\tupdate_cal\ \$parent\ \ \n\t\ \ \ \ \ \ \}\n\t\ \ \ \ \"nextmonth\"\ \{\n\t\tif\ \{\[llength\ \$args\]\}\ \{\n\t\t\ \ \ \ error\ \"nextmonth\ not\ allowed\ to\ have\ arguments\"\n\t\t\ \ \}\;#\ END:\ check\ number\ of\ arguments\ error\ if\ !=\ 0\n\t\tincr\ calState(\$parent.month)\n\t\tif\ \{\$calState(\$parent.month)\ ==\ 13\}\ \{\n\t\t\ \ \ \ set\ calState(\$parent.month)\ 1\n\t\t\ \ \ \ incr\ calState(\$parent.year)\n\t\t\ \ \}\;#\ END:\ if\ month\ crossed\ year\ boundary\ to\ next\ year\n\t\tset\ calState(\$parent.clicked)\ \{\}\ \ \n\t\tupdate_cal\ \$parent\ \ \n\t\treturn\ \[list\ \$calState(\$parent.year)\ \$calState(\$parent.month)\]\n\t\ \ \ \ \ \ \}\n\t\ \ \ \ \"prevmonth\"\ \{\n\t\tif\ \{\[llength\ \$args\]\}\ \{\n\t\t\ \ \ \ error\ \"prevmonth\ not\ allowed\ to\ have\ arguments\"\n\t\t\ \ \}\;#\ END:\ check\ number\ of\ arguments\ error\ if\ !=\ 0\n\t\tincr\ calState(\$parent.month)\ -1\n\t\tif\ \{\$calState(\$parent.month)\ ==\ 0\}\ \{\n\t\t\ \ \ \ set\ calState(\$parent.month)\ 12\n\t\t\ \ \ \ incr\ calState(\$parent.year)\ -1\n\t\t\ \ \}\;#\ END:\ if\ month\ crossed\ year\ boundary\ to\ previous\ year\n\t\tset\ calState(\$parent.clicked)\ \{\}\ \ \n\t\tupdate_cal\ \$parent\ \ \n\t\treturn\ \[list\ \$calState(\$parent.year)\ \$calState(\$parent.month)\]\n\t\ \ \ \ \ \ \}\n\t\ \ \ \ \"nextyear\"\ \{\n\t\tif\ \{\[llength\ \$args\]\}\ \{\n\t\t\ \ \ \ error\ \"nextyear\ not\ allowed\ to\ have\ arguments\"\n\t\t\ \ \}\;#\ END:\ check\ number\ of\ arguments\ error\ if\ !=\ 0\n\t\tincr\ calState(\$parent.year)\n\t\tset\ calState(\$parent.clicked)\ \{\}\ \ \n\t\tupdate_cal\ \$parent\ \ \n\t\treturn\ \[list\ \$calState(\$parent.year)\ \$calState(\$parent.month)\]\n\t\ \ \ \ \ \ \}\n\t\ \ \ \ \"prevyear\"\ \{\n\t\tif\ \{\[llength\ \$args\]\}\ \{\n\t\t\ \ \ \ error\ \"prevyear\ not\ allowed\ to\ have\ arguments\"\n\t\t\ \ \}\;#\ END:\ check\ number\ of\ arguments\ error\ if\ !=\ 0\n\t\tincr\ calState(\$parent.year)\ -1\n\t\tset\ calState(\$parent.clicked)\ \{\}\ \ \n\t\tupdate_cal\ \$parent\ \ \n\t\treturn\ \[list\ \$calState(\$parent.year)\ \$calState(\$parent.month)\]\n\t\ \ \ \ \ \ \}\ \ \ \n\t\ \ \ \ default\ \{\n\t\terror\ \"You\ should\ never\ have\ reached\ this\ point\\n\\\n\t\t\ \ \ \ \ \ \ The\ state\ of\ the\ widget\ might\ be\ mangled\\n\\\n\t\t\ \ \ \ \ \ \ Bailing\ out,\ bye\\n\"\n\t\ \ \ \ \ \ \}\n\t\ \ \}\;#\ END:\ switch\ --\ \$command\n\ \ \ \ \ \ \}\;#\ END:\ calproc\n\n\ #\ utilities\ start\ here\n\ #\ anything\ needing\ calState\ does\ not\ belong\ below\n\ \ \ \ proc\ roll_left\ \{listvar\ \{rollby\ 1\}\}\ \{\n\ \ \ \ ##############################################\n\ \ \ \ #\ helper\ function\ to\ roll\ a\ list\ to\ the\ left\ #\n\ \ \ \ ##############################################\n\tset\ newlist\ \$listvar\n\tfor\ \{set\ counter\ 0\}\ \{\$counter\ <\ \$rollby\}\ \{incr\ counter\}\ \{\n\t\ \ \ \ set\ firstelem\ \[lindex\ \$newlist\ 0\]\n\t\ \ \ \ set\ newlist\ \ \ \[lreplace\ \$newlist\ 0\ 0\]\n\t\ \ \ \ set\ newlist\ \ \ \[lappend\ newlist\ \$firstelem\]\n\t\ \ \}\n\treturn\ \$newlist\n\ \ \ \ \ \ \}\;#\ END\ roll_left\n\n\ \ \ \ proc\ cal_start_weekday\ \{\ month\ year\ \}\ \{\n\ \ \ \ ############################################\n\ \ \ \ #\ returns\ the\ weekday\ as\ an\ ordinal\ number\ #\n\ \ \ \ #\ sunday\ is\ 0\t\t\t\ \ \ \ \ \ #\n\ \ \ \ ############################################\n\t#\ obvious,\ needed\ as\ a\ wrapper\ for\ future\ \n\t#\ sophistication\ of\ the\ proc\n\tset\ startday\ \[clock\ scan\ \"\$month/1/\$year\"\]\n\treturn\ \[clock\ format\ \$startday\ -format\ \"%w\"\]\n\ \ \ \ \ \ \}\;#\ END:\ cal_start_weekday\n\n\ \ \ \ proc\ cal_month_length\ \{\ monthvar\ yearvar\ \}\ \{\n\ \ \ \ #################################\n\ \ \ \ #\ returns\ the\ length\ of\ a\ month\ #\n\ \ \ \ #################################\n\t#\ get\ clock\ ticks\n\t#\ make\ sure\ to\ stay\ in\ same\ month\ to\ stay\ in\ same\ year\n\tset\ startdate\ \ \ \ \[clock\ scan\ \"\$monthvar/1/\$yearvar\"\]\n\tset\ enddate\ \ \ \ \ \ \[clock\ scan\ \"+1\ month\"\ -base\ \$startdate\]\n\tset\ lastmonthday\ \[clock\ scan\ \"yesterday\"\ \ -base\ \$enddate\]\n\n\t#\ get\ day\ numbers\ from\ ticks\n\tset\ lastday\ \ \ \ \ \ \[clock\ format\ \$lastmonthday\ -format\ \"%d\"\]\n\n\t#\ get\ rid\ of\ leading\ zeroes\ as\ tcl\ interpret\ them\ as\ octal\n\tset\ lastday\ \ \[\ string\ trimleft\ \$lastday\ \ \"0\"\]\n\n\t#\ actually\ not\ needed\ (clock\ ...\ %d\ returns\ min.\ 01)\n\t#\ but\ keep\ sane\ state\ for\ the\ variables\n\tif\ \{\$lastday\ \ ==\ \"\"\}\ \{set\ lastday\ \ \"0\"\}\n\t#\ return\n\treturn\ \ \ \$lastday\ \n\ \ \ \ \ \ \}\;#\ END:\ cal_month_length\n\n\ \ \ \ proc\ cal_build_month\ \{\ month\ year\ \}\ \{\n\ \ \ \ ######################################################\n\ \ \ \ #\ returns\ a\ list\ of\ 35\ elements\ containing\ the\ month\ #\n\ \ \ \ #\ start\ day\ of\ week\ is\ sunday\ by\ default\t\ \ \ \ \ #\n\ \ \ \ ######################################################\n\tset\ startday\ \[cal_start_weekday\ \$month\ \$year\]\n\tset\ numdays\ \ \[cal_month_length\ \ \$month\ \$year\]\n\n\t#\ put\ month\ there\n\tfor\ \{set\ counter\ 1\}\ \{\$counter\ <=\ \$numdays\}\ \{incr\ counter\}\ \{\n\t\ \ \ \ set\ monthlist\ \[lappend\ monthlist\ \$counter\]\n\t\ \ \}\n\t#\ make\ empty\ preceeding\ days\ if\ needed\n\tif\ \{\$startday\ !=\ 0\}\ \{\n\t\ \ \ \ for\ \{set\ counter\ 0\}\ \{\$counter\ <\ \$startday\}\ \{incr\ counter\}\ \{\n\t\tset\ prelist\ \[lappend\ prelist\ \"\"\]\n\t\ \ \ \ \ \ \}\n\t\ \ \ \ return\ \[concat\ \$prelist\ \$monthlist\]\n\t\ \ \}\n\n\treturn\ \$monthlist\n\ \ \ \ \ \ \}\;#\ END:\ cal_build_month\n\n\ \ \ \ #############################################################\n\ \ \ \ #\ return\ the\ monthlist\ with\ start\ either\ mondays\ or\ sundays\ #\n\ \ \ \ #############################################################\n\ \ \ \ proc\ cal_list_month\ \{\ month\ year\ \{startsunday\ 1\}\}\ \{\n\t#\ get\ the\ default\ (start\ sunday)\ list\n\tset\ monthlist\ \[cal_build_month\ \$month\ \$year\ \]\n\n\tif\ \{\$startsunday\ !=\ 1\}\ \{\n\t#\ start\ week\ as\ in\ Europe\n\t\ \ \ \ set\ firstday\ \[cal_start_weekday\ \$month\ \$year\]\n\t\ \ \ \ if\ \{\$firstday\ ==\ 0\}\ \{\n\t\tset\ monthlist\ \[linsert\ \$monthlist\ 0\ \{\}\ \{\}\ \{\}\ \{\}\ \{\}\ \{\}\]\n\t\ \ \ \ \ \ \}\ else\ \{\n\t\tset\ monthlist\ \[roll_left\ \$monthlist\]\n\t\ \ \ \ \ \ \}\n\t\ \ \}\n\n\treturn\ \$monthlist\n\ \ \ \ \ \ \}\;#\ END:\ cal_list_month\n\n\ \ \}\;#\ END\ namespace\ callib\n\n======\n***Documentation***\n\n----\n\[Jaf\]\ Here\ is\ a\ bit\ of\ documentation:\n\n'''Name'''\n\n''calwid''\ -\ Create\ and\ manipulate\ calendar\ widgets\n\ \n'''Synopsis'''\n\n''calwid''\ pathName\ ?options?\n\n'''Widget\ commands:'''\n\n''nextmonth''\ Advances\ the\ shown\ calendar\ by\ one\ month\n\n''nextyear''\ Advances\ the\ shown\ calendar\ by\ one\ year.\ The\ month\ shown\ remains\ the\ same\n\n''prevmonth''\ Goes\ back\ one\ month\n\n''nextyear''\ Goes\ back\ one\ year.\ The\ month\ shown\ remains\ the\ same\n\n'''configure'''\n\n''Arguments''\ see\ below\n\nWithout\ any\ arguments,\ dumps\ the\ current\ configuration\n\n\n'''Configure\ options'''\n\nNote:\ all\ options\ return\ their\ current\ value\ if\ they\ are\ called\ without\ arguments\n\n''-font\ font''\ Sets\ the\ font\ for\ the\ daynumbers\ in\ the\ calendar\n\n''-background\ color''\ Sets\ the\ background\ colour\n\n''-activebackground\ color''\ Sets\ the\ color\ of\ the\ day\ the\ cursor\ is\ hovering\ over\n\n''-dayfont\ font''\ Sets\ the\ font\ used\ for\ the\ day\ names\n\n''-clickedcolor\ color''\ Sets\ the\ color\ a\ day\ field\ gets\ after\ a\ mouse\ click.\n''\t\t\ \ \ ''\ Note\ that\ there\ is\ no\ way\ yet\ to\ get\ rid\ of\ a\ \"clicked\"\n''\t\t\ \ \ ''\ day,\ a\ workaround\ is\ to\ jump\ to\ the\ next\ month\ and\ back.\n\n''-startsunday\ val''\ val=1:\ Sets\ the\ starting\ day\ of\ the\ week\ to\ sunday.\ val=0:\ Sets\ the\ starting\ day\ of\ the\ week\ to\ monday.\ \"clicked\"\ days\ revert\ to\ the\ background\ color.\n\n''-balloon\ val''\ val=1:\ enables\ balloons.\ val=0:\ disables\ balloons.\ Balloons\ are\ shown\ if\ the\ mouse\ hovers\ a\ certain\ amount\ of\ time\ over\ a\ day\ which\ has\ marks.\ The\ balloon\ contains\ a\ list\ of\ the\ mark\ prios\ and\ texts\ in\ ascending\ order.\ The\ delay\ is\ set\ using\ -delay\ (see\ below).\ The\ marks\ are\ set\ using\ -mark\ (see\ below)\n\n''-delay\ val''\ Delay\ im\ ms\ to\ wait\ until\ a\ balloon\ containing\ the\ days\ marks\ are\ shown\n\n''-callback\ procname''\ Procname\ gets\ called\ at\ each\ mouse\ click\ event\ on\ a\ day\ field.\ The\ callback\ is\ called\ and\ gets\ 6\ arguments:\ ''\{year\ month\ day\ dayname\ column\ row\}''\n\n''-clicked\ \{elem1\ elem2\}''\ Sets\ the\ day\ at\ coordinates\ column=elem1\ and\ row=elem2\ to\ the\ \"clicked\"\ state.\ Coordinates\ start\ with\ 0\n\n''-progcallback\ val''\ Enables/disables\ triggering\ of\ the\ callback\ if\ the\ -clicked\ option\ is\ used.\ val=1:\ enabled.\ val=0:\ disabled\n\n''-mark\ \{day\ month\ year\ prio\ color\ text\}''\ Sets\ a\ mark\ on\ the\ date\ given\ by\ day,\ month\ and\ year.\ Prio\ sets\ the\ priority\ of\ the\ mark.\ Color\ sets\ the\ color\ shown\ around\ the\ marked\ day,\ if\ the\ associated\ mark\ has\ highest\ priority.\ Text\ is\ shown\ in\ the\ balloon\ if\ balloons\ are\ enabled.\n\n''-daynames\ \{So\ Mo\ Di\ Mi\ Do\ Fr\ Sa\}''\ Sets\ the\ daynames\ shown\ in\ the\ calendar.\ The\ list\ starts\ with\ Sunday,\ the\ calendar\ uses\ the\ first\ 2\ chars\ of\ each\ list\ element.\ The\ callback\ gets\ the\ whole\ list\ element.\n\n''-month\ val''\ sets\ the\ month\ shown\ by\ the\ calendar\n\n''-year\ val''\ sets\ the\ year\ shown\ by\ the\ calendar\n\n''-relief\ val''\ sets\ the\ relief\ the\ calendar\ day\n\n----\n***Future\ Feature\ discussion***\n\n\[Jaf\]:\ Does\ somebody\ know\ how\ to\ contact\ a\ MS\ exchange\ server?\ It\ would\ be\ nice\ to\ fill\ the\ marks\ with\ appointments.\nCheers.\n\n\[MAKR\]:\ Via\ IMAP\ maybe?\ At\ my\ company\ the\ Exchange\ servers\ can\ be\ queried\ via\ IMAP\ and\ return\ an\ email\ with\ a\ vCalendar\ MIME\ part.\n\n\[LV\]\ This\ would\ be\ a\ '''great'''\ topic\ to\ pursue.\ \ If\ someone\ could\ build\ a\ cross\ platform\nTcl\ extension\ to\ interact\ with\ the\ calendaring\ portion\ of\ the\ MS\ server\ environment,\ it\nwould\ be\ a\ great\ ''selling''\ point\ for\ the\ language.\n\n\[Jaf\]:\ I've\ been\ experimenting\ a\ bit\ with\ the\ RFC244\{5,6,7\}\ sending\ schedule\ requests\ from\ my\ sun\ to\ my\ M\$\ e-mail\ account.\ I\ could\ get\ an\ appointment\ scheduled\ but\ never\ got\ an\ answer\ to\ my\ free/busy\ requests.\ Still\ ongoing\ though...,\ Cheers.\n\n\[LV\]\ Sure\ wish\ this\ could\ be\ a\ two\ way\ bridge.\ I\ use\ Sun's\ calendaring,\ but\ my\ task\ leader\ uses\ exchange.\ So\ we\ never\ can\ see\ each\ other's\ appointments.\n\ \n\n----\n!!!!!!\n%|\ \[Category\ Widget\]\ |\ \[Category\ Date\ and\ Time\]\ |%\n!!!!!!} CALL {my revision {A calendar Widget}} CALL {::oo::Obj401620 process revision/A+calendar+Widget} CALL {::oo::Obj401618 process}

-errorcode

NONE

-errorinfo

Unknow state transition: LINE -> END
    while executing
"error $msg"
    (class "::Wiki" method "render_wikit" line 6)
    invoked from within
"my render_$default_markup $N $C $mkup_rendering_engine"
    (class "::Wiki" method "render" line 8)
    invoked from within
"my render $name $C"
    (class "::Wiki" method "revision" line 31)
    invoked from within
"my revision $page"
    (class "::Wiki" method "process" line 56)
    invoked from within
"$server process [string trim $uri /]"

-errorline

4