Error processing request

Parameters

CONTENT_LENGTH0
REQUEST_METHODGET
REQUEST_URI/revision/bind?V=83
QUERY_STRINGV=83
CONTENT_TYPE
DOCUMENT_URI/revision/bind
DOCUMENT_ROOT/var/www/nikit/nikit/nginx/../docroot
SCGI1
SERVER_PROTOCOLHTTP/1.1
HTTPSon
REMOTE_ADDR172.70.127.43
REMOTE_PORT58116
SERVER_PORT4443
SERVER_NAMEwiki.tcl-lang.org
HTTP_HOSTwiki.tcl-lang.org
HTTP_CONNECTIONKeep-Alive
HTTP_ACCEPT_ENCODINGgzip, br
HTTP_X_FORWARDED_FOR3.145.156.46
HTTP_CF_RAY87af2833db53292b-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.145.156.46
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 bind **Summary**\n**\ Documentation\ **\nbind\ -\ Arrange\ for\ \[X11%|%X%|%\]\ \[event\]s\ to\ invoke\ Tcl\ scripts\n\n\n\ \ \ \ :\ \ \ '''bind'''\ ''tag\ sequence''\n\n\ \ \ \ :\ \ \ '''bind'''\ ''tag\ sequence\ script''\n\n\ \ \ \ :\ \ \ '''bind'''\ ''tag\ sequence\ '''''+'''''script''\n\n\nThe\ ''tag''\ is\ formally\ a\ \[bindtags\]\ tag,\ but\ for\ most\ user\ code\ it\ is\ best\ to\ use\ widget\ names.\ The\ optional\ ''sequence''\ says\ what\ event\ to\ work\ with\;\ if\ omitted,\ '''bind'''\ returns\ what\ bindings\ are\ set\ on\ ''tag''.\ If\ ''script''\ is\ given,\ it\ replaces\ (or\ deletes,\ if\ empty,\ or\ appends,\ if\ it\ starts\ with\ a\ “'''+'''”)\ the\ binding\ script,\ and\ if\ ''script''\ is\ omitted\ (but\ ''sequence''\ is\ given)\ then\ the\ current\ binding\ script\ is\ returned.\n\nManual\ page:\ \[http://www.purl.org/tcl/home/man/tcl8.5/TkCmd/bind.htm%|%bind(n)%|%\]\n**\ Description\ **\nThis\ command\ (part\ of\ \[Tk\])\ is\ used\ to\ associate\ Tcl\ commands\ to\ execute\ upon\ the\ press\ of\ specific\ keys.\nAlso,\ bind\ may\ be\ driven\ by\ other\ events,\ both\ real\ and\ virtual,\ such\ as\ enter,\ leave,\ focus\ in,\ focus\ out,\ etc.\ See\ the\ documentation\ for\ specific\ details.\n`bind`\ (part\ of\ \[Tk\])\ is\ used\ to\ associate\ Tcl\ commands\ to\ execute\ upon\nKeyboard\ symbols\ are\ the\ Tk\ \"strings\"\ associated\ with\ particular\ sequences\ of\ keyboard\ keys\ that\ one\ can\ press,\ such\ as\ Shift,\ or\ A\ or\ special\ function\ keys\ such\ as\ Page\ Up,\ etc.\nSee\ \[http://www.purl.org/tcl/home/man/tcl8.5/TkCmd/keysyms.htm%|%keysyms(n)%|%\]\ for\ the\ keyboard\ symbols\ to\ which\ one\ can\ potentially\ bind\ things.\nOf\ course,\ the\ specific\ keysyms\ available\ to\ you\ on\ any\ particular\ platform/hardware\ depend\ on\ factors\ outside\ of\ Tk's\ control.\n(See\ below\ for\ a\ simple\ script\ for\ determining\ what\ the\ specific\ keysym\ for\ a\ character\ is.)\n''tag''\ is\ formally\ a\ `\[bindtags\]`\ tag,\ but\ for\ most\ user\ code\ it\ is\ best\ to\nSee\ also:\n\ \ \ *\ \[Bindings\ and\ why\ they\ are\ important\]\n\n\ \ \ *\ \[Bindings\ and\ variable\ substitution\]\n\n\ \ \ *\ \[Disable\ autorepeat\ under\ X11\]\n\n\ \ \ *\ \[mousewheel\]\ bindings\n\n\ \ \ *\ \[binding\ to\ a\ single\ mouse\ click\]\n\n\ \ \ *\ \[Key-press\ names\]\ \ \ \n\n----\n**Eggdrop**\nIf\ you\ are\ looking\ for\ the\ \[eggdrop\]\ bind\ command,\ try\ this:\ \[http://www.eggheads.org/support/egghtml/1.6.17/tcl-commands.html#bind\]\n<<discussion>>\n-----\nQuestion:\ Is\ there\ an\ introspective\ method\ that\ a\ Tk\ application\ can\ determine\ whether\ a\ keysym\ is\ currently\ available\ for\ it\ to\ use?\n\n----\n**Using\ Bind\ Effectively**\n***bind\ syntax\ example***\n\[RS\]\ writes\ on\ comp.lang.tcl:\ The\ bind\ syntax\ is\ actually\ very\ easy.\ With\ x\ set\ to\ a\ widget\ (e.g.\n.mytext)\ or\ a\ class\ (e.g.\ Text),\ call\n\n\ \ \ \ \ \ \ \ bind\ \$x\nto\ get\ a\ list\ of\ defined\ bindings.\ This\ list\ contains\ <Key-Prior>\ which\ is\ the\nto\ get\ a\ list\ of\ defined\ bindings.\ This\ list\ contains\ <Key-Prior>\ which\ is\ the\ correct\ name\ for\ the\ Page\ Up\ key.\ To\ see\ what\ it\ is\ bound\ to,\ call\n======\n\ \ \ \ \ \ \ \ bind\ \$x\ <Key-Prior>\nTo\ mirror\ this\ binding\ to\ another\ event,\ make\ that\n\n======\n\ \ \ \ \ \ \ \ bind\ \$x\ <Control-r>\ \[bind\ \$x\ <Key-Prior>\]\nlike\ you\ tried,\ just\ with\ the\ incorrect\ name.\ BTW,\ you\ normally\ need\ not\nlike\ you\ tried,\ just\ with\ the\ incorrect\ name.\ BTW,\ you\ normally\ need\ not\ include\ variable\ names\ in\ braces\ -\ only\ if\ they\ contain\ characters\ other\ than\ A-Z\ a-z\ 0-9\ _.\n\n----\n***keysyms***\n\n\[KBK\]\ -\ You\ can\ find\ the\ keysym\ for\ a\ key\ on\ an\ unfamiliary\ keyboard\ by\ running\ ''wish''\ against\ the\ one-line\ script:\n**\ Finding\ keysyms\ ***\n\ \ \ \ bind\ .\ <KeyPress>\ \{\ puts\ %K\ \}\ \;\ focus\ .\ndirecting\ focus\ at\ the\ (empty)\ ''wish''\ window,\ and\ touching\ the\ key\ in\ndirecting\ focus\ at\ the\ (empty)\ ''wish''\ window,\ and\ touching\ the\ key\ in\ question.\ \ (On\ Windows,\ you'll\ need\ to\ add\n======\n\ \ \ \ console\ show\nto\ the\ script\ so\ that\ you\ can\ see\ its\ output.\nto\ the\ script\ so\ that\ you\ can\ see\ its\ output!)\n\[Arjen\ Markus\]:\ You\ may\ also\ put\ up\ a\ text\ widget\ and\ display\ the\ keysym\ by\ the\n\[Arjen\ Markus\]\ You\ may\ also\ put\ up\ a\ text\ widget\ and\ display\ the\ keysym\ by\ the\ following\ script:\n======\n\ \ \ bind\ .textwidget\ <KeyPress>\ \{\ %W\ insert\ end\ \"%K\\n\"\ \}\n\ \ \ focus\ .textwidget\n\n----\n***ways\ to\ specify\ a\ key\ to\ bind***\n**\ Specifying\ a\ Key\ to\ `bind`\ **\n\[Arjen\ Markus\]\ There\ are\ several\ ways\ to\ define\ a\ specific\ key,\ for\ instance:\n======\n\ \ \ <Key-keysym>\n\ \ \ <KeyPress-keysym>\n\ \ \ <KeyRelease-keysym>\ (subtle\ differences\ here!)\n\ \ \ <keysym>\n\ \ \ <A>\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (if\ the\ character\ is\ plain\ ASCII)\nFor\ a\ space,\ you\ will\ need\ to\ use:\n\n======\n\ \ \ <Key-space>\nanything\ else\ seems\ to\ give\ problems.\n\nAlso\ note\ that\ keysyms\ are\ case-sensitive:\ \"Down\"\ for\ the\ downward\ arrow\ and\nAlso\ note\ that\ keysyms\ are\ case-sensitive:\ \"Down\"\ for\ the\ downward\ arrow\ and\ \"space\"\ for\ a\ space\ (\"down\"\ and\ \"Space\"\ do\ ''not''\ work\;\ quotation\ marks\ for\ convenience\ only)\n\n----\n***bind\ to\ a\ mouse\ action***\n\n\[LV\]\ If\ you\ are\ wanting\ to\ bind\ actions\ to\ a\ mouse\ button\ action,\ rather\nthan\ a\ keyboard\ press,\ then\ you\ appear\ to\ be\ able\ to\ use:\n**\ `bind`\ to\ a\ Mouse\ Action\ **\n\ bind\ \$x\ <ButtonRelease-1>\ \ \{\ puts\ \"Unmodified\ button\"\ \}\n\ bind\ \$x\ <Shift-ButtonRelease-1>\ \{\ puts\ \"Shift\ button\ 1\ release\"\ \}\n\n----\n\[Martin\ Lemburg\]\ July\ 2nd,\ 2002:\n\[Martin\ Lemburg\]\ 2002-07-02:\ Why\ isn't\ there\ an\ event\ ''Invoke''\ for\ invokeable\nI\ have\ a\ question:\nThan\ ...\nWhy\ isn't\ there\ an\ event\ ''Invoke''\ for\ invokeable\ widgets,\ like\ buttons?\ Wouldn't\ make\ it\ sense\ to\ have\ such\ an\ event?\ To\ bind\ widgets\ using\ the\ ''Invoke''\ event,\ like\ to\ connect\ a\ widget\ with\ the\ ''-command''\ option\ to\ an\ event\ handler?\n\n\n======\n\ button\ .b\ -text\ exit\ -command\ \{cmdProc\ .b\ \[clock\ seconds\]\}\;\n...\ would\ be\ equal\ to\ ...\n\n======\n\ bind\ .b\ <Invoke>\ \{cmdProc\ %W\ %t\}\;\nIt\ shouldn't\ be\ a\ problem\ to\ use\ the\ substitution\ capabilities\ during\ the\ usage\ of\ a\ binding,\ like:\n\n======\n\ button\ .b\ -text\ exit\ -command\ \{cmdProc\ %W\ %t\}\;\nWouldn't\ that\ be\ nice\ and\ consequent?\n\nWouldn't\ it\ be\ consequent\ (for\ example)\ to\ use\ bindings\ to\ scrollbars\ or\nWouldn't\ it\ be\ consequent\ (for\ example)\ to\ use\ bindings\ to\ scrollbars\ or\ entries\ too?\ ...\n======\n\ entry\ \ \ \ \ .e\ \ \ -textvariable\ filter\;\n\ button\ \ \ \ .b\ \ \ -text\ \"filter\"\;\n\ listbox\ \ \ .lb\ \ -listvar\ data\ -selectmode\ extended\;\n\ scrollbar\ .sbx\ -orient\ horizontal\;\n\ scrollbar\ .sby\ -orient\ vertical\;\nbind\ .e\ \ \ <Validate>\ \{validateFilter\ %V\ %s\}\;\n\ bind\ .e\ \ \ <Validate>\ \{validateFilter\ %V\ %s\}\;\n\ bind\ .b\ \ \ <Invoke>\ \ \ \{filter\ .e\ .lb\}\;\n\ bind\ .lb\ \ <XScroll>\ \ \{.sbx\ set\}\;\n\ bind\ .lb\ \ <YScroll>\ \ \{.sby\ set\}\;\n\ bind\ .sbx\ <Invoke>\ \ \ \{.lb\ xview\}\;\n\ bind\ .sby\ <Invoke>\ \ \ \{.lb\ yview\}\;\nThere\ would\ be\ the\ chance\ to\ elimate\ all\ (event)handlers\ from\ that\ code,\ that\nThere\ would\ be\ the\ chance\ to\ elimate\ all\ (event)handlers\ from\ that\ code,\ that\ only\ builds\ up\ the\ GUI.\ The\ code\ to\ handle\ events\ could\ use\ now\ use\ bindings.\n\n----\n***caution\ when\ using\ abbreiviated\ binding\ descriptions***\n\n\[Ken\ Jones\]\ writes\ on\ comp.lang.tcl,\ in\ response\ to\ a\ developer\ trying\ to\ bind\ actions\ on\ numeric\ keys\ using\ \n**\ Caution:\ Abbreviated\ `bind`\ Descriptions\ **\n\ bind\ .bu1\ <Alt-2>\ \"focus\ .bu2\"\nWhat\ you're\ experiencing\ is\ one\ of\ those\ traps\ that\ people\ encounter\ when\ they\nthe\ following\ response:\nOn\ the\ other\ hand,\ Tcl\ also\ allows\ you\ to\ abbreviate\ ButtonPress\ events,\ so\ <1>\nWhat\ you're\ experiencing\ is\ one\ of\ those\ traps\ that\ people\ encounter\ when\ they\ use\ abbreviated\ binding\ descriptions.\ For\ many\ KeyPress\ events,\ you\ can\ get\ by\ with\ providing\ only\ the\ keysym.\ So,\ <a>\ is\ equivalent\ to\ <KeyPress-a>,\ and\ <Control-a>\ is\ equivalent\ to\ <Control-KeyPress-a>.\nSolution?\ `bind`\ to\ `<Alt-KeyPress-1>`\ and\ `<Alt-KeyPress-2>`.\ And\ be\ very\ careful\nOn\ the\ other\ hand,\ Tcl\ also\ allows\ you\ to\ abbreviate\ ButtonPress\ events,\ so\ <1>\ is\ equivalent\ to\ <ButtonPress-1>.\ And\ <Alt-1>\ through\ <Alt-5>\ is\ equivalent\ to\ <Alt-ButtonPress-1>\ through\ <Alt-ButtonPress-5>.\n\nSolution?\ Bind\ to\ <Alt-KeyPress-1>\ and\ <Alt-KeyPress-2>.\ And\ be\ very\ careful\ relying\ on\ abbreviated\ event\ descriptions\ in\ bindings.\n\n----\n***binding\ so\ that\ keypad\ keys\ respond***\n**\ Keypad\ Keys\ **\n\[LV\]\ I\ am\ trying\ to\ get\ the\ following\ sample\ program\ to\ display\ the\ numbers\n\n======\npackage\ require\ Tk\n\ #!\ /usr/tcl84/bin/tclsh\nentry\ .e\n\ package\ require\ Tk\nThe\ expectation\ was\ that\ I\ would\ get\ an\ entry\ widget\ into\ which\ I\ could\ press\n\ entry\ .e\n\ bind\ .e\ <KeyPress-1>\ \{\ puts\ 1\ \}\n\ pack\ .e\n\ focus\ .e\n\nThe\ expectation\ was\ that\ I\ would\ get\ an\ entry\ widget\ into\ which\ I\ could\npress\ the\ keys\ on\ the\ keypad\ and\ get,\ in\ this\ case,\ the\ number\ 1\ into\nthe\ entry\ widget.\ \ What\ I\ experience\ is\ that\ after\ I\ mouse\ into\ the\nwidget\ and\ click,\ I\ can\ type\ alphas\ and\ the\ numbers\ on\ top\ row\ of\ the\nmain\ keyboard,\ but\ the\ keypad\ keys\ are\ generating\ nothing...\nPeter\ Newman\ 2004-04-30:\ ''NumLock''\ switches\ the\ keypad\ between\ numbers\ and\nPeter\ Newman\ 30\ April\ 2004:\ ''NumLock''\ switches\ the\ keypad\ between\ numbers\ and\ cursor\ keys.\ I\ presume\ you\ tried\ both\ settings\ -\ and\ still\ no\ joy.\ If\ so,\ then\ it\ would\ appear\ that\ Tk\ doesn't\ support\ the\ keyboard\ properly.\n\nPierre\ Coueffin\ 2004-04-12:\ Try\ `<KeyPress-KP_1>`\nPierre\ Coueffin\ 12\ April\ 2005:\ Try\ <KeyPress-KP_1>\nThomas\ Guettler\ 26\ April\ 2006:\ Or\ Try\ `<KP_End>`\nThomas\ Guettler\ 26\ April\ 2006:\ Or\ Try\ <KP_End>\n\n======\n\n----\nQ.\ Given\ a\ string\ specifying\ an\ event\ sequence,\nhow\ to\ obtain\ some\ sort\ of\ \"normal\ form\"\ for\ that\ event\ sequence,\nso\ that,\ for\ example,\ '1'\ and\ 'Mousebutton-1'\ (or\ whatever\nthe\ long\ form\ is)\ both\ map\ to\ the\ same\ normal\ form\ indicating\na\ single\ click\ of\ mouse\ button\ 1?\nQ.\ Given\ a\ string\ specifying\ an\ event\ sequence,\ how\ to\ obtain\ some\ sort\ of\nA.\ (\[KBK\])\ Hmm,\ bind\ it\ to\ a\ nonexistent\ bindtag\ and\ then\ query\ the\ bindings\n\n======none\n\ %\ bind\ Nothing\ <Button1-ButtonPress-2>\ \{\;\}\n\ %\ bind\ Nothing\n\ <B1-Button-2>\n\n----\n***bindings\ for\ control\ sequences***\n**\ Control\ Sequences\ **\n\[Dossy\]\ 29mar2005:\ I\ just\ spent\ a\ good\ hour\ only\ trying\ to\ understand\ \[\[bind\]\]\ only\ to\ discover\ that\ \[\[bind\ .\ <Control-a>\ \{script\}\]\]\ is\ NOT\ the\ same\ as\ \[\[bind\ .\ <Control-A>\ \{script\}\]\]\ --\ the\ former\ works,\ the\ latter\ doesn't.\n\[RS\]\ would\ expect\ that\ <Control-A>\ is\ equivalent\ to\ <Control-Shift-a>\ ...\ case\ matters,\ doesn't\ it?\n\[Dossy\]\ 2005-03-29:\ I\ just\ spent\ a\ good\ hour\ only\ trying\ to\ understand\ `bind`\n\[MG\]\ The\ bindings\ for\ this,\ after\ a\ little\ playing,\ seem\ slightly\ strange.\ Without\ Caps\ Lock\ on,\ Shift\ and\ the\ 'a'\ key\ (to\ get\ an\ upper-case\ A)\ fires\ the\ binding\ for\ Shift\ and\ (uppercase)\ A.\ The\ only\ way\ to\ fire\ a\ binding\ for\ Shift\ and\ (lowercase)\ a\ that\ I\ can\ find\ is\ to\ turn\ Caps\ Lock\ on,\ and\ -then-\ press\ the\ 'a'\ key\ with\ Shift\ held\ down.\n\[RS\]:\ would\ expect\ that\ `<Control-A>`\ is\ equivalent\ to\ `<Control-Shift-a>`\ ...\ case\nCJL\ The\ minimal\ example\ of\ this\ mildly\ unexpected\ behaviour\ is\ to\ switch\ Caps\ Lock\ on,\ then\ in\ a\ Wish\ console\ (I'm\ talking\ Windoze\ here)\ type\ something,\ highlight\ it\ and\ press\ Ctrl-C.\ Now\ try\ to\ paste\ your\ text\ somewhere\ else\ (e.g.\ Notepad)\ using\ Ctrl-V\ -\ you'll\ discover\ that\ the\ copy\ didn't\ happen,\ but\ even\ though\ Caps\ Lock\ is\ still\ on,\ Notepad\ will\ quite\ happily\ obey\ the\ paste\ request\ (by\ pasting\ whatever\ was\ already\ in\ the\ clipboard).\ To\ me\ 'Ctrl-C'\ means\ \"the\ physical\ key\ labelled\ with\ a\ 'C'\ was\ pressed\ while\ ctrl\ was\ down\",\ and\ should\ have\ nothing\ to\ do\ with\ the\ state\ of\ Caps\ Lock,\ only\ the\ combination\ of\ keys\ pressed.\n\[MG\]:\ The\ bindings\ for\ this,\ after\ a\ little\ playing,\ seem\ slightly\ strange.\n\[WHD\]:\ On\ both\ Windows\ and\ Mac\ OS\ X,\ normal\ apps\ accept\ both\ Control-v\ and\ Control-V\ (Command-v\ and\ Command-V)\ as\ the\ Paste\ key.\ \ For\ Tk,\ it\ appears\ that\ you\ need\ to\ bind\ both.\ \ On\ the\ other\ hand,\ if\ you\ bind\ both\ you'll\ find\ that\ all\ of\ the\ following\ combinations\ will\ paste:\nCJL\ The\ minimal\ example\ of\ this\ mildly\ unexpected\ behaviour\ is\ to\ switch\ Caps\n\ \ \ *\ Control-v\n\ \ \ *\ Control-V\n\ \ \ *\ Shift-Control-v\n\ \ \ *\ Shift-Control-V\nIf\ you\ want\ to\ support\ Shift-Control\ sequences\ in\ your\ keyset,\ you\ need\ to\ bind\nIf\ you\ want\ to\ support\ Shift-Control\ sequences\ in\ your\ keyset,\ you\ need\ to\ bind\ both\ Shift-Control-v\ and\ Shift-Control-V.\ \ Here's\ a\ simple\ solution\ that\ results\ in\ CapsLock-independent\ letter\ key\ bindings:\n\ \ \ \ bind\ \$tag\ <\$modifier-\$upper>\ \$binding\n\ proc\ bindletterkey\ \{tag\ modifier\ letter\ binding\}\ \{\n\ \ \ \ \ set\ upper\ \[string\ toupper\ \$letter\]\n\ \ \ \ \ set\ lower\ \[string\ tolower\ \$letter\]\nbindletterkey\ .text\ Control\ F\ \ \ \ \ \ \ \{puts\ Control-F\}\n\ \ \ \ \ bind\ \$tag\ <\$modifier-\$upper>\ \$binding\n\ \ \ \ \ bind\ \$tag\ <\$modifier-\$lower>\ \$binding\n\ \}\ \n\n\ bindletterkey\ .text\ Control\ F\ \ \ \ \ \ \ \{puts\ \"Control-F\"\}\n\ bindletterkey\ .text\ Shift-Control\ F\ \{puts\ \"Shift-Control-F\"\}\n**\ Case\ Insensitive\ Binding\ **\n\[MG\]\ 2005-06-06:\ \ And,\ where\ the\ bindings\ already\ exist\ (ie,\ for\ the\ Text\n\[MG\]\ adds,\ on\ June\ 6\ 2005\ -\ And,\ where\ the\ bindings\ already\ exist\ (ie,\ for\ the\ Text\ widget)\ and\ you\ want\ to\ make\ them\ case-insensitive,\ something\ like\ this\ will\ help.\n======\n\ proc\ mirror\ \{class\ \{dir\ 1\}\}\ \{\n\ \ if\ \{\ \$dir\ ==\ \"1\"\ \}\ \{\n\ \ \ \ \ \ \ set\ range\ \"a-z\"\n\ \ \ \ \ \ \ set\ case\ \"toupper\"\n\ \ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ \ set\ range\ \"A-Z\"\n\ \ \ \ \ \ \ set\ case\ \"tolower\"\n\ \ \ \ \ \}\n\ \ foreach\ x\ \[bind\ \$class\]\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \ if\ \{\ \[regexp\ \"^<(.+-)?\[\$range\]>\$\"\ \$x\]\ \}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ y\ \[string\ range\ \$x\ end-1\ end-1\]\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ y\ \"\[string\ range\ \$x\ 0\ end-2\]\[string\ \$case\ \$y\]>\"\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ if\ \{\ \[bind\ \$class\ \$y\]\ !=\ \"\"\ \}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ continue\;\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ bind\ \$class\ \$y\ \[bind\ \$class\ \$x\]\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \ \ \ \ bind\ \$class\ \$y\ \[bind\ \$class\ \$x\]\n\ \}\;#\ mirror\nThen\ run,\ for\ instance:\n\n======\n\ \ mirror\ Text\ 1\;\ \ #\ copy\ all\ lower-class\ bindings\ for\ the\ Text\ \ widget\ to\ upper-class\ versions\n\ \ mirror\ Text\ 0\;\ \ #\ copy\ all\ upper-class\ bindings\ for\ the\ Text\ \ widget\ to\ lower-class\ versions\n\ \ mirror\ Entry\ 1\;\ #\ copy\ all\ lower-class\ bindings\ for\ the\ Entry\ widget\ to\ upper-class\ versions\nIt's\ also\ careful\ not\ to\ overwrite\ bindings\ -\ if\ you\ have\ an\ <a>\ and\ an\ <A>\nIt's\ also\ careful\ not\ to\ overwrite\ bindings\ -\ if\ you\ have\ an\ <a>\ and\ an\ <A>\ binding\ for\ the\ Text\ widget,\ and\ run\ ''mirror\ Text\ 1'',\ <A>\ will\ be\ left\ as\ it\ is,\ rather\ than\ being\ overwritten\ with\ <a>'s\ binding.\nThis\ raises\ one\ question\ for\ me,\ though\ -\ what's\ better\ practice?\ Should\ you\nThis\ raises\ one\ question\ for\ me,\ though\ -\ what's\ better\ practice?\ Should\ you\ bind\ to\n\ bind\ Text\ <A>\ \[bind\ Text\ <a>\]\n\n\ bind\ Text\ <A>\ \{event\ generate\ %W\ <a>\}\n\n\n----\n**\ Unbound\ `bind`\ **\n\nSome\ of\ the\ best\ '''bind'''\ coding\ doesn't\ involve\ '''bind'''\ at\ all.\ \ \[DKF\],\ for\ example,\nastutely\ remarked\ that\nSome\ of\ the\ best\ `bind`\ coding\ doesn't\ involve\ '''bind'''\ at\ all.\ \ \[DKF\],\n\ \ \ \ event\ add\ <<Copy>>\ <Control-C>\ntrumps\n\n======\n\ \ \ \ bind\ \$class\ <Control-Key-C>\ \[bind\ \$type\ <<Copy>>\]\n\ \ \ \ bind\ \$class\ <Control-Key-c>\ \[bind\ \$type\ <<Copy>>\]\n\n\n\n----\n***Bind\ to\ a\ plain\ keystroke\ only\ (not\ modified\ by\ Ctrl\ or\ Alt)***\nproc\ bind'plainkey\ \{tag\ key\ script\}\ \{\ \n\ proc\ bind'plainkey\ \{tag\ key\ script\}\ \{\ \n\ \ \ bind\ \$tag\ <Control-\$key>\ \{\ \}\ \n\ \ \ bind\ \$tag\ <Alt-\$key>\ \ \ \ \ \{\ \}\ \n\ \ \ bind\ \$tag\ \$key\ \$script\ \n\ \}\ \n\n\n\ bind'plainkey\ all\ x\ \{puts\ Hello\}\ \n======\n\n\[RUJ\]\nIf\ bind\ leave\ command\ to\ main\ window\ it\ is\ not\ (bindings)\ grabbing\ to\ its\ associated\ widgets.\ e.g.:\ \ \n\[RUJ\]:\ If\ bind\ leave\ command\ to\ main\ window\ it\ is\ not\ (bindings)\ grabbing\ to\n\ toplevel\ \$wa\ -bd\ 1\ -relief\ ridge\ \;\n\ wm\ geometry\ \$wa\ 600x40+\$mousex+\$mousey\ \;\n\ wm\ resizable\ \$wa\ 0\ 0\ \;\n\ wm\ overrideredirect\ \$wa\ yes\ \;\n\ wm\ iconname\ \$wa\ \"menu\"\ \;\n\ wm\ group\ \$wa\ .\ \;\n\ focus\ \$wa\ \;\n\ grab\ set\ \$wa\ \;\n\ \n\ entry\ \$wa.ent01\ \\\n\ \ \ \ \ \ \ \ -width\ 6\ -background\ white\ \nentry\ \$wa.ent01\ -width\ 6\ -background\ white\ \n\ \ \ \ \ \ \ \ \ bind\ \$wa\ <1>\ \[list\ after\ cancel\ destroy\ .base\]\n\ \ \ \ \ \ \ \ \ bind\ \$wa\ <Leave>\ \[list\ destroy\ .base\]\nBut\ it\ is\ destroying\ base\ if\ cursor\ goes\ near\ to\ entry.\nCan\ anybody\ solve\ the\ problem.\n----\n***how\ to\ disable\ pasting***\n\n2008-03-17:\ How\ can\ I\ disable\ pasting\ into\ a\ text\ widget?\ I\ tried\ the\ following:\n2008-03-17:\ How\ can\ I\ disable\ pasting\ into\ a\ text\ widget?\ I\ tried\ the\n\ \ bind\ \$theText\ <<Paste>>\ \{tk_messageBox\ -message\ \"Paste\ Attempt\"\}\n\ \ bind\ \$theText\ <Control-v>\ \{tk_messageBox\ -message\ \"Paste\ Attempt\"\}\n\ \ bind\ \$theText\ <Button-2>\ \{tk_messageBox\ -message\ \"Paste\ Attempt\"\}\n\ \ bind\ \$theText\ <Shift-Insert>\ \{tk_messageBox\ -message\ \"Paste\ Attempt\"\}\nThe\ message\ boxes\ are\ shown,\ so\ the\ event\ handling\ works.\ But\ after\ the\ message\nThe\ message\ boxes\ are\ shown,\ so\ the\ event\ handling\ works.\ But\ after\ the\ message\ box\ has\ been\ clicked\ away,\ the\ pasting\ takes\ place\ anyway\ -\ at\ least\ for\ Shift-Insert.\nAnswer:\ You\ are\ adding\ bindings\ to\ the\ widget\ but\ aren't\ addressing\ the\n''You\ are\ adding\ bindings\ to\ the\ widget\ but\ aren't\ addressing\ the\ bindings\ associated\ with\ the\ widget\ class.\ Read\ up\ on\ \[bindtags\].\ One\ solution\ is\ to\ add\ \"\;break\"\ to\ each\ binding\ to\ prevent\ the\ class\ bindings\ from\ firing:''\n\n\ \ bind\ \$theText\ <<Paste>>\ \{tk_messageBox\ -message\ \"Paste\ Attempt\"\;\ break\}\n\n''Of\ course,\ you\ can\ also\ just\ set\ the\ -state\ option\ to\ \"disabled\".''\n\n\n\n\n----\n\n'''\[Janic\]\ -\ 2009-07-01\ 09:48:17'''\n***\ Class\ binding,\ do\ they\ work?\ ***\n\n\[Janic\]:\ 2009-07-01T09:48:17:\n***Class\ binding,\ do\ they\ work?***\nI\ tried\ to\ set\ a\ class\ binding\ but\ it\ never\ works.\ For\ example:\n\nHi,\n\n======\ncheckbutton\ .a\ -text\ test\n\ \ \ \ checkbutton\ .a\ -text\ test\n\ \ \ \ pack\ .a\n\ \ \ \ bind\ .a\ <ButtonPress>\ \"break\"\n\nworks\ fine\ (the\ widget\ is\ still\ active\ but\ you\ can't\ check\ it\ anymore),\nbut\ if\ write\n======\nbind\ Checkbutton\ <ButtonPress>\ break\n\ \ \ \ bind\ Checkbutton\ <ButtonPress>\ \"break\"\n\nit\ doesn't\ work.\ \ Did\ I\ miss\ something\ in\ the\ class\ binding\ behavior?\nit\ doesn't\ work.\nDid\ I\ miss\ something\ in\ the\ class\ binding\ behavior?\n\[MG\]:\ Many\ different\ bindings\ are\ checked\ for\ a\ widget,\ based\ on\ its\n\[MG\]\ Many\ different\ bindings\ are\ checked\ for\ a\ widget,\ based\ on\ its\ \[bindtags\].\ The\ default\ order\ for\ a\ widget\ is:\ bindings\ on\ the\ widget\ itself,\ bindings\ on\ its\ class,\ its\ toplevel,\ and\ then\ on\ \"all\".\ Also,\ bindings\ are\ checked\ from\ most\ specific\ match\ to\ least\ specific\ (so\ if\ you\ press\ the\ 'a'\ key,\ it\ checks\ for\ KeyPress-a\ before\ a\ more\ generic\ KeyPress,\ etc).\nThat's\ why\ you're\ seeing\ what\ you\ see\;\ first\ the\ widget's\ own\ bindings\ are\nThat's\ why\ you're\ seeing\ what\ you\ see\;\ first\ the\ widget's\ own\ bindings\ are\ checked,\ and\ the\ generic\ <ButtonPress>\ binding\ matches\ and\ is\ run\;\ the\ \[break\]\ stops\ further\ bindings\ being\ checked.\nWhen\ you\ `bind`\ that\ on\ the\ Checkbutton\ class,\ though,\ the\ default\nWhen\ you\ bind\ that\ on\ the\ Checkbutton\ class,\ though,\ the\ default\ <ButtonPress-1>\ binding\ is\ more\ specific,\ and\ gets\ used\ instead\ of\ your\ <ButtonPress>\ binding.\ (You\ can\ see\ all\ the\ default\ bindings\ with\ \[\[bind\ Checkbutton\]\],\ then\ see\ what\ a\ specific\ one\ does\ with\ \[\[bind\ Checkbutton\ \$binding\]\].)\ So,\ to\ override\ the\ default\ binding,\ you'd\ need\ to\ either\ replace\ the\ Button-1\ binding,\ or\ add\ something\ higher\ up\ the\ \[bindtags\]\ chain.\n\[DKF\]:\ You\ are\ advised\ to\ be\ ''very''\ careful\ with\ changing\ bindings\ of\ widget\n\[DKF\]:\ You\ are\ advised\ to\ be\ ''very''\ careful\ with\ changing\ bindings\ of\ widget\ classes,\ as\ that\ affects\ ''all''\ widgets\ of\ that\ type\ in\ the\ application.\ (It's\ most\ useful\ if\ you're\ adding\ more\ editing\ keys\ to\ the\ \[text\]\ \[widget\],\ or\ are\ making\ your\ own\ megawidget\ class.)\ It's\ far\ better\ to\ adjust\ the\ \[bindtags\]\ for\ the\ specific\ widgets\ in\ question\ as\ the\ results\ are\ a\ lot\ more\ predictable.\ \n----\n!!!!!!\n\[Tk\ syntax\ help\]\ -\[Arts\ and\ Crafts\ of\ Tcl-Tk\ Programming\]\n!!!!!!\n\n!!!!!!\n%|\ \[Category\ Command\]\ |\ \[Category\ Introspection\]\ |\ \[Category\ Characters\]\ |%\n!!!!!! regexp2} CALL {my render bind **Summary**\n**\ Documentation\ **\nbind\ -\ Arrange\ for\ \[X11%|%X%|%\]\ \[event\]s\ to\ invoke\ Tcl\ scripts\n\n\n\ \ \ \ :\ \ \ '''bind'''\ ''tag\ sequence''\n\n\ \ \ \ :\ \ \ '''bind'''\ ''tag\ sequence\ script''\n\n\ \ \ \ :\ \ \ '''bind'''\ ''tag\ sequence\ '''''+'''''script''\n\n\nThe\ ''tag''\ is\ formally\ a\ \[bindtags\]\ tag,\ but\ for\ most\ user\ code\ it\ is\ best\ to\ use\ widget\ names.\ The\ optional\ ''sequence''\ says\ what\ event\ to\ work\ with\;\ if\ omitted,\ '''bind'''\ returns\ what\ bindings\ are\ set\ on\ ''tag''.\ If\ ''script''\ is\ given,\ it\ replaces\ (or\ deletes,\ if\ empty,\ or\ appends,\ if\ it\ starts\ with\ a\ “'''+'''”)\ the\ binding\ script,\ and\ if\ ''script''\ is\ omitted\ (but\ ''sequence''\ is\ given)\ then\ the\ current\ binding\ script\ is\ returned.\n\nManual\ page:\ \[http://www.purl.org/tcl/home/man/tcl8.5/TkCmd/bind.htm%|%bind(n)%|%\]\n**\ Description\ **\nThis\ command\ (part\ of\ \[Tk\])\ is\ used\ to\ associate\ Tcl\ commands\ to\ execute\ upon\ the\ press\ of\ specific\ keys.\nAlso,\ bind\ may\ be\ driven\ by\ other\ events,\ both\ real\ and\ virtual,\ such\ as\ enter,\ leave,\ focus\ in,\ focus\ out,\ etc.\ See\ the\ documentation\ for\ specific\ details.\n`bind`\ (part\ of\ \[Tk\])\ is\ used\ to\ associate\ Tcl\ commands\ to\ execute\ upon\nKeyboard\ symbols\ are\ the\ Tk\ \"strings\"\ associated\ with\ particular\ sequences\ of\ keyboard\ keys\ that\ one\ can\ press,\ such\ as\ Shift,\ or\ A\ or\ special\ function\ keys\ such\ as\ Page\ Up,\ etc.\nSee\ \[http://www.purl.org/tcl/home/man/tcl8.5/TkCmd/keysyms.htm%|%keysyms(n)%|%\]\ for\ the\ keyboard\ symbols\ to\ which\ one\ can\ potentially\ bind\ things.\nOf\ course,\ the\ specific\ keysyms\ available\ to\ you\ on\ any\ particular\ platform/hardware\ depend\ on\ factors\ outside\ of\ Tk's\ control.\n(See\ below\ for\ a\ simple\ script\ for\ determining\ what\ the\ specific\ keysym\ for\ a\ character\ is.)\n''tag''\ is\ formally\ a\ `\[bindtags\]`\ tag,\ but\ for\ most\ user\ code\ it\ is\ best\ to\nSee\ also:\n\ \ \ *\ \[Bindings\ and\ why\ they\ are\ important\]\n\n\ \ \ *\ \[Bindings\ and\ variable\ substitution\]\n\n\ \ \ *\ \[Disable\ autorepeat\ under\ X11\]\n\n\ \ \ *\ \[mousewheel\]\ bindings\n\n\ \ \ *\ \[binding\ to\ a\ single\ mouse\ click\]\n\n\ \ \ *\ \[Key-press\ names\]\ \ \ \n\n----\n**Eggdrop**\nIf\ you\ are\ looking\ for\ the\ \[eggdrop\]\ bind\ command,\ try\ this:\ \[http://www.eggheads.org/support/egghtml/1.6.17/tcl-commands.html#bind\]\n<<discussion>>\n-----\nQuestion:\ Is\ there\ an\ introspective\ method\ that\ a\ Tk\ application\ can\ determine\ whether\ a\ keysym\ is\ currently\ available\ for\ it\ to\ use?\n\n----\n**Using\ Bind\ Effectively**\n***bind\ syntax\ example***\n\[RS\]\ writes\ on\ comp.lang.tcl:\ The\ bind\ syntax\ is\ actually\ very\ easy.\ With\ x\ set\ to\ a\ widget\ (e.g.\n.mytext)\ or\ a\ class\ (e.g.\ Text),\ call\n\n\ \ \ \ \ \ \ \ bind\ \$x\nto\ get\ a\ list\ of\ defined\ bindings.\ This\ list\ contains\ <Key-Prior>\ which\ is\ the\nto\ get\ a\ list\ of\ defined\ bindings.\ This\ list\ contains\ <Key-Prior>\ which\ is\ the\ correct\ name\ for\ the\ Page\ Up\ key.\ To\ see\ what\ it\ is\ bound\ to,\ call\n======\n\ \ \ \ \ \ \ \ bind\ \$x\ <Key-Prior>\nTo\ mirror\ this\ binding\ to\ another\ event,\ make\ that\n\n======\n\ \ \ \ \ \ \ \ bind\ \$x\ <Control-r>\ \[bind\ \$x\ <Key-Prior>\]\nlike\ you\ tried,\ just\ with\ the\ incorrect\ name.\ BTW,\ you\ normally\ need\ not\nlike\ you\ tried,\ just\ with\ the\ incorrect\ name.\ BTW,\ you\ normally\ need\ not\ include\ variable\ names\ in\ braces\ -\ only\ if\ they\ contain\ characters\ other\ than\ A-Z\ a-z\ 0-9\ _.\n\n----\n***keysyms***\n\n\[KBK\]\ -\ You\ can\ find\ the\ keysym\ for\ a\ key\ on\ an\ unfamiliary\ keyboard\ by\ running\ ''wish''\ against\ the\ one-line\ script:\n**\ Finding\ keysyms\ ***\n\ \ \ \ bind\ .\ <KeyPress>\ \{\ puts\ %K\ \}\ \;\ focus\ .\ndirecting\ focus\ at\ the\ (empty)\ ''wish''\ window,\ and\ touching\ the\ key\ in\ndirecting\ focus\ at\ the\ (empty)\ ''wish''\ window,\ and\ touching\ the\ key\ in\ question.\ \ (On\ Windows,\ you'll\ need\ to\ add\n======\n\ \ \ \ console\ show\nto\ the\ script\ so\ that\ you\ can\ see\ its\ output.\nto\ the\ script\ so\ that\ you\ can\ see\ its\ output!)\n\[Arjen\ Markus\]:\ You\ may\ also\ put\ up\ a\ text\ widget\ and\ display\ the\ keysym\ by\ the\n\[Arjen\ Markus\]\ You\ may\ also\ put\ up\ a\ text\ widget\ and\ display\ the\ keysym\ by\ the\ following\ script:\n======\n\ \ \ bind\ .textwidget\ <KeyPress>\ \{\ %W\ insert\ end\ \"%K\\n\"\ \}\n\ \ \ focus\ .textwidget\n\n----\n***ways\ to\ specify\ a\ key\ to\ bind***\n**\ Specifying\ a\ Key\ to\ `bind`\ **\n\[Arjen\ Markus\]\ There\ are\ several\ ways\ to\ define\ a\ specific\ key,\ for\ instance:\n======\n\ \ \ <Key-keysym>\n\ \ \ <KeyPress-keysym>\n\ \ \ <KeyRelease-keysym>\ (subtle\ differences\ here!)\n\ \ \ <keysym>\n\ \ \ <A>\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (if\ the\ character\ is\ plain\ ASCII)\nFor\ a\ space,\ you\ will\ need\ to\ use:\n\n======\n\ \ \ <Key-space>\nanything\ else\ seems\ to\ give\ problems.\n\nAlso\ note\ that\ keysyms\ are\ case-sensitive:\ \"Down\"\ for\ the\ downward\ arrow\ and\nAlso\ note\ that\ keysyms\ are\ case-sensitive:\ \"Down\"\ for\ the\ downward\ arrow\ and\ \"space\"\ for\ a\ space\ (\"down\"\ and\ \"Space\"\ do\ ''not''\ work\;\ quotation\ marks\ for\ convenience\ only)\n\n----\n***bind\ to\ a\ mouse\ action***\n\n\[LV\]\ If\ you\ are\ wanting\ to\ bind\ actions\ to\ a\ mouse\ button\ action,\ rather\nthan\ a\ keyboard\ press,\ then\ you\ appear\ to\ be\ able\ to\ use:\n**\ `bind`\ to\ a\ Mouse\ Action\ **\n\ bind\ \$x\ <ButtonRelease-1>\ \ \{\ puts\ \"Unmodified\ button\"\ \}\n\ bind\ \$x\ <Shift-ButtonRelease-1>\ \{\ puts\ \"Shift\ button\ 1\ release\"\ \}\n\n----\n\[Martin\ Lemburg\]\ July\ 2nd,\ 2002:\n\[Martin\ Lemburg\]\ 2002-07-02:\ Why\ isn't\ there\ an\ event\ ''Invoke''\ for\ invokeable\nI\ have\ a\ question:\nThan\ ...\nWhy\ isn't\ there\ an\ event\ ''Invoke''\ for\ invokeable\ widgets,\ like\ buttons?\ Wouldn't\ make\ it\ sense\ to\ have\ such\ an\ event?\ To\ bind\ widgets\ using\ the\ ''Invoke''\ event,\ like\ to\ connect\ a\ widget\ with\ the\ ''-command''\ option\ to\ an\ event\ handler?\n\n\n======\n\ button\ .b\ -text\ exit\ -command\ \{cmdProc\ .b\ \[clock\ seconds\]\}\;\n...\ would\ be\ equal\ to\ ...\n\n======\n\ bind\ .b\ <Invoke>\ \{cmdProc\ %W\ %t\}\;\nIt\ shouldn't\ be\ a\ problem\ to\ use\ the\ substitution\ capabilities\ during\ the\ usage\ of\ a\ binding,\ like:\n\n======\n\ button\ .b\ -text\ exit\ -command\ \{cmdProc\ %W\ %t\}\;\nWouldn't\ that\ be\ nice\ and\ consequent?\n\nWouldn't\ it\ be\ consequent\ (for\ example)\ to\ use\ bindings\ to\ scrollbars\ or\nWouldn't\ it\ be\ consequent\ (for\ example)\ to\ use\ bindings\ to\ scrollbars\ or\ entries\ too?\ ...\n======\n\ entry\ \ \ \ \ .e\ \ \ -textvariable\ filter\;\n\ button\ \ \ \ .b\ \ \ -text\ \"filter\"\;\n\ listbox\ \ \ .lb\ \ -listvar\ data\ -selectmode\ extended\;\n\ scrollbar\ .sbx\ -orient\ horizontal\;\n\ scrollbar\ .sby\ -orient\ vertical\;\nbind\ .e\ \ \ <Validate>\ \{validateFilter\ %V\ %s\}\;\n\ bind\ .e\ \ \ <Validate>\ \{validateFilter\ %V\ %s\}\;\n\ bind\ .b\ \ \ <Invoke>\ \ \ \{filter\ .e\ .lb\}\;\n\ bind\ .lb\ \ <XScroll>\ \ \{.sbx\ set\}\;\n\ bind\ .lb\ \ <YScroll>\ \ \{.sby\ set\}\;\n\ bind\ .sbx\ <Invoke>\ \ \ \{.lb\ xview\}\;\n\ bind\ .sby\ <Invoke>\ \ \ \{.lb\ yview\}\;\nThere\ would\ be\ the\ chance\ to\ elimate\ all\ (event)handlers\ from\ that\ code,\ that\nThere\ would\ be\ the\ chance\ to\ elimate\ all\ (event)handlers\ from\ that\ code,\ that\ only\ builds\ up\ the\ GUI.\ The\ code\ to\ handle\ events\ could\ use\ now\ use\ bindings.\n\n----\n***caution\ when\ using\ abbreiviated\ binding\ descriptions***\n\n\[Ken\ Jones\]\ writes\ on\ comp.lang.tcl,\ in\ response\ to\ a\ developer\ trying\ to\ bind\ actions\ on\ numeric\ keys\ using\ \n**\ Caution:\ Abbreviated\ `bind`\ Descriptions\ **\n\ bind\ .bu1\ <Alt-2>\ \"focus\ .bu2\"\nWhat\ you're\ experiencing\ is\ one\ of\ those\ traps\ that\ people\ encounter\ when\ they\nthe\ following\ response:\nOn\ the\ other\ hand,\ Tcl\ also\ allows\ you\ to\ abbreviate\ ButtonPress\ events,\ so\ <1>\nWhat\ you're\ experiencing\ is\ one\ of\ those\ traps\ that\ people\ encounter\ when\ they\ use\ abbreviated\ binding\ descriptions.\ For\ many\ KeyPress\ events,\ you\ can\ get\ by\ with\ providing\ only\ the\ keysym.\ So,\ <a>\ is\ equivalent\ to\ <KeyPress-a>,\ and\ <Control-a>\ is\ equivalent\ to\ <Control-KeyPress-a>.\nSolution?\ `bind`\ to\ `<Alt-KeyPress-1>`\ and\ `<Alt-KeyPress-2>`.\ And\ be\ very\ careful\nOn\ the\ other\ hand,\ Tcl\ also\ allows\ you\ to\ abbreviate\ ButtonPress\ events,\ so\ <1>\ is\ equivalent\ to\ <ButtonPress-1>.\ And\ <Alt-1>\ through\ <Alt-5>\ is\ equivalent\ to\ <Alt-ButtonPress-1>\ through\ <Alt-ButtonPress-5>.\n\nSolution?\ Bind\ to\ <Alt-KeyPress-1>\ and\ <Alt-KeyPress-2>.\ And\ be\ very\ careful\ relying\ on\ abbreviated\ event\ descriptions\ in\ bindings.\n\n----\n***binding\ so\ that\ keypad\ keys\ respond***\n**\ Keypad\ Keys\ **\n\[LV\]\ I\ am\ trying\ to\ get\ the\ following\ sample\ program\ to\ display\ the\ numbers\n\n======\npackage\ require\ Tk\n\ #!\ /usr/tcl84/bin/tclsh\nentry\ .e\n\ package\ require\ Tk\nThe\ expectation\ was\ that\ I\ would\ get\ an\ entry\ widget\ into\ which\ I\ could\ press\n\ entry\ .e\n\ bind\ .e\ <KeyPress-1>\ \{\ puts\ 1\ \}\n\ pack\ .e\n\ focus\ .e\n\nThe\ expectation\ was\ that\ I\ would\ get\ an\ entry\ widget\ into\ which\ I\ could\npress\ the\ keys\ on\ the\ keypad\ and\ get,\ in\ this\ case,\ the\ number\ 1\ into\nthe\ entry\ widget.\ \ What\ I\ experience\ is\ that\ after\ I\ mouse\ into\ the\nwidget\ and\ click,\ I\ can\ type\ alphas\ and\ the\ numbers\ on\ top\ row\ of\ the\nmain\ keyboard,\ but\ the\ keypad\ keys\ are\ generating\ nothing...\nPeter\ Newman\ 2004-04-30:\ ''NumLock''\ switches\ the\ keypad\ between\ numbers\ and\nPeter\ Newman\ 30\ April\ 2004:\ ''NumLock''\ switches\ the\ keypad\ between\ numbers\ and\ cursor\ keys.\ I\ presume\ you\ tried\ both\ settings\ -\ and\ still\ no\ joy.\ If\ so,\ then\ it\ would\ appear\ that\ Tk\ doesn't\ support\ the\ keyboard\ properly.\n\nPierre\ Coueffin\ 2004-04-12:\ Try\ `<KeyPress-KP_1>`\nPierre\ Coueffin\ 12\ April\ 2005:\ Try\ <KeyPress-KP_1>\nThomas\ Guettler\ 26\ April\ 2006:\ Or\ Try\ `<KP_End>`\nThomas\ Guettler\ 26\ April\ 2006:\ Or\ Try\ <KP_End>\n\n======\n\n----\nQ.\ Given\ a\ string\ specifying\ an\ event\ sequence,\nhow\ to\ obtain\ some\ sort\ of\ \"normal\ form\"\ for\ that\ event\ sequence,\nso\ that,\ for\ example,\ '1'\ and\ 'Mousebutton-1'\ (or\ whatever\nthe\ long\ form\ is)\ both\ map\ to\ the\ same\ normal\ form\ indicating\na\ single\ click\ of\ mouse\ button\ 1?\nQ.\ Given\ a\ string\ specifying\ an\ event\ sequence,\ how\ to\ obtain\ some\ sort\ of\nA.\ (\[KBK\])\ Hmm,\ bind\ it\ to\ a\ nonexistent\ bindtag\ and\ then\ query\ the\ bindings\n\n======none\n\ %\ bind\ Nothing\ <Button1-ButtonPress-2>\ \{\;\}\n\ %\ bind\ Nothing\n\ <B1-Button-2>\n\n----\n***bindings\ for\ control\ sequences***\n**\ Control\ Sequences\ **\n\[Dossy\]\ 29mar2005:\ I\ just\ spent\ a\ good\ hour\ only\ trying\ to\ understand\ \[\[bind\]\]\ only\ to\ discover\ that\ \[\[bind\ .\ <Control-a>\ \{script\}\]\]\ is\ NOT\ the\ same\ as\ \[\[bind\ .\ <Control-A>\ \{script\}\]\]\ --\ the\ former\ works,\ the\ latter\ doesn't.\n\[RS\]\ would\ expect\ that\ <Control-A>\ is\ equivalent\ to\ <Control-Shift-a>\ ...\ case\ matters,\ doesn't\ it?\n\[Dossy\]\ 2005-03-29:\ I\ just\ spent\ a\ good\ hour\ only\ trying\ to\ understand\ `bind`\n\[MG\]\ The\ bindings\ for\ this,\ after\ a\ little\ playing,\ seem\ slightly\ strange.\ Without\ Caps\ Lock\ on,\ Shift\ and\ the\ 'a'\ key\ (to\ get\ an\ upper-case\ A)\ fires\ the\ binding\ for\ Shift\ and\ (uppercase)\ A.\ The\ only\ way\ to\ fire\ a\ binding\ for\ Shift\ and\ (lowercase)\ a\ that\ I\ can\ find\ is\ to\ turn\ Caps\ Lock\ on,\ and\ -then-\ press\ the\ 'a'\ key\ with\ Shift\ held\ down.\n\[RS\]:\ would\ expect\ that\ `<Control-A>`\ is\ equivalent\ to\ `<Control-Shift-a>`\ ...\ case\nCJL\ The\ minimal\ example\ of\ this\ mildly\ unexpected\ behaviour\ is\ to\ switch\ Caps\ Lock\ on,\ then\ in\ a\ Wish\ console\ (I'm\ talking\ Windoze\ here)\ type\ something,\ highlight\ it\ and\ press\ Ctrl-C.\ Now\ try\ to\ paste\ your\ text\ somewhere\ else\ (e.g.\ Notepad)\ using\ Ctrl-V\ -\ you'll\ discover\ that\ the\ copy\ didn't\ happen,\ but\ even\ though\ Caps\ Lock\ is\ still\ on,\ Notepad\ will\ quite\ happily\ obey\ the\ paste\ request\ (by\ pasting\ whatever\ was\ already\ in\ the\ clipboard).\ To\ me\ 'Ctrl-C'\ means\ \"the\ physical\ key\ labelled\ with\ a\ 'C'\ was\ pressed\ while\ ctrl\ was\ down\",\ and\ should\ have\ nothing\ to\ do\ with\ the\ state\ of\ Caps\ Lock,\ only\ the\ combination\ of\ keys\ pressed.\n\[MG\]:\ The\ bindings\ for\ this,\ after\ a\ little\ playing,\ seem\ slightly\ strange.\n\[WHD\]:\ On\ both\ Windows\ and\ Mac\ OS\ X,\ normal\ apps\ accept\ both\ Control-v\ and\ Control-V\ (Command-v\ and\ Command-V)\ as\ the\ Paste\ key.\ \ For\ Tk,\ it\ appears\ that\ you\ need\ to\ bind\ both.\ \ On\ the\ other\ hand,\ if\ you\ bind\ both\ you'll\ find\ that\ all\ of\ the\ following\ combinations\ will\ paste:\nCJL\ The\ minimal\ example\ of\ this\ mildly\ unexpected\ behaviour\ is\ to\ switch\ Caps\n\ \ \ *\ Control-v\n\ \ \ *\ Control-V\n\ \ \ *\ Shift-Control-v\n\ \ \ *\ Shift-Control-V\nIf\ you\ want\ to\ support\ Shift-Control\ sequences\ in\ your\ keyset,\ you\ need\ to\ bind\nIf\ you\ want\ to\ support\ Shift-Control\ sequences\ in\ your\ keyset,\ you\ need\ to\ bind\ both\ Shift-Control-v\ and\ Shift-Control-V.\ \ Here's\ a\ simple\ solution\ that\ results\ in\ CapsLock-independent\ letter\ key\ bindings:\n\ \ \ \ bind\ \$tag\ <\$modifier-\$upper>\ \$binding\n\ proc\ bindletterkey\ \{tag\ modifier\ letter\ binding\}\ \{\n\ \ \ \ \ set\ upper\ \[string\ toupper\ \$letter\]\n\ \ \ \ \ set\ lower\ \[string\ tolower\ \$letter\]\nbindletterkey\ .text\ Control\ F\ \ \ \ \ \ \ \{puts\ Control-F\}\n\ \ \ \ \ bind\ \$tag\ <\$modifier-\$upper>\ \$binding\n\ \ \ \ \ bind\ \$tag\ <\$modifier-\$lower>\ \$binding\n\ \}\ \n\n\ bindletterkey\ .text\ Control\ F\ \ \ \ \ \ \ \{puts\ \"Control-F\"\}\n\ bindletterkey\ .text\ Shift-Control\ F\ \{puts\ \"Shift-Control-F\"\}\n**\ Case\ Insensitive\ Binding\ **\n\[MG\]\ 2005-06-06:\ \ And,\ where\ the\ bindings\ already\ exist\ (ie,\ for\ the\ Text\n\[MG\]\ adds,\ on\ June\ 6\ 2005\ -\ And,\ where\ the\ bindings\ already\ exist\ (ie,\ for\ the\ Text\ widget)\ and\ you\ want\ to\ make\ them\ case-insensitive,\ something\ like\ this\ will\ help.\n======\n\ proc\ mirror\ \{class\ \{dir\ 1\}\}\ \{\n\ \ if\ \{\ \$dir\ ==\ \"1\"\ \}\ \{\n\ \ \ \ \ \ \ set\ range\ \"a-z\"\n\ \ \ \ \ \ \ set\ case\ \"toupper\"\n\ \ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ \ set\ range\ \"A-Z\"\n\ \ \ \ \ \ \ set\ case\ \"tolower\"\n\ \ \ \ \ \}\n\ \ foreach\ x\ \[bind\ \$class\]\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \ if\ \{\ \[regexp\ \"^<(.+-)?\[\$range\]>\$\"\ \$x\]\ \}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ y\ \[string\ range\ \$x\ end-1\ end-1\]\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ y\ \"\[string\ range\ \$x\ 0\ end-2\]\[string\ \$case\ \$y\]>\"\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ if\ \{\ \[bind\ \$class\ \$y\]\ !=\ \"\"\ \}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ continue\;\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ bind\ \$class\ \$y\ \[bind\ \$class\ \$x\]\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \ \ \ \ bind\ \$class\ \$y\ \[bind\ \$class\ \$x\]\n\ \}\;#\ mirror\nThen\ run,\ for\ instance:\n\n======\n\ \ mirror\ Text\ 1\;\ \ #\ copy\ all\ lower-class\ bindings\ for\ the\ Text\ \ widget\ to\ upper-class\ versions\n\ \ mirror\ Text\ 0\;\ \ #\ copy\ all\ upper-class\ bindings\ for\ the\ Text\ \ widget\ to\ lower-class\ versions\n\ \ mirror\ Entry\ 1\;\ #\ copy\ all\ lower-class\ bindings\ for\ the\ Entry\ widget\ to\ upper-class\ versions\nIt's\ also\ careful\ not\ to\ overwrite\ bindings\ -\ if\ you\ have\ an\ <a>\ and\ an\ <A>\nIt's\ also\ careful\ not\ to\ overwrite\ bindings\ -\ if\ you\ have\ an\ <a>\ and\ an\ <A>\ binding\ for\ the\ Text\ widget,\ and\ run\ ''mirror\ Text\ 1'',\ <A>\ will\ be\ left\ as\ it\ is,\ rather\ than\ being\ overwritten\ with\ <a>'s\ binding.\nThis\ raises\ one\ question\ for\ me,\ though\ -\ what's\ better\ practice?\ Should\ you\nThis\ raises\ one\ question\ for\ me,\ though\ -\ what's\ better\ practice?\ Should\ you\ bind\ to\n\ bind\ Text\ <A>\ \[bind\ Text\ <a>\]\n\n\ bind\ Text\ <A>\ \{event\ generate\ %W\ <a>\}\n\n\n----\n**\ Unbound\ `bind`\ **\n\nSome\ of\ the\ best\ '''bind'''\ coding\ doesn't\ involve\ '''bind'''\ at\ all.\ \ \[DKF\],\ for\ example,\nastutely\ remarked\ that\nSome\ of\ the\ best\ `bind`\ coding\ doesn't\ involve\ '''bind'''\ at\ all.\ \ \[DKF\],\n\ \ \ \ event\ add\ <<Copy>>\ <Control-C>\ntrumps\n\n======\n\ \ \ \ bind\ \$class\ <Control-Key-C>\ \[bind\ \$type\ <<Copy>>\]\n\ \ \ \ bind\ \$class\ <Control-Key-c>\ \[bind\ \$type\ <<Copy>>\]\n\n\n\n----\n***Bind\ to\ a\ plain\ keystroke\ only\ (not\ modified\ by\ Ctrl\ or\ Alt)***\nproc\ bind'plainkey\ \{tag\ key\ script\}\ \{\ \n\ proc\ bind'plainkey\ \{tag\ key\ script\}\ \{\ \n\ \ \ bind\ \$tag\ <Control-\$key>\ \{\ \}\ \n\ \ \ bind\ \$tag\ <Alt-\$key>\ \ \ \ \ \{\ \}\ \n\ \ \ bind\ \$tag\ \$key\ \$script\ \n\ \}\ \n\n\n\ bind'plainkey\ all\ x\ \{puts\ Hello\}\ \n======\n\n\[RUJ\]\nIf\ bind\ leave\ command\ to\ main\ window\ it\ is\ not\ (bindings)\ grabbing\ to\ its\ associated\ widgets.\ e.g.:\ \ \n\[RUJ\]:\ If\ bind\ leave\ command\ to\ main\ window\ it\ is\ not\ (bindings)\ grabbing\ to\n\ toplevel\ \$wa\ -bd\ 1\ -relief\ ridge\ \;\n\ wm\ geometry\ \$wa\ 600x40+\$mousex+\$mousey\ \;\n\ wm\ resizable\ \$wa\ 0\ 0\ \;\n\ wm\ overrideredirect\ \$wa\ yes\ \;\n\ wm\ iconname\ \$wa\ \"menu\"\ \;\n\ wm\ group\ \$wa\ .\ \;\n\ focus\ \$wa\ \;\n\ grab\ set\ \$wa\ \;\n\ \n\ entry\ \$wa.ent01\ \\\n\ \ \ \ \ \ \ \ -width\ 6\ -background\ white\ \nentry\ \$wa.ent01\ -width\ 6\ -background\ white\ \n\ \ \ \ \ \ \ \ \ bind\ \$wa\ <1>\ \[list\ after\ cancel\ destroy\ .base\]\n\ \ \ \ \ \ \ \ \ bind\ \$wa\ <Leave>\ \[list\ destroy\ .base\]\nBut\ it\ is\ destroying\ base\ if\ cursor\ goes\ near\ to\ entry.\nCan\ anybody\ solve\ the\ problem.\n----\n***how\ to\ disable\ pasting***\n\n2008-03-17:\ How\ can\ I\ disable\ pasting\ into\ a\ text\ widget?\ I\ tried\ the\ following:\n2008-03-17:\ How\ can\ I\ disable\ pasting\ into\ a\ text\ widget?\ I\ tried\ the\n\ \ bind\ \$theText\ <<Paste>>\ \{tk_messageBox\ -message\ \"Paste\ Attempt\"\}\n\ \ bind\ \$theText\ <Control-v>\ \{tk_messageBox\ -message\ \"Paste\ Attempt\"\}\n\ \ bind\ \$theText\ <Button-2>\ \{tk_messageBox\ -message\ \"Paste\ Attempt\"\}\n\ \ bind\ \$theText\ <Shift-Insert>\ \{tk_messageBox\ -message\ \"Paste\ Attempt\"\}\nThe\ message\ boxes\ are\ shown,\ so\ the\ event\ handling\ works.\ But\ after\ the\ message\nThe\ message\ boxes\ are\ shown,\ so\ the\ event\ handling\ works.\ But\ after\ the\ message\ box\ has\ been\ clicked\ away,\ the\ pasting\ takes\ place\ anyway\ -\ at\ least\ for\ Shift-Insert.\nAnswer:\ You\ are\ adding\ bindings\ to\ the\ widget\ but\ aren't\ addressing\ the\n''You\ are\ adding\ bindings\ to\ the\ widget\ but\ aren't\ addressing\ the\ bindings\ associated\ with\ the\ widget\ class.\ Read\ up\ on\ \[bindtags\].\ One\ solution\ is\ to\ add\ \"\;break\"\ to\ each\ binding\ to\ prevent\ the\ class\ bindings\ from\ firing:''\n\n\ \ bind\ \$theText\ <<Paste>>\ \{tk_messageBox\ -message\ \"Paste\ Attempt\"\;\ break\}\n\n''Of\ course,\ you\ can\ also\ just\ set\ the\ -state\ option\ to\ \"disabled\".''\n\n\n\n\n----\n\n'''\[Janic\]\ -\ 2009-07-01\ 09:48:17'''\n***\ Class\ binding,\ do\ they\ work?\ ***\n\n\[Janic\]:\ 2009-07-01T09:48:17:\n***Class\ binding,\ do\ they\ work?***\nI\ tried\ to\ set\ a\ class\ binding\ but\ it\ never\ works.\ For\ example:\n\nHi,\n\n======\ncheckbutton\ .a\ -text\ test\n\ \ \ \ checkbutton\ .a\ -text\ test\n\ \ \ \ pack\ .a\n\ \ \ \ bind\ .a\ <ButtonPress>\ \"break\"\n\nworks\ fine\ (the\ widget\ is\ still\ active\ but\ you\ can't\ check\ it\ anymore),\nbut\ if\ write\n======\nbind\ Checkbutton\ <ButtonPress>\ break\n\ \ \ \ bind\ Checkbutton\ <ButtonPress>\ \"break\"\n\nit\ doesn't\ work.\ \ Did\ I\ miss\ something\ in\ the\ class\ binding\ behavior?\nit\ doesn't\ work.\nDid\ I\ miss\ something\ in\ the\ class\ binding\ behavior?\n\[MG\]:\ Many\ different\ bindings\ are\ checked\ for\ a\ widget,\ based\ on\ its\n\[MG\]\ Many\ different\ bindings\ are\ checked\ for\ a\ widget,\ based\ on\ its\ \[bindtags\].\ The\ default\ order\ for\ a\ widget\ is:\ bindings\ on\ the\ widget\ itself,\ bindings\ on\ its\ class,\ its\ toplevel,\ and\ then\ on\ \"all\".\ Also,\ bindings\ are\ checked\ from\ most\ specific\ match\ to\ least\ specific\ (so\ if\ you\ press\ the\ 'a'\ key,\ it\ checks\ for\ KeyPress-a\ before\ a\ more\ generic\ KeyPress,\ etc).\nThat's\ why\ you're\ seeing\ what\ you\ see\;\ first\ the\ widget's\ own\ bindings\ are\nThat's\ why\ you're\ seeing\ what\ you\ see\;\ first\ the\ widget's\ own\ bindings\ are\ checked,\ and\ the\ generic\ <ButtonPress>\ binding\ matches\ and\ is\ run\;\ the\ \[break\]\ stops\ further\ bindings\ being\ checked.\nWhen\ you\ `bind`\ that\ on\ the\ Checkbutton\ class,\ though,\ the\ default\nWhen\ you\ bind\ that\ on\ the\ Checkbutton\ class,\ though,\ the\ default\ <ButtonPress-1>\ binding\ is\ more\ specific,\ and\ gets\ used\ instead\ of\ your\ <ButtonPress>\ binding.\ (You\ can\ see\ all\ the\ default\ bindings\ with\ \[\[bind\ Checkbutton\]\],\ then\ see\ what\ a\ specific\ one\ does\ with\ \[\[bind\ Checkbutton\ \$binding\]\].)\ So,\ to\ override\ the\ default\ binding,\ you'd\ need\ to\ either\ replace\ the\ Button-1\ binding,\ or\ add\ something\ higher\ up\ the\ \[bindtags\]\ chain.\n\[DKF\]:\ You\ are\ advised\ to\ be\ ''very''\ careful\ with\ changing\ bindings\ of\ widget\n\[DKF\]:\ You\ are\ advised\ to\ be\ ''very''\ careful\ with\ changing\ bindings\ of\ widget\ classes,\ as\ that\ affects\ ''all''\ widgets\ of\ that\ type\ in\ the\ application.\ (It's\ most\ useful\ if\ you're\ adding\ more\ editing\ keys\ to\ the\ \[text\]\ \[widget\],\ or\ are\ making\ your\ own\ megawidget\ class.)\ It's\ far\ better\ to\ adjust\ the\ \[bindtags\]\ for\ the\ specific\ widgets\ in\ question\ as\ the\ results\ are\ a\ lot\ more\ predictable.\ \n----\n!!!!!!\n\[Tk\ syntax\ help\]\ -\[Arts\ and\ Crafts\ of\ Tcl-Tk\ Programming\]\n!!!!!!\n\n!!!!!!\n%|\ \[Category\ Command\]\ |\ \[Category\ Introspection\]\ |\ \[Category\ Characters\]\ |%\n!!!!!!} CALL {my revision bind} CALL {::oo::Obj2246258 process revision/bind} CALL {::oo::Obj2246256 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