Error processing request

Parameters

CONTENT_LENGTH0
REQUEST_METHODGET
REQUEST_URI/revision/A+little+date+chooser?V=14
QUERY_STRINGV=14
CONTENT_TYPE
DOCUMENT_URI/revision/A+little+date+chooser
DOCUMENT_ROOT/var/www/nikit/nikit/nginx/../docroot
SCGI1
SERVER_PROTOCOLHTTP/1.1
HTTPSon
REMOTE_ADDR172.71.254.99
REMOTE_PORT12382
SERVER_PORT4443
SERVER_NAMEwiki.tcl-lang.org
HTTP_HOSTwiki.tcl-lang.org
HTTP_CONNECTIONKeep-Alive
HTTP_ACCEPT_ENCODINGgzip, br
HTTP_X_FORWARDED_FOR3.144.252.140
HTTP_CF_RAY87fbd56dcfdb22c4-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_CF_CONNECTING_IP3.144.252.140
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 little date chooser} \[Richard\ Suchenwirth\]\ -\ Here's\ a\ popup\ toplevel\ that\ displays\ a\ given\ month\ and\ allows\ to\ pick\ a\ date\ (or\ cancel):\n----\nNice.\ \ A\ couple\ of\ comments\ (that\ I\ might\ just\ implement\ myself\ when/if\ I\ get\ the\ time):\n\n\ \ \ *\ I'd\ really\ like\ to\ see\ the\ month\ name\ -\ ''RS:\ brings\ in\ i18n\ problems,\ though\ -\ month\ numbers\ are\ so\ universal...''\n\n''CLN,\ 2001-06-22:\ Yes,\ but\ I\ thought\ 8.4\ was\ going\ to\ have\ i18n\ date\ support\ in\ clock\ so\ either\ '''mc\ March'''\ or\ '''clock\ format'''\ with\ %\ for\ the\ month\ name\ should\ work.\ \ No?''\n\n''KBK,\ 27\ June\ 2001:''\ Alas,\ I've\ run\ out\ of\ time\ for\ 8.4.\nInternationalizing\ '''clock'''\ is\ a\ bigger\ job\ than\ it\ looks\ at\ first.\nI'll\ try\ to\ get\ it\ done\ over\ the\ summer.\n\n\ \ \ *\ I\ find\ partial\ weeks\ frustrating.\ \ \ The\ first\ week\ of\ this\ month\ should\ be:\ 27\ \ 28\ \ 29\ \ 30\ \ 31\ \ 1\ \ 2\ -\ ''RS:\ ...\ but\ marked\ in\ a\ different\ color,\ maybe\ gray?''\n\n''CLN,\ 2001-06-22:\ Yes,\ a\ different\ color.\ \ I'm\ not\ sure\ how\ to\ choose\ one.''\n''\[LV\],\ 2001-Jun-22:\ Why\ not\ choose\ something\ Tk-ish,\ but\ use\ the\ option\ database\ so\ that\ it\ could\ be\ overridden.\n\n\ \ \ *\ It\ would\ be\ nice\ if\ it\ accomodated\ European\ weekday\ ordering\ with\ Saturday\ and\ Sunday\ at\ the\ end,\ not\ split\ (that\ is,\ M,T,W,T,F,S,S,\ not\ S,M,T,W,T,R,S).\n\n\ \ \ *\ I'd\ like\ clicking\ a\ date\ to\ select\ it\ and\ close\ the\ dialog.\ ''Easy:\ add\ \"set\ date::res\ \$date::date\"\ to\ the\ <1>\ binding\ -\ RS''\n\nSorry\ to\ whine.\ \ It\ really\ does\ look\ nice\ but\ I've\ thought\ about\ this\ a\ lot\ and\ have\ strong\ opinions.\ \ --\ \[CLN\]\n----\nMost\ of\ this\ wish\ list\ has\ now\ been\ fulfilled\ in\ \[An\ i15d\ date\ chooser\]\n----\nFeel\ free\ to\ add\ in\ your\ changes\ -\ that's\ one\ of\ the\ nice\ things\ about\nthe\ wiki.\ \ In\ particular,\ if\ you\ are\ going\ to\ add\ in\ the\ month\ names,\ perhaps\ you\ will\ add\ them\ in\ a\ way\ that\ permits\ one\ to\ configure\ the\ language\ used\ to\ convey\ the\ months?\ \ Configuration\ is\ what\ I\ will\nprobably\ be\ thinking\ about\ (after\ I\ think\ about\ what\ it\ will\ take\ to\nbuild\ a\ parallel\ widget\ for\ selecting\ time.\n\nUnfortunately,\ my\ coding\ skills\ are\ such\ that\ one\ should\ not\ hold\ntheir\ breath\ waiting\ on\ me\ to\ write\ the\ time\ widget.\n\n----\n\n\ package\ require\ Tk\n\ namespace\ eval\ date\ \{\n\ \ \ \ option\ add\ *Button.padX\ 0\n\ \ \ \ option\ add\ *Button.padY\ 0\n\ \ \ \ proc\ choose\ \{\}\ \{\n\ \ \ \ \ \ \ \ variable\ month\;\ variable\ year\;\ variable\ date\n\ \ \ \ \ \ \ \ variable\ canvas\;\ variable\ res\n\ \ \ \ \ \ \ \ variable\ day\n\ \ \ \ \ \ \ \ set\ year\ \[clock\ format\ \[clock\ seconds\]\ -format\ \"%Y\"\]\n\ \ \ \ \ \ \ \ scan\ \[clock\ format\ \[clock\ seconds\]\ -format\ \"%m\"\]\ %d\ month\n\ \ \ \ \ \ \ \ scan\ \[clock\ format\ \[clock\ seconds\]\ -format\ \"%d\"\]\ %d\ day\n\ \ \ \ \ \ \ \ toplevel\ .chooseDate\ -bg\ white\n\ \ \ \ \ \ \ \ wm\ title\ .chooseDate\ \"Choose\ Date:\"\n\ \ \ \ \ \ \ \ frame\ .chooseDate.1\n\ \ \ \ \ \ \ \ entry\ .chooseDate.1.1\ -textvar\ date::month\ -width\ 3\ -just\ center\n\ \ \ \ \ \ \ \ button\ .chooseDate.1.2\ -text\ ^\ -command\ \{date::adjust\ 1\ 0\}\n\ \ \ \ \ \ \ \ button\ .chooseDate.1.3\ -text\ v\ -command\ \{date::adjust\ -1\ 0\}\n\ \ \ \ \ \ \ \ entry\ .chooseDate.1.4\ -textvar\ date::year\ -width\ 4\ -just\ center\n\ \ \ \ \ \ \ \ button\ .chooseDate.1.5\ -text\ ^\ -command\ \{date::adjust\ 0\ 1\}\n\ \ \ \ \ \ \ \ button\ .chooseDate.1.6\ -text\ v\ -command\ \{date::adjust\ 0\ -1\}\n\ \ \ \ \ \ \ \ eval\ pack\ \[winfo\ children\ .chooseDate.1\]\ -side\ left\ \\\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ -fill\ both\n\ \ \ \ \ \ \ \ set\ canvas\ \[canvas\ .chooseDate.2\ -width\ 160\ -height\ 160\ -bg\ white\]\n\ \ \ \ \ \ \ \ frame\ .chooseDate.3\n\ \ \ \ \ \ \ \ entry\ .chooseDate.3.1\ -textvar\ date::date\ -width\ 10\n\ \ \ \ \ \ \ \ button\ .chooseDate.3.2\ -text\ OK\ -command\ \{set\ date::res\ \$date::date\}\n\ \ \ \ \ \ \ \ button\ .chooseDate.3.3\ -text\ Cancel\ -command\ \{set\ date::res\ \{\}\}\n\ \ \ \ \ \ \ \ eval\ pack\ \[winfo\ children\ .chooseDate.3\]\ -side\ left\n\ \ \ \ \ \ \ \ eval\ pack\ \[winfo\ children\ .chooseDate\]\n\ \ \ \ \ \ \ \ display\n\ \ \ \ \ \ \ \ vwait\ ::date::res\n\ \ \ \ \ \ \ \ destroy\ .chooseDate\n\ \ \ \ \ \ \ \ set\ res\n\ \ \ \ \}\n\ \ \ \ proc\ adjust\ \{dmonth\ dyear\}\ \{\n\ \ \ \ \ \ \ \ variable\ month\;\ variable\ year\;\ variable\ day\n\ \ \ \ \ \ \ \ set\ year\ \ \[expr\ \{\$year+\$dyear\}\]\n\ \ \ \ \ \ \ \ set\ month\ \[expr\ \{\$month+\$dmonth\}\]\n\ \ \ \ \ \ \ \ if\ \{\$month>12\}\ \{set\ month\ 1\;\ incr\ year\}\n\ \ \ \ \ \ \ \ if\ \{\$month<1\}\ \{set\ month\ 12\;\ incr\ year\ -1\}\n\ \ \ \ \ \ \ \ if\ \{\[numberofdays\ \$month\ \$year\]<\$day\}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ set\ day\ \[numberofdays\ \$month\ \$year\]\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ display\n\ \ \ \ \}\n\ \ \ \ proc\ display\ \{\}\ \{\n\ \ \ \ \ \ \ \ variable\ month\;\ variable\ year\n\ \ \ \ \ \ \ \ variable\ date\;\ variable\ day\n\ \ \ \ \ \ \ \ variable\ canvas\n\ \ \ \ \ \ \ \ \$canvas\ delete\ all\n\ \ \ \ \ \ \ \ set\ x0\ 20\;\ set\ x\ \$x0\;\ set\ y\ 20\n\ \ \ \ \ \ \ \ set\ dx\ 20\;\ set\ dy\ 20\n\ \ \ \ \ \ \ \ set\ xmax\ \[expr\ \{\$x0+\$dx*6\}\]\n\ \ \ \ \ \ \ \ foreach\ i\ \{S\ M\ T\ W\ T\ F\ S\}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \$canvas\ create\ text\ \$x\ \$y\ -text\ \$i\ -fill\ blue\n\ \ \ \ \ \ \ \ \ \ \ \ incr\ x\ \$dx\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ scan\ \[clock\ format\ \[clock\ scan\ \$month/1/\$year\]\ \\\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ -format\ %w\]\ %d\ weekday\n\ \ \ \ \ \ \ \ set\ x\ \[expr\ \{\$x0+\$weekday*\$dx\}\]\n\ \ \ \ \ \ \ \ incr\ y\ \$dy\n\ \ \ \ \ \ \ \ set\ nmax\ \[numberofdays\ \$month\ \$year\]\n\ \ \ \ \ \ \ \ for\ \{set\ d\ 1\}\ \{\$d<=\$nmax\}\ \{incr\ d\}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ set\ id\ \[\$canvas\ create\ text\ \$x\ \$y\ -text\ \$d\ -tag\ day\]\n\ \ \ \ \ \ \ \ \ \ \ \ if\ \{\$d==\$day\}\ \{\$canvas\ itemconfig\ \$id\ -fill\ red\}\n\ \ \ \ \ \ \ \ \ \ \ \ incr\ x\ \$dx\n\ \ \ \ \ \ \ \ \ \ \ \ if\ \{\$x>\$xmax\}\ \{set\ x\ \$x0\;\ incr\ y\ \$dy\}\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \$canvas\ bind\ day\ <1>\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ set\ item\ \[%W\ find\ withtag\ current\]\n\ \ \ \ \ \ \ \ \ \ \ \ set\ date::day\ \[%W\ itemcget\ \$item\ -text\]\n\ \ \ \ \ \ \ \ \ \ \ \ set\ date::date\ \"\$date::month/\$date::day/\$date::year\"\n\ \ \ \ \ \ \ \ \ \ \ \ %W\ itemconfig\ day\ -fill\ black\n\ \ \ \ \ \ \ \ \ \ \ \ %W\ itemconfig\ \$item\ -fill\ red\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ set\ date\ \"\$month/\$day/\$year\"\n\ \ \ \ \}\n\ \ \ \ proc\ numberofdays\ \{month\ year\}\ \{\n\ \ \ \ \ \ \ \ if\ \{\$month==12\}\ \{set\ month\ 1\;\ incr\ year\}\n\ \ \ \ \ \ \ \ clock\ format\ \[clock\ scan\ \"\[incr\ month\]/1/\$year\ \ 1\ day\ ago\"\]\ \\\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ -format\ %d\n\ \ \ \ \}\n\ \}\ \;#\ end\ namespace\ date\n\n\ #------\ test\ and\ demo\ code\ (terminate\ by\ closing\ the\ main\ window)\n\ while\ 1\ \{\n\ \ \ \ \ set\ date\ \[date::choose\]\n\ \ \ \ \ puts\ \$date\n\ \}\n----\n2001-06-22\ \[RS\]:\ stepping\ through\ months\ does\ not\ check\ for\ day\ validity,\ so\ you\ may\ get\ dates\ like\ 2/31/1999.\ Fixed\ in\ proc\ adjust.\n\n----\n\n2003-03-06\ \[David\ Bigelow\]:\ Added\ the\ ability\ to\ change\ fonts,\ highlight\ weights,\ and\ included\ rectangles\ around\ each\ weekday\ and\ date\ within\ the\ canvas\ -\ so\ it\ looks\ more\ like\ a\ calendar.\n\nBTW\ -\ Nice\ job\ on\ this\ Tcl\ Code\ -\ it\ is\ impressive!\n\n----\n\n2003-03-07\ \[David\ Bigelow\]:\ Updated\ the\ modified\ Code\ to\ act\ more\ like\ a\ widget.\ \ The\ \"choose\"\ command\ was\ altered\ to\ accept\ the\ path\ of\ the\ widget\ that\ launches\ it\ (e.g.,\ button).\ \ The\ Calendar\ selection\ will\ popup\ in\ a\ relative\ position\ to\ the\ widget\ that\ you\ use\ to\ launch\ it.\n\nTo\ select\ a\ date,\ Double\ Click\ on\ the\ desired\ date,\ and\ the\ formatted\ date\ string\ will\ be\ returned\ by\ the\ \"choose\"\ function.\n\nBTW\ -\ Special\ Thanks\ for\ Bryan\ Oakley\ for\ pointing\ out\ the\ vwait\ to\ me\ during\ the\ debugging\ process.\n\nHope\ everyone\ finds\ this\ a\ useful\ and\ productive\ widget.\n\nDave\n\n----\n\n\n======\n\ namespace\ eval\ date\ \{\n\ \ \ \ \ \ \ \ set\ defaultFont\ \{Arial\ 10\ normal\}\n\ \ \ \ option\ add\ *Button.padX\ 0\n\ \ \ \ option\ add\ *Button.padY\ 0\n\ \ \ \ option\ add\ *Button.font\ \$defaultFont\n\ \ \ \ option\ add\ *Entry.font\ \$defaultFont\n\ \ \ \ variable\ canvasFont\ \$defaultFont\n\ \ \ \ variable\ canvasHighlight\ \{Arial\ 11\ bold\}\n\ \ \ \ variable\ canvasHeader\ \{Arial\ 14\ bold\}\n\ \ \ \ variable\ w\ .cal\n\ \ \ \ \n\ \ \ \ proc\ choose\ \{bpath\}\ \{\n\ \ \ \ \ \ \ \ variable\ month\;\ variable\ year\;\ variable\ date\n\ \ \ \ \ \ \ \ variable\ canvas\;\ variable\ res\n\ \ \ \ \ \ \ \ variable\ day\n\ \ \ \ \ \ \ \ set\ year\ \[clock\ format\ \[clock\ seconds\]\ -format\ \"%Y\"\]\n\ \ \ \ \ \ \ \ scan\ \[clock\ format\ \[clock\ seconds\]\ -format\ \"%m\"\]\ %d\ month\n\ \ \ \ \ \ \ \ scan\ \[clock\ format\ \[clock\ seconds\]\ -format\ \"%d\"\]\ %d\ day\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ w\ \$date::w\n\ \ \ \ \ \ \ \ catch\ \{destroy\ \$w\}\n\ \ \ \ \ \ \ \ toplevel\ \$w\ -bg\ white\n\ \ \ \ \ \ \ \ wm\ transient\ \$w\ \$bpath\n\ \ \ \ \ \ \ \ \n\ \ \ \ \ \ \ \ set\ sx\ \[expr\ \[winfo\ rootx\ \$bpath\]\ +\ 15\]\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ sy\ \[expr\ \[winfo\ rooty\ \$bpath\]\ +\ 5\]\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ wm\ geometry\ \$w\ \"+\$sx+\$sy\"\n\ \ \ \ \ \ \ \ \n\ \ \ \ \ \ \ \ wm\ title\ \$w\ \"Choose\ Date:\"\n\ \ \ \ \ \ \ \ \n\ \ \ \ \ \ \ \ frame\ \$w.1\n\ \ \ \ \ \ \ \ entry\ \$w.1.1\ -textvar\ date::month\ -width\ 3\ -just\ center\n\ \ \ \ \ \ \ \ button\ \$w.1.2\ -text\ ^\ -command\ \{date::adjust\ 1\ 0\}\n\ \ \ \ \ \ \ \ button\ \$w.1.3\ -text\ v\ -command\ \{date::adjust\ -1\ 0\}\n\ \ \ \ \ \ \ \ entry\ \$w.1.4\ -textvar\ date::year\ -width\ 4\ -just\ center\n\ \ \ \ \ \ \ \ button\ \$w.1.5\ -text\ ^\ -command\ \{date::adjust\ 0\ 1\}\n\ \ \ \ \ \ \ \ button\ \$w.1.6\ -text\ v\ -command\ \{date::adjust\ 0\ -1\}\n\ \ \ \ \ \ \ \ eval\ pack\ \[winfo\ children\ \$w.1\]\ -side\ left\ -fill\ both\n\ \ \ \ \ \ \ \ set\ canvas\ \[canvas\ \$w.2\ -width\ 160\ -height\ 160\ -bg\ white\]\n\ #\ Uncomment\ the\ following\ to\ include\ additional\ controls\n\ #\ \ \ \ \ \ \ \ \ frame\ \$w.3\n\ #\ \ \ \ \ \ \ \ \ entry\ \$w.3.1\ -textvar\ date::date\ -width\ 10\n\ #\ \ \ \ \ \ \ \ \ button\ \$w.3.2\ -text\ OK\ -command\ \{set\ date::res\ \$date::date\}\n\ #\ \ \ \ \ \ \ \ \ button\ \$w.3.3\ -text\ Cancel\ -command\ \{set\ date::res\ \{\}\}\n\ #\ \ \ \ \ \ \ \ \ eval\ pack\ \[winfo\ children\ \$w.3\]\ -side\ left\n\ \ \ \ \ \ \ \ eval\ pack\ \[winfo\ children\ \$w\]\n\ \ \ \ \ \ \ \ display\n\ \ \ \ \ \ \ \ vwait\ ::date::res\n\ \ \ \ \ \ \ \ destroy\ \$w\n\ \ \ \ \ \ \ \ set\ res\n\ \ \ \ \}\n\ \ \ \ \n\ \ \ \ proc\ adjust\ \{dmonth\ dyear\}\ \{\n\ \ \ \ \ \ \ \ variable\ month\;\ variable\ year\;\ variable\ day\n\ \ \ \ \ \ \ \ set\ year\ \ \[expr\ \{\$year+\$dyear\}\]\n\ \ \ \ \ \ \ \ set\ month\ \[expr\ \{\$month+\$dmonth\}\]\n\ \ \ \ \ \ \ \ if\ \{\$month>12\}\ \{set\ month\ 1\;\ incr\ year\}\n\ \ \ \ \ \ \ \ if\ \{\$month<1\}\ \{set\ month\ 12\;\ incr\ year\ -1\}\n\ \ \ \ \ \ \ \ if\ \{\[numberofdays\ \$month\ \$year\]<\$day\}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ set\ day\ \[numberofdays\ \$month\ \$year\]\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ display\n\ \ \ \ \}\n\ \ \ \ \n\ \ \ \ proc\ display\ \{\}\ \{\n\ \ \ \ \ \ \ \ variable\ month\;\ variable\ year\n\ \ \ \ \ \ \ \ variable\ date\;\ variable\ day\n\ \ \ \ \ \ \ \ variable\ canvas\n\ \ \ \ \ \ \ \ \$canvas\ delete\ all\n\ \ \ \ \ \ \ \ set\ x0\ 20\;\ set\ x\ \$x0\;\ set\ y\ 20\n\ \ \ \ \ \ \ \ set\ dx\ 20\;\ set\ dy\ 20\n\ \ \ \ \ \ \ \ set\ xmax\ \[expr\ \{\$x0+\$dx*6\}\]\n\ \ \ \ \ \ \ \ foreach\ i\ \{S\ M\ T\ W\ T\ F\ S\}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \$canvas\ create\ text\ \$x\ \$y\ -text\ \$i\ -fill\ blue\ -font\ \$date::canvasHeader\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \$canvas\ create\ rectangle\ \[expr\ \$x-10\]\ \[expr\ \$y-10\]\ \[expr\ \$x+10\]\ \[expr\ \$dy+10\]\ -fill\ grey90\ -tags\ boxes\n\ \ \ \ \ \ \ \ \ \ \ \ incr\ x\ \$dx\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ scan\ \[clock\ format\ \[clock\ scan\ \$month/1/\$year\]\ \\\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ -format\ %w\]\ %d\ weekday\n\ \ \ \ \ \ \ \ set\ x\ \[expr\ \{\$x0+\$weekday*\$dx\}\]\n\ \ \ \ \ \ \ \ incr\ y\ \$dy\n\ \ \ \ \ \ \ \ set\ nmax\ \[numberofdays\ \$month\ \$year\]\n\ \ \ \ \ \ \ \ for\ \{set\ d\ 1\}\ \{\$d<=\$nmax\}\ \{incr\ d\}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ set\ id\ \[\$canvas\ create\ text\ \$x\ \$y\ -text\ \$d\ -font\ \$date::canvasFont\ -tag\ day\]\n\ \ \ \ \ \ \ \ \ \ \ \ \ switch\ \$x\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 20\ -\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 140\ \{set\ fillColor\ pink1\}\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ default\ \{set\ fillColor\ bisque1\}\n\ \ \ \ \ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \$canvas\ create\ rectangle\ \[expr\ \$x-10\]\ \[expr\ \$y-10\]\ \[expr\ \$x+10\]\ \[expr\ \$y+10\]\ -fill\ \$fillColor\ -tags\ boxes\n\ \ \ \ \ \ \ \ \ \ \ \ if\ \{\$d==\$day\}\ \{\$canvas\ itemconfig\ \$id\ -fill\ red\ -font\ \$date::canvasHighlight\}\n\ \ \ \ \ \ \ \ \ \ \ \ incr\ x\ \$dx\n\ \ \ \ \ \ \ \ \ \ \ \ if\ \{\$x>\$xmax\}\ \{set\ x\ \$x0\;\ incr\ y\ \$dy\}\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \n\ \ \ \ \ \ \ \ \$canvas\ lower\ boxes\n\n\ \ \ \ \ \ \ \ \$canvas\ bind\ day\ <1>\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ set\ item\ \[%W\ find\ withtag\ current\]\n\ \ \ \ \ \ \ \ \ \ \ \ set\ date::day\ \[%W\ itemcget\ \$item\ -text\]\n\ \ \ \ \ \ \ \ \ \ \ \ set\ date::date\ \"\$date::month/\$date::day/\$date::year\"\n\ \ \ \ \ \ \ \ \ \ \ \ %W\ itemconfig\ day\ -fill\ black\ -font\ \$date::canvasFont\n\ \ \ \ \ \ \ \ \ \ \ \ %W\ itemconfig\ \$item\ -fill\ red\ -font\ \$date::canvasHighlight\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \$canvas\ bind\ day\ <Double-Button-1>\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ set\ item\ \[%W\ find\ withtag\ current\]\n\ \ \ \ \ \ \ \ \ \ \ \ set\ date::day\ \[%W\ itemcget\ \$item\ -text\]\n\ \ \ \ \ \ \ \ \ \ \ \ set\ date::date\ \"\$date::month/\$date::day/\$date::year\"\ \ \ \ \ \ \ \ \n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ date::res\ \$date::date\n\ \ \ \ \ \ \ \}\n\ \ \ \ \}\n\n\ \ \ \ proc\ numberofdays\ \{month\ year\}\ \{\n\ \ \ \ \ \ \ \ if\ \{\$month==12\}\ \{set\ month\ 1\;\ incr\ year\}\n\ \ \ \ \ \ \ \ clock\ format\ \[clock\ scan\ \"\[incr\ month\]/1/\$year\ \ 1\ day\ ago\"\]\ \\\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ -format\ %d\n\ \ \ \ \}\n\ \ \ \ \ \ \ \ \n\ \}\ \;#\ end\ namespace\ date\n\n\ #\ --\ DEMONSTRATION\ CODE\ --\ \n\ #\ Show\ a\ TextBox\ to\ Display\ Results\n\ pack\ \[text\ .tb\]\ -expand\ y\ -fill\ both\n\ pack\ \[button\ .calendar\ -text\ \"Pick\ Date\"\ -command\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ Note:\ date::choose\ \{Object\ to\ Refernece\ for\ Window\ Position\}\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ .tb\ insert\ end\ \"SELECTED:\ \[date::choose\ .calendar\]\\n\"\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}\]\n\ pack\ \[button\ .ex\ -text\ \"Exit\"\ -bg\ red\ -fg\ white\ -command\ \{exit\}\]\n======\n\n----\nSee\ also\ \[a\ calendar\ widget\]\n\n----\nJDG:\ \ Here\ is\ a\ modification\ I\ made\ to\ the\ buttons\ in\ the\ date\ chooser.\ \ IMHO,\ it's\ much\ easier\ to\ use.\n\n=====\nwm\ transient\ \$w\ \$bpath\n\ \ \ \ \ \ \n\ \ \ \ \ \ set\ sx\ \[expr\ \[winfo\ rootx\ \$bpath\]\ +\ 15\]\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ sy\ \[expr\ \[winfo\ rooty\ \$bpath\]\ +\ 5\]\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ wm\ geometry\ \$w\ \"+\$sx+\$sy\"\n\ \ \ \ \ \ \n\ \ \ \ \ \ wm\ title\ \$w\ \"Choose\ Date:\"\n\ \ \ \ \ \ \n\ \ \ \ \ \ frame\ \$w.1\n\ \ \ \ \ \ entry\ \$w.1.1\ -textvar\ date::month\ -width\ 3\ -just\ center\n\ \ \ \ \ \ button\ \$w.1.2\ -text\ \"<\"\ -command\ \{date::adjust\ -1\ 0\}\n\ \ \ \ \ \ button\ \$w.1.3\ -text\ \">\"\ -command\ \{date::adjust\ 1\ 0\}\n\ \ \ \ \ \ entry\ \$w.1.4\ -textvar\ date::year\ -width\ 4\ -just\ center\n\ \ \ \ \ \ button\ \$w.1.5\ -text\ \"<\"\ -command\ \{date::adjust\ 0\ -1\}\n\ \ \ \ \ \ button\ \$w.1.6\ -text\ \">\"\ -command\ \{date::adjust\ 0\ 1\}\n\ \ \ \ \ \ eval\ pack\ \$w.1.2\ \$w.1.1\ \$w.1.3\ \$w.1.5\ \$w.1.4\ \$w.1.6\ -side\ left\ -fill\ both\n\ \ \ \ \ \ #\ eval\ pack\ \[winfo\ children\ \$w.1\]\ -side\ left\ -fill\ both\n\ \ \ \ \ \ set\ canvas\ \[canvas\ \$w.2\ -width\ 160\ -height\ 160\ -bg\ white\]\n#\ Uncomment\ the\ following\ to\ include\ additional\ controls\n======\n\nI\ also\ commented\ out\ the\ \"`option\ add\ *Button`\"\ \ lines\ at\ the\ top.\ \ And,\ to\ stop\ it\ from\ torturing\ my\ eyes,\ I\ changed\ the\ fonts:\n\n======\nnamespace\ eval\ date\ \{\n\ \ \ \ \ \ set\ defaultFont\ \{Helvetica\ 12\ bold\}\n#\ \ \ option\ add\ *Button.padX\ 4\n#\ \ \ option\ add\ *Button.padY\ 4\n#\ \ \ option\ add\ *Button.font\ \$defaultFont\n#\ \ \ option\ add\ *Entry.font\ \$defaultFont\n\ \ \ variable\ canvasFont\ \$defaultFont\n\ \ \ variable\ canvasHighlight\ \{Helvetica\ 11\ bold\}\n\ \ \ variable\ canvasHeader\ \{Helvetica\ 14\ bold\}\n\ \ \ variable\ w\ .cal\n======\n\nThis\ way,\ you\ have\ `\[\[\ <\ \]\]\ 12\ \[\[\ >\ \]\]\ \[\[\ <\ \]\]\ 2015\ \[\[\ >\ \]\]`\n\nLike\ it,\ hate\ it,\ whatever\ ...\ just\ sharing.\ \ :-)\n\n<<categories>>\ Arts\ and\ crafts\ of\ Tcl-Tk\ programming\ |\ Package\ |\ Widget\ |\ Date\ and\ Time regexp2} CALL {my render {A little date chooser} \[Richard\ Suchenwirth\]\ -\ Here's\ a\ popup\ toplevel\ that\ displays\ a\ given\ month\ and\ allows\ to\ pick\ a\ date\ (or\ cancel):\n----\nNice.\ \ A\ couple\ of\ comments\ (that\ I\ might\ just\ implement\ myself\ when/if\ I\ get\ the\ time):\n\n\ \ \ *\ I'd\ really\ like\ to\ see\ the\ month\ name\ -\ ''RS:\ brings\ in\ i18n\ problems,\ though\ -\ month\ numbers\ are\ so\ universal...''\n\n''CLN,\ 2001-06-22:\ Yes,\ but\ I\ thought\ 8.4\ was\ going\ to\ have\ i18n\ date\ support\ in\ clock\ so\ either\ '''mc\ March'''\ or\ '''clock\ format'''\ with\ %\ for\ the\ month\ name\ should\ work.\ \ No?''\n\n''KBK,\ 27\ June\ 2001:''\ Alas,\ I've\ run\ out\ of\ time\ for\ 8.4.\nInternationalizing\ '''clock'''\ is\ a\ bigger\ job\ than\ it\ looks\ at\ first.\nI'll\ try\ to\ get\ it\ done\ over\ the\ summer.\n\n\ \ \ *\ I\ find\ partial\ weeks\ frustrating.\ \ \ The\ first\ week\ of\ this\ month\ should\ be:\ 27\ \ 28\ \ 29\ \ 30\ \ 31\ \ 1\ \ 2\ -\ ''RS:\ ...\ but\ marked\ in\ a\ different\ color,\ maybe\ gray?''\n\n''CLN,\ 2001-06-22:\ Yes,\ a\ different\ color.\ \ I'm\ not\ sure\ how\ to\ choose\ one.''\n''\[LV\],\ 2001-Jun-22:\ Why\ not\ choose\ something\ Tk-ish,\ but\ use\ the\ option\ database\ so\ that\ it\ could\ be\ overridden.\n\n\ \ \ *\ It\ would\ be\ nice\ if\ it\ accomodated\ European\ weekday\ ordering\ with\ Saturday\ and\ Sunday\ at\ the\ end,\ not\ split\ (that\ is,\ M,T,W,T,F,S,S,\ not\ S,M,T,W,T,R,S).\n\n\ \ \ *\ I'd\ like\ clicking\ a\ date\ to\ select\ it\ and\ close\ the\ dialog.\ ''Easy:\ add\ \"set\ date::res\ \$date::date\"\ to\ the\ <1>\ binding\ -\ RS''\n\nSorry\ to\ whine.\ \ It\ really\ does\ look\ nice\ but\ I've\ thought\ about\ this\ a\ lot\ and\ have\ strong\ opinions.\ \ --\ \[CLN\]\n----\nMost\ of\ this\ wish\ list\ has\ now\ been\ fulfilled\ in\ \[An\ i15d\ date\ chooser\]\n----\nFeel\ free\ to\ add\ in\ your\ changes\ -\ that's\ one\ of\ the\ nice\ things\ about\nthe\ wiki.\ \ In\ particular,\ if\ you\ are\ going\ to\ add\ in\ the\ month\ names,\ perhaps\ you\ will\ add\ them\ in\ a\ way\ that\ permits\ one\ to\ configure\ the\ language\ used\ to\ convey\ the\ months?\ \ Configuration\ is\ what\ I\ will\nprobably\ be\ thinking\ about\ (after\ I\ think\ about\ what\ it\ will\ take\ to\nbuild\ a\ parallel\ widget\ for\ selecting\ time.\n\nUnfortunately,\ my\ coding\ skills\ are\ such\ that\ one\ should\ not\ hold\ntheir\ breath\ waiting\ on\ me\ to\ write\ the\ time\ widget.\n\n----\n\n\ package\ require\ Tk\n\ namespace\ eval\ date\ \{\n\ \ \ \ option\ add\ *Button.padX\ 0\n\ \ \ \ option\ add\ *Button.padY\ 0\n\ \ \ \ proc\ choose\ \{\}\ \{\n\ \ \ \ \ \ \ \ variable\ month\;\ variable\ year\;\ variable\ date\n\ \ \ \ \ \ \ \ variable\ canvas\;\ variable\ res\n\ \ \ \ \ \ \ \ variable\ day\n\ \ \ \ \ \ \ \ set\ year\ \[clock\ format\ \[clock\ seconds\]\ -format\ \"%Y\"\]\n\ \ \ \ \ \ \ \ scan\ \[clock\ format\ \[clock\ seconds\]\ -format\ \"%m\"\]\ %d\ month\n\ \ \ \ \ \ \ \ scan\ \[clock\ format\ \[clock\ seconds\]\ -format\ \"%d\"\]\ %d\ day\n\ \ \ \ \ \ \ \ toplevel\ .chooseDate\ -bg\ white\n\ \ \ \ \ \ \ \ wm\ title\ .chooseDate\ \"Choose\ Date:\"\n\ \ \ \ \ \ \ \ frame\ .chooseDate.1\n\ \ \ \ \ \ \ \ entry\ .chooseDate.1.1\ -textvar\ date::month\ -width\ 3\ -just\ center\n\ \ \ \ \ \ \ \ button\ .chooseDate.1.2\ -text\ ^\ -command\ \{date::adjust\ 1\ 0\}\n\ \ \ \ \ \ \ \ button\ .chooseDate.1.3\ -text\ v\ -command\ \{date::adjust\ -1\ 0\}\n\ \ \ \ \ \ \ \ entry\ .chooseDate.1.4\ -textvar\ date::year\ -width\ 4\ -just\ center\n\ \ \ \ \ \ \ \ button\ .chooseDate.1.5\ -text\ ^\ -command\ \{date::adjust\ 0\ 1\}\n\ \ \ \ \ \ \ \ button\ .chooseDate.1.6\ -text\ v\ -command\ \{date::adjust\ 0\ -1\}\n\ \ \ \ \ \ \ \ eval\ pack\ \[winfo\ children\ .chooseDate.1\]\ -side\ left\ \\\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ -fill\ both\n\ \ \ \ \ \ \ \ set\ canvas\ \[canvas\ .chooseDate.2\ -width\ 160\ -height\ 160\ -bg\ white\]\n\ \ \ \ \ \ \ \ frame\ .chooseDate.3\n\ \ \ \ \ \ \ \ entry\ .chooseDate.3.1\ -textvar\ date::date\ -width\ 10\n\ \ \ \ \ \ \ \ button\ .chooseDate.3.2\ -text\ OK\ -command\ \{set\ date::res\ \$date::date\}\n\ \ \ \ \ \ \ \ button\ .chooseDate.3.3\ -text\ Cancel\ -command\ \{set\ date::res\ \{\}\}\n\ \ \ \ \ \ \ \ eval\ pack\ \[winfo\ children\ .chooseDate.3\]\ -side\ left\n\ \ \ \ \ \ \ \ eval\ pack\ \[winfo\ children\ .chooseDate\]\n\ \ \ \ \ \ \ \ display\n\ \ \ \ \ \ \ \ vwait\ ::date::res\n\ \ \ \ \ \ \ \ destroy\ .chooseDate\n\ \ \ \ \ \ \ \ set\ res\n\ \ \ \ \}\n\ \ \ \ proc\ adjust\ \{dmonth\ dyear\}\ \{\n\ \ \ \ \ \ \ \ variable\ month\;\ variable\ year\;\ variable\ day\n\ \ \ \ \ \ \ \ set\ year\ \ \[expr\ \{\$year+\$dyear\}\]\n\ \ \ \ \ \ \ \ set\ month\ \[expr\ \{\$month+\$dmonth\}\]\n\ \ \ \ \ \ \ \ if\ \{\$month>12\}\ \{set\ month\ 1\;\ incr\ year\}\n\ \ \ \ \ \ \ \ if\ \{\$month<1\}\ \{set\ month\ 12\;\ incr\ year\ -1\}\n\ \ \ \ \ \ \ \ if\ \{\[numberofdays\ \$month\ \$year\]<\$day\}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ set\ day\ \[numberofdays\ \$month\ \$year\]\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ display\n\ \ \ \ \}\n\ \ \ \ proc\ display\ \{\}\ \{\n\ \ \ \ \ \ \ \ variable\ month\;\ variable\ year\n\ \ \ \ \ \ \ \ variable\ date\;\ variable\ day\n\ \ \ \ \ \ \ \ variable\ canvas\n\ \ \ \ \ \ \ \ \$canvas\ delete\ all\n\ \ \ \ \ \ \ \ set\ x0\ 20\;\ set\ x\ \$x0\;\ set\ y\ 20\n\ \ \ \ \ \ \ \ set\ dx\ 20\;\ set\ dy\ 20\n\ \ \ \ \ \ \ \ set\ xmax\ \[expr\ \{\$x0+\$dx*6\}\]\n\ \ \ \ \ \ \ \ foreach\ i\ \{S\ M\ T\ W\ T\ F\ S\}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \$canvas\ create\ text\ \$x\ \$y\ -text\ \$i\ -fill\ blue\n\ \ \ \ \ \ \ \ \ \ \ \ incr\ x\ \$dx\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ scan\ \[clock\ format\ \[clock\ scan\ \$month/1/\$year\]\ \\\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ -format\ %w\]\ %d\ weekday\n\ \ \ \ \ \ \ \ set\ x\ \[expr\ \{\$x0+\$weekday*\$dx\}\]\n\ \ \ \ \ \ \ \ incr\ y\ \$dy\n\ \ \ \ \ \ \ \ set\ nmax\ \[numberofdays\ \$month\ \$year\]\n\ \ \ \ \ \ \ \ for\ \{set\ d\ 1\}\ \{\$d<=\$nmax\}\ \{incr\ d\}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ set\ id\ \[\$canvas\ create\ text\ \$x\ \$y\ -text\ \$d\ -tag\ day\]\n\ \ \ \ \ \ \ \ \ \ \ \ if\ \{\$d==\$day\}\ \{\$canvas\ itemconfig\ \$id\ -fill\ red\}\n\ \ \ \ \ \ \ \ \ \ \ \ incr\ x\ \$dx\n\ \ \ \ \ \ \ \ \ \ \ \ if\ \{\$x>\$xmax\}\ \{set\ x\ \$x0\;\ incr\ y\ \$dy\}\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \$canvas\ bind\ day\ <1>\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ set\ item\ \[%W\ find\ withtag\ current\]\n\ \ \ \ \ \ \ \ \ \ \ \ set\ date::day\ \[%W\ itemcget\ \$item\ -text\]\n\ \ \ \ \ \ \ \ \ \ \ \ set\ date::date\ \"\$date::month/\$date::day/\$date::year\"\n\ \ \ \ \ \ \ \ \ \ \ \ %W\ itemconfig\ day\ -fill\ black\n\ \ \ \ \ \ \ \ \ \ \ \ %W\ itemconfig\ \$item\ -fill\ red\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ set\ date\ \"\$month/\$day/\$year\"\n\ \ \ \ \}\n\ \ \ \ proc\ numberofdays\ \{month\ year\}\ \{\n\ \ \ \ \ \ \ \ if\ \{\$month==12\}\ \{set\ month\ 1\;\ incr\ year\}\n\ \ \ \ \ \ \ \ clock\ format\ \[clock\ scan\ \"\[incr\ month\]/1/\$year\ \ 1\ day\ ago\"\]\ \\\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ -format\ %d\n\ \ \ \ \}\n\ \}\ \;#\ end\ namespace\ date\n\n\ #------\ test\ and\ demo\ code\ (terminate\ by\ closing\ the\ main\ window)\n\ while\ 1\ \{\n\ \ \ \ \ set\ date\ \[date::choose\]\n\ \ \ \ \ puts\ \$date\n\ \}\n----\n2001-06-22\ \[RS\]:\ stepping\ through\ months\ does\ not\ check\ for\ day\ validity,\ so\ you\ may\ get\ dates\ like\ 2/31/1999.\ Fixed\ in\ proc\ adjust.\n\n----\n\n2003-03-06\ \[David\ Bigelow\]:\ Added\ the\ ability\ to\ change\ fonts,\ highlight\ weights,\ and\ included\ rectangles\ around\ each\ weekday\ and\ date\ within\ the\ canvas\ -\ so\ it\ looks\ more\ like\ a\ calendar.\n\nBTW\ -\ Nice\ job\ on\ this\ Tcl\ Code\ -\ it\ is\ impressive!\n\n----\n\n2003-03-07\ \[David\ Bigelow\]:\ Updated\ the\ modified\ Code\ to\ act\ more\ like\ a\ widget.\ \ The\ \"choose\"\ command\ was\ altered\ to\ accept\ the\ path\ of\ the\ widget\ that\ launches\ it\ (e.g.,\ button).\ \ The\ Calendar\ selection\ will\ popup\ in\ a\ relative\ position\ to\ the\ widget\ that\ you\ use\ to\ launch\ it.\n\nTo\ select\ a\ date,\ Double\ Click\ on\ the\ desired\ date,\ and\ the\ formatted\ date\ string\ will\ be\ returned\ by\ the\ \"choose\"\ function.\n\nBTW\ -\ Special\ Thanks\ for\ Bryan\ Oakley\ for\ pointing\ out\ the\ vwait\ to\ me\ during\ the\ debugging\ process.\n\nHope\ everyone\ finds\ this\ a\ useful\ and\ productive\ widget.\n\nDave\n\n----\n\n\n======\n\ namespace\ eval\ date\ \{\n\ \ \ \ \ \ \ \ set\ defaultFont\ \{Arial\ 10\ normal\}\n\ \ \ \ option\ add\ *Button.padX\ 0\n\ \ \ \ option\ add\ *Button.padY\ 0\n\ \ \ \ option\ add\ *Button.font\ \$defaultFont\n\ \ \ \ option\ add\ *Entry.font\ \$defaultFont\n\ \ \ \ variable\ canvasFont\ \$defaultFont\n\ \ \ \ variable\ canvasHighlight\ \{Arial\ 11\ bold\}\n\ \ \ \ variable\ canvasHeader\ \{Arial\ 14\ bold\}\n\ \ \ \ variable\ w\ .cal\n\ \ \ \ \n\ \ \ \ proc\ choose\ \{bpath\}\ \{\n\ \ \ \ \ \ \ \ variable\ month\;\ variable\ year\;\ variable\ date\n\ \ \ \ \ \ \ \ variable\ canvas\;\ variable\ res\n\ \ \ \ \ \ \ \ variable\ day\n\ \ \ \ \ \ \ \ set\ year\ \[clock\ format\ \[clock\ seconds\]\ -format\ \"%Y\"\]\n\ \ \ \ \ \ \ \ scan\ \[clock\ format\ \[clock\ seconds\]\ -format\ \"%m\"\]\ %d\ month\n\ \ \ \ \ \ \ \ scan\ \[clock\ format\ \[clock\ seconds\]\ -format\ \"%d\"\]\ %d\ day\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ w\ \$date::w\n\ \ \ \ \ \ \ \ catch\ \{destroy\ \$w\}\n\ \ \ \ \ \ \ \ toplevel\ \$w\ -bg\ white\n\ \ \ \ \ \ \ \ wm\ transient\ \$w\ \$bpath\n\ \ \ \ \ \ \ \ \n\ \ \ \ \ \ \ \ set\ sx\ \[expr\ \[winfo\ rootx\ \$bpath\]\ +\ 15\]\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ sy\ \[expr\ \[winfo\ rooty\ \$bpath\]\ +\ 5\]\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ wm\ geometry\ \$w\ \"+\$sx+\$sy\"\n\ \ \ \ \ \ \ \ \n\ \ \ \ \ \ \ \ wm\ title\ \$w\ \"Choose\ Date:\"\n\ \ \ \ \ \ \ \ \n\ \ \ \ \ \ \ \ frame\ \$w.1\n\ \ \ \ \ \ \ \ entry\ \$w.1.1\ -textvar\ date::month\ -width\ 3\ -just\ center\n\ \ \ \ \ \ \ \ button\ \$w.1.2\ -text\ ^\ -command\ \{date::adjust\ 1\ 0\}\n\ \ \ \ \ \ \ \ button\ \$w.1.3\ -text\ v\ -command\ \{date::adjust\ -1\ 0\}\n\ \ \ \ \ \ \ \ entry\ \$w.1.4\ -textvar\ date::year\ -width\ 4\ -just\ center\n\ \ \ \ \ \ \ \ button\ \$w.1.5\ -text\ ^\ -command\ \{date::adjust\ 0\ 1\}\n\ \ \ \ \ \ \ \ button\ \$w.1.6\ -text\ v\ -command\ \{date::adjust\ 0\ -1\}\n\ \ \ \ \ \ \ \ eval\ pack\ \[winfo\ children\ \$w.1\]\ -side\ left\ -fill\ both\n\ \ \ \ \ \ \ \ set\ canvas\ \[canvas\ \$w.2\ -width\ 160\ -height\ 160\ -bg\ white\]\n\ #\ Uncomment\ the\ following\ to\ include\ additional\ controls\n\ #\ \ \ \ \ \ \ \ \ frame\ \$w.3\n\ #\ \ \ \ \ \ \ \ \ entry\ \$w.3.1\ -textvar\ date::date\ -width\ 10\n\ #\ \ \ \ \ \ \ \ \ button\ \$w.3.2\ -text\ OK\ -command\ \{set\ date::res\ \$date::date\}\n\ #\ \ \ \ \ \ \ \ \ button\ \$w.3.3\ -text\ Cancel\ -command\ \{set\ date::res\ \{\}\}\n\ #\ \ \ \ \ \ \ \ \ eval\ pack\ \[winfo\ children\ \$w.3\]\ -side\ left\n\ \ \ \ \ \ \ \ eval\ pack\ \[winfo\ children\ \$w\]\n\ \ \ \ \ \ \ \ display\n\ \ \ \ \ \ \ \ vwait\ ::date::res\n\ \ \ \ \ \ \ \ destroy\ \$w\n\ \ \ \ \ \ \ \ set\ res\n\ \ \ \ \}\n\ \ \ \ \n\ \ \ \ proc\ adjust\ \{dmonth\ dyear\}\ \{\n\ \ \ \ \ \ \ \ variable\ month\;\ variable\ year\;\ variable\ day\n\ \ \ \ \ \ \ \ set\ year\ \ \[expr\ \{\$year+\$dyear\}\]\n\ \ \ \ \ \ \ \ set\ month\ \[expr\ \{\$month+\$dmonth\}\]\n\ \ \ \ \ \ \ \ if\ \{\$month>12\}\ \{set\ month\ 1\;\ incr\ year\}\n\ \ \ \ \ \ \ \ if\ \{\$month<1\}\ \{set\ month\ 12\;\ incr\ year\ -1\}\n\ \ \ \ \ \ \ \ if\ \{\[numberofdays\ \$month\ \$year\]<\$day\}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ set\ day\ \[numberofdays\ \$month\ \$year\]\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ display\n\ \ \ \ \}\n\ \ \ \ \n\ \ \ \ proc\ display\ \{\}\ \{\n\ \ \ \ \ \ \ \ variable\ month\;\ variable\ year\n\ \ \ \ \ \ \ \ variable\ date\;\ variable\ day\n\ \ \ \ \ \ \ \ variable\ canvas\n\ \ \ \ \ \ \ \ \$canvas\ delete\ all\n\ \ \ \ \ \ \ \ set\ x0\ 20\;\ set\ x\ \$x0\;\ set\ y\ 20\n\ \ \ \ \ \ \ \ set\ dx\ 20\;\ set\ dy\ 20\n\ \ \ \ \ \ \ \ set\ xmax\ \[expr\ \{\$x0+\$dx*6\}\]\n\ \ \ \ \ \ \ \ foreach\ i\ \{S\ M\ T\ W\ T\ F\ S\}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \$canvas\ create\ text\ \$x\ \$y\ -text\ \$i\ -fill\ blue\ -font\ \$date::canvasHeader\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \$canvas\ create\ rectangle\ \[expr\ \$x-10\]\ \[expr\ \$y-10\]\ \[expr\ \$x+10\]\ \[expr\ \$dy+10\]\ -fill\ grey90\ -tags\ boxes\n\ \ \ \ \ \ \ \ \ \ \ \ incr\ x\ \$dx\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ scan\ \[clock\ format\ \[clock\ scan\ \$month/1/\$year\]\ \\\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ -format\ %w\]\ %d\ weekday\n\ \ \ \ \ \ \ \ set\ x\ \[expr\ \{\$x0+\$weekday*\$dx\}\]\n\ \ \ \ \ \ \ \ incr\ y\ \$dy\n\ \ \ \ \ \ \ \ set\ nmax\ \[numberofdays\ \$month\ \$year\]\n\ \ \ \ \ \ \ \ for\ \{set\ d\ 1\}\ \{\$d<=\$nmax\}\ \{incr\ d\}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ set\ id\ \[\$canvas\ create\ text\ \$x\ \$y\ -text\ \$d\ -font\ \$date::canvasFont\ -tag\ day\]\n\ \ \ \ \ \ \ \ \ \ \ \ \ switch\ \$x\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 20\ -\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 140\ \{set\ fillColor\ pink1\}\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ default\ \{set\ fillColor\ bisque1\}\n\ \ \ \ \ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \$canvas\ create\ rectangle\ \[expr\ \$x-10\]\ \[expr\ \$y-10\]\ \[expr\ \$x+10\]\ \[expr\ \$y+10\]\ -fill\ \$fillColor\ -tags\ boxes\n\ \ \ \ \ \ \ \ \ \ \ \ if\ \{\$d==\$day\}\ \{\$canvas\ itemconfig\ \$id\ -fill\ red\ -font\ \$date::canvasHighlight\}\n\ \ \ \ \ \ \ \ \ \ \ \ incr\ x\ \$dx\n\ \ \ \ \ \ \ \ \ \ \ \ if\ \{\$x>\$xmax\}\ \{set\ x\ \$x0\;\ incr\ y\ \$dy\}\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \n\ \ \ \ \ \ \ \ \$canvas\ lower\ boxes\n\n\ \ \ \ \ \ \ \ \$canvas\ bind\ day\ <1>\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ set\ item\ \[%W\ find\ withtag\ current\]\n\ \ \ \ \ \ \ \ \ \ \ \ set\ date::day\ \[%W\ itemcget\ \$item\ -text\]\n\ \ \ \ \ \ \ \ \ \ \ \ set\ date::date\ \"\$date::month/\$date::day/\$date::year\"\n\ \ \ \ \ \ \ \ \ \ \ \ %W\ itemconfig\ day\ -fill\ black\ -font\ \$date::canvasFont\n\ \ \ \ \ \ \ \ \ \ \ \ %W\ itemconfig\ \$item\ -fill\ red\ -font\ \$date::canvasHighlight\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \$canvas\ bind\ day\ <Double-Button-1>\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ set\ item\ \[%W\ find\ withtag\ current\]\n\ \ \ \ \ \ \ \ \ \ \ \ set\ date::day\ \[%W\ itemcget\ \$item\ -text\]\n\ \ \ \ \ \ \ \ \ \ \ \ set\ date::date\ \"\$date::month/\$date::day/\$date::year\"\ \ \ \ \ \ \ \ \n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ date::res\ \$date::date\n\ \ \ \ \ \ \ \}\n\ \ \ \ \}\n\n\ \ \ \ proc\ numberofdays\ \{month\ year\}\ \{\n\ \ \ \ \ \ \ \ if\ \{\$month==12\}\ \{set\ month\ 1\;\ incr\ year\}\n\ \ \ \ \ \ \ \ clock\ format\ \[clock\ scan\ \"\[incr\ month\]/1/\$year\ \ 1\ day\ ago\"\]\ \\\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ -format\ %d\n\ \ \ \ \}\n\ \ \ \ \ \ \ \ \n\ \}\ \;#\ end\ namespace\ date\n\n\ #\ --\ DEMONSTRATION\ CODE\ --\ \n\ #\ Show\ a\ TextBox\ to\ Display\ Results\n\ pack\ \[text\ .tb\]\ -expand\ y\ -fill\ both\n\ pack\ \[button\ .calendar\ -text\ \"Pick\ Date\"\ -command\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ Note:\ date::choose\ \{Object\ to\ Refernece\ for\ Window\ Position\}\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ .tb\ insert\ end\ \"SELECTED:\ \[date::choose\ .calendar\]\\n\"\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}\]\n\ pack\ \[button\ .ex\ -text\ \"Exit\"\ -bg\ red\ -fg\ white\ -command\ \{exit\}\]\n======\n\n----\nSee\ also\ \[a\ calendar\ widget\]\n\n----\nJDG:\ \ Here\ is\ a\ modification\ I\ made\ to\ the\ buttons\ in\ the\ date\ chooser.\ \ IMHO,\ it's\ much\ easier\ to\ use.\n\n=====\nwm\ transient\ \$w\ \$bpath\n\ \ \ \ \ \ \n\ \ \ \ \ \ set\ sx\ \[expr\ \[winfo\ rootx\ \$bpath\]\ +\ 15\]\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ sy\ \[expr\ \[winfo\ rooty\ \$bpath\]\ +\ 5\]\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ wm\ geometry\ \$w\ \"+\$sx+\$sy\"\n\ \ \ \ \ \ \n\ \ \ \ \ \ wm\ title\ \$w\ \"Choose\ Date:\"\n\ \ \ \ \ \ \n\ \ \ \ \ \ frame\ \$w.1\n\ \ \ \ \ \ entry\ \$w.1.1\ -textvar\ date::month\ -width\ 3\ -just\ center\n\ \ \ \ \ \ button\ \$w.1.2\ -text\ \"<\"\ -command\ \{date::adjust\ -1\ 0\}\n\ \ \ \ \ \ button\ \$w.1.3\ -text\ \">\"\ -command\ \{date::adjust\ 1\ 0\}\n\ \ \ \ \ \ entry\ \$w.1.4\ -textvar\ date::year\ -width\ 4\ -just\ center\n\ \ \ \ \ \ button\ \$w.1.5\ -text\ \"<\"\ -command\ \{date::adjust\ 0\ -1\}\n\ \ \ \ \ \ button\ \$w.1.6\ -text\ \">\"\ -command\ \{date::adjust\ 0\ 1\}\n\ \ \ \ \ \ eval\ pack\ \$w.1.2\ \$w.1.1\ \$w.1.3\ \$w.1.5\ \$w.1.4\ \$w.1.6\ -side\ left\ -fill\ both\n\ \ \ \ \ \ #\ eval\ pack\ \[winfo\ children\ \$w.1\]\ -side\ left\ -fill\ both\n\ \ \ \ \ \ set\ canvas\ \[canvas\ \$w.2\ -width\ 160\ -height\ 160\ -bg\ white\]\n#\ Uncomment\ the\ following\ to\ include\ additional\ controls\n======\n\nI\ also\ commented\ out\ the\ \"`option\ add\ *Button`\"\ \ lines\ at\ the\ top.\ \ And,\ to\ stop\ it\ from\ torturing\ my\ eyes,\ I\ changed\ the\ fonts:\n\n======\nnamespace\ eval\ date\ \{\n\ \ \ \ \ \ set\ defaultFont\ \{Helvetica\ 12\ bold\}\n#\ \ \ option\ add\ *Button.padX\ 4\n#\ \ \ option\ add\ *Button.padY\ 4\n#\ \ \ option\ add\ *Button.font\ \$defaultFont\n#\ \ \ option\ add\ *Entry.font\ \$defaultFont\n\ \ \ variable\ canvasFont\ \$defaultFont\n\ \ \ variable\ canvasHighlight\ \{Helvetica\ 11\ bold\}\n\ \ \ variable\ canvasHeader\ \{Helvetica\ 14\ bold\}\n\ \ \ variable\ w\ .cal\n======\n\nThis\ way,\ you\ have\ `\[\[\ <\ \]\]\ 12\ \[\[\ >\ \]\]\ \[\[\ <\ \]\]\ 2015\ \[\[\ >\ \]\]`\n\nLike\ it,\ hate\ it,\ whatever\ ...\ just\ sharing.\ \ :-)\n\n<<categories>>\ Arts\ and\ crafts\ of\ Tcl-Tk\ programming\ |\ Package\ |\ Widget\ |\ Date\ and\ Time} CALL {my revision {A little date chooser}} CALL {::oo::Obj6913667 process revision/A+little+date+chooser} CALL {::oo::Obj6913665 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