Error processing request

Parameters

CONTENT_LENGTH0
REQUEST_METHODGET
REQUEST_URI/revision/bind?V=89
QUERY_STRINGV=89
CONTENT_TYPE
DOCUMENT_URI/revision/bind
DOCUMENT_ROOT/var/www/nikit/nikit/nginx/../docroot
SCGI1
SERVER_PROTOCOLHTTP/1.1
HTTPSon
REMOTE_ADDR172.70.126.227
REMOTE_PORT48538
SERVER_PORT4443
SERVER_NAMEwiki.tcl-lang.org
HTTP_HOSTwiki.tcl-lang.org
HTTP_CONNECTIONKeep-Alive
HTTP_ACCEPT_ENCODINGgzip, br
HTTP_X_FORWARDED_FOR3.21.34.0
HTTP_CF_RAY87b07296789f2998-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.21.34.0
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\nKeyboard\ symbols\ are\ the\ Tk\ values\ associated\ with\ particular\ sequences\ of\n\nIf\ you\ are\ looking\ for\ the\ \[eggdrop\]\ `bind`\ command,\ try\ \[http://www.eggheads.org/support/egghtml/1.6.17/tcl-commands.html#bind%|%bind%|%\]\nIf\ you\ are\ looking\ for\ the\ \[eggdrop\]\ bind\ command,\ try\ \[http://www.eggheads.org/support/egghtml/1.6.17/tcl-commands.html#bind%|%bind%|%\]\n\n<<discussion>>\n\n\n**\ Unanswered\ Questions\ **\n\n\n'''Question''':\ Is\ there\ an\ introspective\ method\ that\ a\ Tk\ application\ can\n'''Question''':\ Is\ there\ an\ introspective\ method\ that\ a\ Tk\ application\ can\ determine\ whether\ a\ keysym\ is\ currently\ available\ for\ it\ to\ use?\n\n\ \ \ *\ \[Moving\ Canvas\ Window\ Items\ -\ Can\ someone\ tell\ me\ what's\ going\ on\ here?\]\n**\ Using\ Bind\ Effectively\ **\n\[RS\]\ writes\ on\ comp.lang.tcl:\ The\ `bind`\ syntax\ is\ actually\ very\ easy.\ With\ x\ set\n***\ bind\ syntax\ example\ ***\n======\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\nbind\ \$x\n======\n\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======\nbind\ \$x\ <Key-Prior>\n======\n\nTo\ mirror\ this\ binding\ to\ another\ event,\ make\ that\n\n======\nbind\ \$x\ <Control-r>\ \[bind\ \$x\ <Key-Prior>\]\n======\n\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***\ 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\ ***\nbind\ .\ <KeyPress>\ \{puts\ %K\}\ \;\ focus\ .\nbind\ .\ <KeyPress>\ \{\ puts\ %K\ \}\ \;\ focus\ .\n\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======\nconsole\ show\n======\n\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======\nbind\ .textwidget\ <KeyPress>\ \{\ %W\ insert\ end\ \"%K\\n\"\ \}\nfocus\ .textwidget\n======\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***\ 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\ **\nbind\ \$x\ <ButtonRelease-1>\ \ \{\ puts\ \"Unmodified\ button\"\ \}\nbind\ \$x\ <Shift-ButtonRelease-1>\ \{\ puts\ \"Shift\ button\ 1\ release\"\ \}\n======\n\n\n***\ Idea:\ <Invoke>\ event\ ***\n**\ Idea:\ <Invoke>\ event\ **\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======\nbutton\ .b\ -text\ exit\ -command\ \{cmdProc\ .b\ \[clock\ seconds\]\}\;\n======\n\n...\ would\ be\ equal\ to\ ...\n\n======\nbind\ .b\ <Invoke>\ \{cmdProc\ %W\ %t\}\;\n======\n\nIt\ shouldn't\ be\ a\ problem\ to\ use\ the\ substitution\ capabilities\ during\ the\ usage\ of\ a\ binding,\ like:\n\n======\nbutton\ .b\ -text\ exit\ -command\ \{cmdProc\ %W\ %t\}\;\n======\n\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***\ caution\ when\ using\ abbreviated\ 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\ **\nbind\ .bu1\ <Alt-2>\ \{focus\ .bu2\}\nbind\ .bu1\ <Alt-2>\ \"focus\ .bu2\"\n\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***\ 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======\n#!\ /usr/tcl84/bin/tclsh\n\npackage\ require\ Tk\n\nentry\ .e\nbind\ .e\ <KeyPress-1>\ \{\ puts\ 1\ \}\npack\ .e\nfocus\ .e\n======\n\nThe\ expectation\ was\ that\ I\ would\ get\ an\ entry\ widget\ into\ which\ I\ could\ press\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**\ Canonicalize\ a\ `bind`\ Specification\ **\n***\ Canonicalize\ a\ Bind\ Specification\ ***\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***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:\ni\nproc\ bindletterkey\ \{tag\ modifier\ letter\ binding\}\ \{\n\ \ \ \ set\ upper\ \[string\ toupper\ \$letter\]\n\ \ \ \ set\ lower\ \[string\ tolower\ \$letter\]\n\n\ \ \ \ bind\ \$tag\ <\$modifier-\$upper>\ \$binding\n\ \ \ \ bind\ \$tag\ <\$modifier-\$lower>\ \$binding\n\}\ \n\nbindletterkey\ .text\ Control\ F\ \ \ \ \ \ \ \{puts\ Control-F\}\nbindletterkey\ .text\ Control\ F\ \ \ \ \ \ \ \{puts\ \"Control-F\"\}\nbindletterkey\ .text\ Shift-Control\ F\ \{puts\ \"Shift-Control-F\"\}\n\n\n**\ Case\ Insensitive\ Binding\ **\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======\nproc\ mirror\ \{class\ \{dir\ 1\}\}\ \{\n\ \ \ \ if\ \{\$dir\ eq\ \{1\}\}\ \{\n\ \ \ \ if\ \{\ \$dir\ ==\ \"1\"\ \}\ \{\n\ \ \ \ \ \ \ \ set\ range\ \"a-z\"\n\ \ \ \ \ \ \ \ set\ case\ \"toupper\"\n\ \ \ \ \ \ \ \ set\ range\ A-Z\n\ \ \ \ \ \ \ \ set\ range\ \"A-Z\"\n\ \ \ \ \ \ \ \ set\ case\ \"tolower\"\n\ \ \ \ foreach\ x\ \[bind\ \$class\]\ \{\n\ \ \ \ \ \ \ \ if\ \{\[regexp\ \"^<(.+-)?\\\[\$range\]>\$\"\ \$x\]\}\ \{\n\ \ \ \ \ \ \ \ if\ \{\ \[regexp\ \"^<(.+-)?\[\$range\]>\$\"\ \$x\]\ \}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ set\ y\ \[string\ range\ \$x\ 0\ end-2\]\[string\ \$case\ \$y\]>\n\ \ \ \ \ \ \ \ \ \ \ \ set\ y\ \"\[string\ range\ \$x\ 0\ end-2\]\[string\ \$case\ \$y\]>\"\n\ \ \ \ \ \ \ \ \ \ \ \ if\ \{\ \[bind\ \$class\ \$y\]\ !=\ \"\"\ \}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ continue\;\n\ \ \ \ \ \ \ \ \ \ \ \ bind\ \$class\ \$y\ \[bind\ \$class\ \$x\]\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \}\n\}\;#\ mirror\n======\n\nThen\ run,\ for\ instance:\n\n======\nmirror\ Text\ 1\;\ \ #\ copy\ all\ lower-class\ bindings\ for\ the\ Text\ \ widget\ to\ upper-class\ versions\nmirror\ Text\ 0\;\ \ #\ copy\ all\ upper-class\ bindings\ for\ the\ Text\ \ widget\ to\ lower-class\ versions\nmirror\ Entry\ 1\;\ #\ copy\ all\ lower-class\ bindings\ for\ the\ Entry\ widget\ to\ upper-class\ versions\n======\n\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\nbind\ Text\ <A>\ \[bind\ Text\ <a>\]\n======\n\nand\ copy\ the\ binding,\ or\ use\ something\ like\n\n======\nbind\ Text\ <A>\ \{event\ generate\ %W\ <a>\}\n======\n\nto\ mirror\ <a>'s\ state\ at\ the\ time\ the\ event\ happens?\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\],\nevent\ add\ <<Copy>>\ <Control-C>\n======\n\ntrumps\n\n======\nbind\ \$class\ <Control-Key-C>\ \[bind\ \$type\ <<Copy>>\]\nbind\ \$class\ <Control-Key-c>\ \[bind\ \$type\ <<Copy>>\]\n======\n\n\n\n\n***\ Bind\ to\ a\ plain\ keystroke\ only\ (not\ modified\ by\ Ctrl\ or\ Alt)\ ***\n\nproc\ bind'plainkey\ \{tag\ key\ script\}\ \{\ \n\ \ \ \ bind\ \$tag\ <Control-\$key>\ \{\}\ \n\ \ \ \ bind\ \$tag\ <Control-\$key>\ \{\ \}\ \n\ \ \ \ bind\ \$tag\ <Alt-\$key>\ \ \ \ \ \{\ \}\ \n\}\ \n======\n\nExample:\n\n======\nbind'plainkey\ all\ x\ \{puts\ Hello\}\ \n======\n\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\ntoplevel\ \$wa\ -bd\ 1\ -relief\ ridge\ntoplevel\ \$wa\ -bd\ 1\ -relief\ ridge\ \;\nwm\ geometry\ \$wa\ 600x40+\$mousex+\$mousey\ \;\nwm\ resizable\ \$wa\ 0\ 0\ \;\nwm\ overrideredirect\ \$wa\ yes\ \;\nwm\ iconname\ \$wa\ \"menu\"\ \;\nwm\ group\ \$wa\ .\ \;\nfocus\ \$wa\ \;\ngrab\ set\ \$wa\ \;\nentry\ \$wa.ent01\ -width\ 6\ -background\ white\ \nentry\ \$wa.ent01\ \\\n\ \ \ \ \ \ \ -width\ 6\ -background\ white\ \nbind\ \$wa\ <1>\ \[list\ after\ cancel\ destroy\ .base\]\n\ \ \ \ \ \ \ \ bind\ \$wa\ <1>\ \[list\ after\ cancel\ destroy\ .base\]\n\ \ \ \ \ \ \ \ bind\ \$wa\ <Leave>\ \[list\ destroy\ .base\]\n======\n\nBut\ it\ is\ destroying\ base\ if\ cursor\ goes\ near\ to\ entry.\ \ Can\ anybody\ solve\ the\nBut\ it\ is\ destroying\ base\ if\ cursor\ goes\ near\ to\ entry.\nCan\ anybody\ solve\ the\ problem.\n\n***\ how\ to\ disable\ pasting\ ***\n**\ Disable\ Pasting\ **\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\nbind\ \$theText\ <<Paste>>\ \{tk_messageBox\ -message\ \{Paste\ Attempt\}\}\nbind\ \$theText\ <<Paste>>\ \{tk_messageBox\ -message\ \"Paste\ Attempt\"\}\nbind\ \$theText\ <Control-v>\ \{tk_messageBox\ -message\ \"Paste\ Attempt\"\}\nbind\ \$theText\ <Button-2>\ \{tk_messageBox\ -message\ \"Paste\ Attempt\"\}\nbind\ \$theText\ <Shift-Insert>\ \{tk_messageBox\ -message\ \"Paste\ Attempt\"\}\n\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======\nbind\ \$theText\ <<Paste>>\ \{tk_messageBox\ -message\ \"Paste\ Attempt\"\;\ break\}\n======\n\ \ \nOf\ course,\ you\ can\ also\ just\ set\ the\ -state\ option\ to\ \"disabled\".\n''Of\ course,\ you\ can\ also\ just\ set\ the\ -state\ option\ to\ \"disabled\".''\n\n----\n\n'''\[Janic\]\ -\ 2009-07-01\ 09:48:17'''\n***\ Class\ binding,\ do\ they\ work?\ ***\n\n\n\[Janic\]:\ 2009-07-01T09:48:17:\nI\ tried\ to\ set\ a\ class\ binding\ but\ it\ never\ works.\ For\ example:\nHi,\n\n======\ncheckbutton\ .a\ -text\ test\npack\ .a\nbind\ .a\ <ButtonPress>\ break\nbind\ .a\ <ButtonPress>\ \"break\"\n\nworks\ fine\ (the\ widget\ is\ still\ active\ but\ you\ can't\ check\ it\ anymore),\ but\ if\nworks\ fine\ (the\ widget\ is\ still\ active\ but\ you\ can't\ check\ it\ anymore),\nbut\ if\ write\n======\nbind\ Checkbutton\ <ButtonPress>\ break\nbind\ 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\].\nThe\ default\ order\ for\ a\ widget\ is:\ bindings\ on\ the\ widget\ itself,\ bindings\ on\nits\ class,\ its\ toplevel,\ and\ then\ on\ \"all\".\ Also,\ bindings\ are\ checked\ from\nmost\ specific\ match\ to\ least\ specific\ (so\ if\ you\ press\ the\ 'a'\ key,\ it\ checks\nfor\ KeyPress-a\ before\ a\ more\ generic\ KeyPress,\ etc).\nThat's\ why\ you're\ seeing\ what\ you\ see\;\ first\ the\ widget's\ own\ bindings\ are\nchecked,\ and\ the\ generic\ `<ButtonPress>`\ binding\ matches\ and\ is\ run\;\ `\[break\]`\nchecked,\ and\ the\ generic\ <ButtonPress>\ binding\ matches\ and\ is\ run\;\ the\ \[break\]\n\nWhen\ you\ `bind`\ that\ on\ the\ Checkbutton\ class,\ though,\ the\ default\nWhen\ you\ bind\ that\ on\ the\ Checkbutton\ class,\ though,\ the\ default\n<ButtonPress-1>\ binding\ is\ more\ specific,\ and\ gets\ used\ instead\ of\ your\n<ButtonPress>\ binding.\ (You\ can\ see\ all\ the\ default\ bindings\ with\ \[\[bind\nCheckbutton\]\],\ then\ see\ what\ a\ specific\ one\ does\ with\ \[\[bind\ Checkbutton\n\$binding\]\].)\ So,\ to\ override\ the\ default\ binding,\ you'd\ need\ to\ either\ replace\nthe\ 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\nclasses,\ as\ that\ affects\ ''all''\ widgets\ of\ that\ type\ in\ the\ application.\ (It's\nmost\ useful\ if\ you're\ adding\ more\ editing\ keys\ to\ the\ `\[text\]`\ \[widget\],\ or\ are\nmost\ useful\ if\ you're\ adding\ more\ editing\ keys\ to\ the\ \[text\]\ \[widget\],\ or\ are\nmaking\ your\ own\ megawidget\ class.)\ It's\ far\ better\ to\ adjust\ the\ \[bindtags\]\ for\n\n\[wdb\]:\ Here\ an\ example:\ button\ `.b`\ has\ new\ binding\ tag,\ \ `Button1`\ instead\ of\n\[wdb\]\ \nHere\ an\ example:\ button\ .b\ has\ new\ binding\ tag\ ''Button1''\ instead\ of\n''Button''.\ \ Bindings\ are\ copied\ from\ ''Button''\ to\ ''Button1'',\ then\ binding\nof\ <1>\ is\ modified:\n===\n%\ package\ require\ Tk\n8.5.1\n%\ pack\ \[button\ .b\ -text\ Howdy\]\n%\ #\ button\ appears\n%\ bindtags\ .b\n.b\ Button\ .\ all\n%\ bindtags\ .b\ \{.b\ Button1\ .\ all\}\n%\ bindtags\ .b\ \".b\ Button1\ .\ all\"\n\ \ foreach\ p\ \[bind\ \$old\]\ \{\n\ \ \ \ \ \ bind\ \$new\ \$p\ \[bind\ \$old\ \$p\]\n\ \ \ \ \}\n\}\}\ Button\ Button1\n%\n%\ bind\ Button1\ <1>\ \"+puts\ yep!\"\n%\ #\ now\ clicking\ on\ .b:\n%\ yep!\n\n%\ \n===\n\nFrom\ now\ on,\ you\ can\ change\ arbitrary\ buttons\ without\ side-effects\ to\ \"normal\"\nFrom\ now\ on,\ you\ can\ change\ arbitrary\ buttons\ without\ side-effects\ to\ \"normal\"\ buttons.\n----\n\n***\ \n'''\[telgo\]\ -\ 2010-07-29\ 15:22:47'''\n\[telgo\]\ 2010-07-29\ 15:22:47:\n\n======\nbind\ .\ <Command-f>\ \{\nbind\ .\ <Command-f>\ \{Find\;break\}\n\nI\ also\ have\ a\ menu\ item\ that\ calls\ Find\n\n======\n\$Test\ add\ command\ -label\ Find\ -accel\ Command-F\ -command\ Find\n======\n\n`Find`\ puts\ up\ a\ dialox\ box,\ but\ involves\ some\ sorting.\ However,\ it\nThe\ Find\ procedure\ puts\ up\ a\ dialox\ box,\ but\ involves\ some\ sorting.\ However,\ it\n\n======\nproc\ Find\ \{\}\ \{\n\ \ \ \ global\ body\ dict\ t\n\ \ \ \ \ \ \ \ global\ body\ dict\ t\n\ \ \ \ \ \ \ \ \n\ \ \ \ \ \ \ \ set\ t1\ \[clock\ clicks\ -milliseconds\]\ \ \ \ \ \ \ \ \n\ \ \ \ \ \ \ \ set\ f\ .dictdisplay\n\ \ \ \ \ \ \ \ \n\ \ \ \ \ \ \ \ #see\ if\ we\ want\ to\ restrict\ display\n\ \ \ \ \ \ \ \ set\ target\ \{\}\n\ \ \ \ \ \ \ \ if\ \{\ \[\$t\ tag\ ranges\ sel\]\ ne\ \"\"\ \}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ term\ \[\$t\ get\ sel.first\ sel.last\]\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ target\ \[::soundex::soundex\ \$term\]\n\ \ \ \ \ \ \ \ \}\ \n\ \ \ \ \ \ \ \ \n\ \ \ \ \ \ \ \ if\ \[Dialog_Create\ \$f\ \"Dictionary\"\ -borderwidth\ 10\]\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ text\ \[Scrolled_Text\ \$f.body\ -width\ 20\ -font\ 16\]\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ b\ \[frame\ \$f.buttons\]\n\ \ \ \ \ \ \ \ #---------\ convert\ the\ array\ to\ a\ list\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #---------\ convert\ the\ array\ to\ a\ list\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ foreach\ index\ \[array\ names\ dict\]\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ lappend\ sort\ \"\$index\"\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ sorted\ \[WolofSort\ \$sort\]\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ foreach\ item\ \$sorted\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ if\ \{\$target\ eq\ \{\}\ ||\ \$target\ eq\ \[::soundex::soundex\ \$item\]\ \}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \$text\ insert\ end\ \"\$item\ :\ \$dict(\$item)\\n\"\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}\n\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ pack\ \$f.body\ \ \$f.buttons\ -side\ top\ -fill\ x\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ button\ \$b.ok\ -text\ OK\ -command\ \{set\ dictdisplay(ok)\ 1\}\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ pack\ \$b.ok\ -side\ right\n\ \ \ \ \ \ \ \ set\ sorted\ \[WolofSort\ \$sort\]\n\ \ \ \ \ \ \ \ set\ t2\ \[clock\ clicks\ -milliseconds\]\n\ \ \ \ \ \ \ \ puts\ \"\[expr\ (\$t2-\$t1)/1000.0\]\ seconds\"\n\ \ \ \ \ \ \ \ \n\ \ \ \ \ \ \ \ set\ dictdisplay(ok)\ 0\n\ \ \ \ \ \ \ \ Dialog_Wait\ \$f\ dictdisplay(ok)\ \n\ \ \ \ \ \ \ \ \n\ \ \ \ \ \ \ \ set\ t3\ \[clock\ clicks\ -milliseconds\]\n\ \ \ \ \ \ \ \ puts\ \"\[expr\ (\$t3-\$t2)/1000\]\ seconds\"\n\ \ \ \ \ \ \ \ Dialog_Dismiss\ \$f\n======\n\nIf\ I\ use\ the\ menu\ item,\ everything\ works\ as\ expected.\ If\ I\ use\ Command-f,\ there\nIf\ I\ use\ the\ menu\ item,\ everything\ works\ as\ expected.\ If\ I\ use\ Command-f,\ there\ is\ a\ noticeable\ pause,\ then\ the\ dialog\ appears\ -\ undecorated\ -\ with\ the\ data\ in\ it\ and\ the\ ok\ button,\ but\ never\ returns\ from\ Dialog_Create.\ \[Dialog_Create,\ Dialog_Wait\ and\ Dialog_Dismiss\ are\ taken\ from\ Welch,\ Jones\ and\ Hobbs\ 2003\ \"Practical\ Programming\ in\ Tcl\ and\ Tk\"p\ 606-607\]\nIs\ there\ an\ issue\ with\ putting\ up\ a\ dialog\ box\ from\ within\ a\ key-binding?\n\n<<discussion>>\n**\ See\ also\ **\n\n\ \ \ *\ \[Bindings\ and\ why\ they\ are\ important\]\n\ \ \ *\ \[Bindings\ and\ variable\ substitution\]\n\ \ \ *\ \[Disable\ autorepeat\ under\ X11\]\n\ \ \ *\ \[mousewheel\]\ bindings\n\ \ \ *\ \[binding\ to\ a\ single\ mouse\ click\]\n\ \ \ *\ \[Key-press\ names\]\ \ \ \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\nKeyboard\ symbols\ are\ the\ Tk\ values\ associated\ with\ particular\ sequences\ of\n\nIf\ you\ are\ looking\ for\ the\ \[eggdrop\]\ `bind`\ command,\ try\ \[http://www.eggheads.org/support/egghtml/1.6.17/tcl-commands.html#bind%|%bind%|%\]\nIf\ you\ are\ looking\ for\ the\ \[eggdrop\]\ bind\ command,\ try\ \[http://www.eggheads.org/support/egghtml/1.6.17/tcl-commands.html#bind%|%bind%|%\]\n\n<<discussion>>\n\n\n**\ Unanswered\ Questions\ **\n\n\n'''Question''':\ Is\ there\ an\ introspective\ method\ that\ a\ Tk\ application\ can\n'''Question''':\ Is\ there\ an\ introspective\ method\ that\ a\ Tk\ application\ can\ determine\ whether\ a\ keysym\ is\ currently\ available\ for\ it\ to\ use?\n\n\ \ \ *\ \[Moving\ Canvas\ Window\ Items\ -\ Can\ someone\ tell\ me\ what's\ going\ on\ here?\]\n**\ Using\ Bind\ Effectively\ **\n\[RS\]\ writes\ on\ comp.lang.tcl:\ The\ `bind`\ syntax\ is\ actually\ very\ easy.\ With\ x\ set\n***\ bind\ syntax\ example\ ***\n======\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\nbind\ \$x\n======\n\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======\nbind\ \$x\ <Key-Prior>\n======\n\nTo\ mirror\ this\ binding\ to\ another\ event,\ make\ that\n\n======\nbind\ \$x\ <Control-r>\ \[bind\ \$x\ <Key-Prior>\]\n======\n\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***\ 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\ ***\nbind\ .\ <KeyPress>\ \{puts\ %K\}\ \;\ focus\ .\nbind\ .\ <KeyPress>\ \{\ puts\ %K\ \}\ \;\ focus\ .\n\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======\nconsole\ show\n======\n\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======\nbind\ .textwidget\ <KeyPress>\ \{\ %W\ insert\ end\ \"%K\\n\"\ \}\nfocus\ .textwidget\n======\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***\ 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\ **\nbind\ \$x\ <ButtonRelease-1>\ \ \{\ puts\ \"Unmodified\ button\"\ \}\nbind\ \$x\ <Shift-ButtonRelease-1>\ \{\ puts\ \"Shift\ button\ 1\ release\"\ \}\n======\n\n\n***\ Idea:\ <Invoke>\ event\ ***\n**\ Idea:\ <Invoke>\ event\ **\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======\nbutton\ .b\ -text\ exit\ -command\ \{cmdProc\ .b\ \[clock\ seconds\]\}\;\n======\n\n...\ would\ be\ equal\ to\ ...\n\n======\nbind\ .b\ <Invoke>\ \{cmdProc\ %W\ %t\}\;\n======\n\nIt\ shouldn't\ be\ a\ problem\ to\ use\ the\ substitution\ capabilities\ during\ the\ usage\ of\ a\ binding,\ like:\n\n======\nbutton\ .b\ -text\ exit\ -command\ \{cmdProc\ %W\ %t\}\;\n======\n\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***\ caution\ when\ using\ abbreviated\ 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\ **\nbind\ .bu1\ <Alt-2>\ \{focus\ .bu2\}\nbind\ .bu1\ <Alt-2>\ \"focus\ .bu2\"\n\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***\ 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======\n#!\ /usr/tcl84/bin/tclsh\n\npackage\ require\ Tk\n\nentry\ .e\nbind\ .e\ <KeyPress-1>\ \{\ puts\ 1\ \}\npack\ .e\nfocus\ .e\n======\n\nThe\ expectation\ was\ that\ I\ would\ get\ an\ entry\ widget\ into\ which\ I\ could\ press\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**\ Canonicalize\ a\ `bind`\ Specification\ **\n***\ Canonicalize\ a\ Bind\ Specification\ ***\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***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:\ni\nproc\ bindletterkey\ \{tag\ modifier\ letter\ binding\}\ \{\n\ \ \ \ set\ upper\ \[string\ toupper\ \$letter\]\n\ \ \ \ set\ lower\ \[string\ tolower\ \$letter\]\n\n\ \ \ \ bind\ \$tag\ <\$modifier-\$upper>\ \$binding\n\ \ \ \ bind\ \$tag\ <\$modifier-\$lower>\ \$binding\n\}\ \n\nbindletterkey\ .text\ Control\ F\ \ \ \ \ \ \ \{puts\ Control-F\}\nbindletterkey\ .text\ Control\ F\ \ \ \ \ \ \ \{puts\ \"Control-F\"\}\nbindletterkey\ .text\ Shift-Control\ F\ \{puts\ \"Shift-Control-F\"\}\n\n\n**\ Case\ Insensitive\ Binding\ **\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======\nproc\ mirror\ \{class\ \{dir\ 1\}\}\ \{\n\ \ \ \ if\ \{\$dir\ eq\ \{1\}\}\ \{\n\ \ \ \ if\ \{\ \$dir\ ==\ \"1\"\ \}\ \{\n\ \ \ \ \ \ \ \ set\ range\ \"a-z\"\n\ \ \ \ \ \ \ \ set\ case\ \"toupper\"\n\ \ \ \ \ \ \ \ set\ range\ A-Z\n\ \ \ \ \ \ \ \ set\ range\ \"A-Z\"\n\ \ \ \ \ \ \ \ set\ case\ \"tolower\"\n\ \ \ \ foreach\ x\ \[bind\ \$class\]\ \{\n\ \ \ \ \ \ \ \ if\ \{\[regexp\ \"^<(.+-)?\\\[\$range\]>\$\"\ \$x\]\}\ \{\n\ \ \ \ \ \ \ \ if\ \{\ \[regexp\ \"^<(.+-)?\[\$range\]>\$\"\ \$x\]\ \}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ set\ y\ \[string\ range\ \$x\ 0\ end-2\]\[string\ \$case\ \$y\]>\n\ \ \ \ \ \ \ \ \ \ \ \ set\ y\ \"\[string\ range\ \$x\ 0\ end-2\]\[string\ \$case\ \$y\]>\"\n\ \ \ \ \ \ \ \ \ \ \ \ if\ \{\ \[bind\ \$class\ \$y\]\ !=\ \"\"\ \}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ continue\;\n\ \ \ \ \ \ \ \ \ \ \ \ bind\ \$class\ \$y\ \[bind\ \$class\ \$x\]\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \}\n\}\;#\ mirror\n======\n\nThen\ run,\ for\ instance:\n\n======\nmirror\ Text\ 1\;\ \ #\ copy\ all\ lower-class\ bindings\ for\ the\ Text\ \ widget\ to\ upper-class\ versions\nmirror\ Text\ 0\;\ \ #\ copy\ all\ upper-class\ bindings\ for\ the\ Text\ \ widget\ to\ lower-class\ versions\nmirror\ Entry\ 1\;\ #\ copy\ all\ lower-class\ bindings\ for\ the\ Entry\ widget\ to\ upper-class\ versions\n======\n\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\nbind\ Text\ <A>\ \[bind\ Text\ <a>\]\n======\n\nand\ copy\ the\ binding,\ or\ use\ something\ like\n\n======\nbind\ Text\ <A>\ \{event\ generate\ %W\ <a>\}\n======\n\nto\ mirror\ <a>'s\ state\ at\ the\ time\ the\ event\ happens?\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\],\nevent\ add\ <<Copy>>\ <Control-C>\n======\n\ntrumps\n\n======\nbind\ \$class\ <Control-Key-C>\ \[bind\ \$type\ <<Copy>>\]\nbind\ \$class\ <Control-Key-c>\ \[bind\ \$type\ <<Copy>>\]\n======\n\n\n\n\n***\ Bind\ to\ a\ plain\ keystroke\ only\ (not\ modified\ by\ Ctrl\ or\ Alt)\ ***\n\nproc\ bind'plainkey\ \{tag\ key\ script\}\ \{\ \n\ \ \ \ bind\ \$tag\ <Control-\$key>\ \{\}\ \n\ \ \ \ bind\ \$tag\ <Control-\$key>\ \{\ \}\ \n\ \ \ \ bind\ \$tag\ <Alt-\$key>\ \ \ \ \ \{\ \}\ \n\}\ \n======\n\nExample:\n\n======\nbind'plainkey\ all\ x\ \{puts\ Hello\}\ \n======\n\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\ntoplevel\ \$wa\ -bd\ 1\ -relief\ ridge\ntoplevel\ \$wa\ -bd\ 1\ -relief\ ridge\ \;\nwm\ geometry\ \$wa\ 600x40+\$mousex+\$mousey\ \;\nwm\ resizable\ \$wa\ 0\ 0\ \;\nwm\ overrideredirect\ \$wa\ yes\ \;\nwm\ iconname\ \$wa\ \"menu\"\ \;\nwm\ group\ \$wa\ .\ \;\nfocus\ \$wa\ \;\ngrab\ set\ \$wa\ \;\nentry\ \$wa.ent01\ -width\ 6\ -background\ white\ \nentry\ \$wa.ent01\ \\\n\ \ \ \ \ \ \ -width\ 6\ -background\ white\ \nbind\ \$wa\ <1>\ \[list\ after\ cancel\ destroy\ .base\]\n\ \ \ \ \ \ \ \ bind\ \$wa\ <1>\ \[list\ after\ cancel\ destroy\ .base\]\n\ \ \ \ \ \ \ \ bind\ \$wa\ <Leave>\ \[list\ destroy\ .base\]\n======\n\nBut\ it\ is\ destroying\ base\ if\ cursor\ goes\ near\ to\ entry.\ \ Can\ anybody\ solve\ the\nBut\ it\ is\ destroying\ base\ if\ cursor\ goes\ near\ to\ entry.\nCan\ anybody\ solve\ the\ problem.\n\n***\ how\ to\ disable\ pasting\ ***\n**\ Disable\ Pasting\ **\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\nbind\ \$theText\ <<Paste>>\ \{tk_messageBox\ -message\ \{Paste\ Attempt\}\}\nbind\ \$theText\ <<Paste>>\ \{tk_messageBox\ -message\ \"Paste\ Attempt\"\}\nbind\ \$theText\ <Control-v>\ \{tk_messageBox\ -message\ \"Paste\ Attempt\"\}\nbind\ \$theText\ <Button-2>\ \{tk_messageBox\ -message\ \"Paste\ Attempt\"\}\nbind\ \$theText\ <Shift-Insert>\ \{tk_messageBox\ -message\ \"Paste\ Attempt\"\}\n\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======\nbind\ \$theText\ <<Paste>>\ \{tk_messageBox\ -message\ \"Paste\ Attempt\"\;\ break\}\n======\n\ \ \nOf\ course,\ you\ can\ also\ just\ set\ the\ -state\ option\ to\ \"disabled\".\n''Of\ course,\ you\ can\ also\ just\ set\ the\ -state\ option\ to\ \"disabled\".''\n\n----\n\n'''\[Janic\]\ -\ 2009-07-01\ 09:48:17'''\n***\ Class\ binding,\ do\ they\ work?\ ***\n\n\n\[Janic\]:\ 2009-07-01T09:48:17:\nI\ tried\ to\ set\ a\ class\ binding\ but\ it\ never\ works.\ For\ example:\nHi,\n\n======\ncheckbutton\ .a\ -text\ test\npack\ .a\nbind\ .a\ <ButtonPress>\ break\nbind\ .a\ <ButtonPress>\ \"break\"\n\nworks\ fine\ (the\ widget\ is\ still\ active\ but\ you\ can't\ check\ it\ anymore),\ but\ if\nworks\ fine\ (the\ widget\ is\ still\ active\ but\ you\ can't\ check\ it\ anymore),\nbut\ if\ write\n======\nbind\ Checkbutton\ <ButtonPress>\ break\nbind\ 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\].\nThe\ default\ order\ for\ a\ widget\ is:\ bindings\ on\ the\ widget\ itself,\ bindings\ on\nits\ class,\ its\ toplevel,\ and\ then\ on\ \"all\".\ Also,\ bindings\ are\ checked\ from\nmost\ specific\ match\ to\ least\ specific\ (so\ if\ you\ press\ the\ 'a'\ key,\ it\ checks\nfor\ KeyPress-a\ before\ a\ more\ generic\ KeyPress,\ etc).\nThat's\ why\ you're\ seeing\ what\ you\ see\;\ first\ the\ widget's\ own\ bindings\ are\nchecked,\ and\ the\ generic\ `<ButtonPress>`\ binding\ matches\ and\ is\ run\;\ `\[break\]`\nchecked,\ and\ the\ generic\ <ButtonPress>\ binding\ matches\ and\ is\ run\;\ the\ \[break\]\n\nWhen\ you\ `bind`\ that\ on\ the\ Checkbutton\ class,\ though,\ the\ default\nWhen\ you\ bind\ that\ on\ the\ Checkbutton\ class,\ though,\ the\ default\n<ButtonPress-1>\ binding\ is\ more\ specific,\ and\ gets\ used\ instead\ of\ your\n<ButtonPress>\ binding.\ (You\ can\ see\ all\ the\ default\ bindings\ with\ \[\[bind\nCheckbutton\]\],\ then\ see\ what\ a\ specific\ one\ does\ with\ \[\[bind\ Checkbutton\n\$binding\]\].)\ So,\ to\ override\ the\ default\ binding,\ you'd\ need\ to\ either\ replace\nthe\ 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\nclasses,\ as\ that\ affects\ ''all''\ widgets\ of\ that\ type\ in\ the\ application.\ (It's\nmost\ useful\ if\ you're\ adding\ more\ editing\ keys\ to\ the\ `\[text\]`\ \[widget\],\ or\ are\nmost\ useful\ if\ you're\ adding\ more\ editing\ keys\ to\ the\ \[text\]\ \[widget\],\ or\ are\nmaking\ your\ own\ megawidget\ class.)\ It's\ far\ better\ to\ adjust\ the\ \[bindtags\]\ for\n\n\[wdb\]:\ Here\ an\ example:\ button\ `.b`\ has\ new\ binding\ tag,\ \ `Button1`\ instead\ of\n\[wdb\]\ \nHere\ an\ example:\ button\ .b\ has\ new\ binding\ tag\ ''Button1''\ instead\ of\n''Button''.\ \ Bindings\ are\ copied\ from\ ''Button''\ to\ ''Button1'',\ then\ binding\nof\ <1>\ is\ modified:\n===\n%\ package\ require\ Tk\n8.5.1\n%\ pack\ \[button\ .b\ -text\ Howdy\]\n%\ #\ button\ appears\n%\ bindtags\ .b\n.b\ Button\ .\ all\n%\ bindtags\ .b\ \{.b\ Button1\ .\ all\}\n%\ bindtags\ .b\ \".b\ Button1\ .\ all\"\n\ \ foreach\ p\ \[bind\ \$old\]\ \{\n\ \ \ \ \ \ bind\ \$new\ \$p\ \[bind\ \$old\ \$p\]\n\ \ \ \ \}\n\}\}\ Button\ Button1\n%\n%\ bind\ Button1\ <1>\ \"+puts\ yep!\"\n%\ #\ now\ clicking\ on\ .b:\n%\ yep!\n\n%\ \n===\n\nFrom\ now\ on,\ you\ can\ change\ arbitrary\ buttons\ without\ side-effects\ to\ \"normal\"\nFrom\ now\ on,\ you\ can\ change\ arbitrary\ buttons\ without\ side-effects\ to\ \"normal\"\ buttons.\n----\n\n***\ \n'''\[telgo\]\ -\ 2010-07-29\ 15:22:47'''\n\[telgo\]\ 2010-07-29\ 15:22:47:\n\n======\nbind\ .\ <Command-f>\ \{\nbind\ .\ <Command-f>\ \{Find\;break\}\n\nI\ also\ have\ a\ menu\ item\ that\ calls\ Find\n\n======\n\$Test\ add\ command\ -label\ Find\ -accel\ Command-F\ -command\ Find\n======\n\n`Find`\ puts\ up\ a\ dialox\ box,\ but\ involves\ some\ sorting.\ However,\ it\nThe\ Find\ procedure\ puts\ up\ a\ dialox\ box,\ but\ involves\ some\ sorting.\ However,\ it\n\n======\nproc\ Find\ \{\}\ \{\n\ \ \ \ global\ body\ dict\ t\n\ \ \ \ \ \ \ \ global\ body\ dict\ t\n\ \ \ \ \ \ \ \ \n\ \ \ \ \ \ \ \ set\ t1\ \[clock\ clicks\ -milliseconds\]\ \ \ \ \ \ \ \ \n\ \ \ \ \ \ \ \ set\ f\ .dictdisplay\n\ \ \ \ \ \ \ \ \n\ \ \ \ \ \ \ \ #see\ if\ we\ want\ to\ restrict\ display\n\ \ \ \ \ \ \ \ set\ target\ \{\}\n\ \ \ \ \ \ \ \ if\ \{\ \[\$t\ tag\ ranges\ sel\]\ ne\ \"\"\ \}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ term\ \[\$t\ get\ sel.first\ sel.last\]\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ target\ \[::soundex::soundex\ \$term\]\n\ \ \ \ \ \ \ \ \}\ \n\ \ \ \ \ \ \ \ \n\ \ \ \ \ \ \ \ if\ \[Dialog_Create\ \$f\ \"Dictionary\"\ -borderwidth\ 10\]\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ text\ \[Scrolled_Text\ \$f.body\ -width\ 20\ -font\ 16\]\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ b\ \[frame\ \$f.buttons\]\n\ \ \ \ \ \ \ \ #---------\ convert\ the\ array\ to\ a\ list\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #---------\ convert\ the\ array\ to\ a\ list\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ foreach\ index\ \[array\ names\ dict\]\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ lappend\ sort\ \"\$index\"\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ sorted\ \[WolofSort\ \$sort\]\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ foreach\ item\ \$sorted\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ if\ \{\$target\ eq\ \{\}\ ||\ \$target\ eq\ \[::soundex::soundex\ \$item\]\ \}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \$text\ insert\ end\ \"\$item\ :\ \$dict(\$item)\\n\"\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}\n\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ pack\ \$f.body\ \ \$f.buttons\ -side\ top\ -fill\ x\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ button\ \$b.ok\ -text\ OK\ -command\ \{set\ dictdisplay(ok)\ 1\}\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ pack\ \$b.ok\ -side\ right\n\ \ \ \ \ \ \ \ set\ sorted\ \[WolofSort\ \$sort\]\n\ \ \ \ \ \ \ \ set\ t2\ \[clock\ clicks\ -milliseconds\]\n\ \ \ \ \ \ \ \ puts\ \"\[expr\ (\$t2-\$t1)/1000.0\]\ seconds\"\n\ \ \ \ \ \ \ \ \n\ \ \ \ \ \ \ \ set\ dictdisplay(ok)\ 0\n\ \ \ \ \ \ \ \ Dialog_Wait\ \$f\ dictdisplay(ok)\ \n\ \ \ \ \ \ \ \ \n\ \ \ \ \ \ \ \ set\ t3\ \[clock\ clicks\ -milliseconds\]\n\ \ \ \ \ \ \ \ puts\ \"\[expr\ (\$t3-\$t2)/1000\]\ seconds\"\n\ \ \ \ \ \ \ \ Dialog_Dismiss\ \$f\n======\n\nIf\ I\ use\ the\ menu\ item,\ everything\ works\ as\ expected.\ If\ I\ use\ Command-f,\ there\nIf\ I\ use\ the\ menu\ item,\ everything\ works\ as\ expected.\ If\ I\ use\ Command-f,\ there\ is\ a\ noticeable\ pause,\ then\ the\ dialog\ appears\ -\ undecorated\ -\ with\ the\ data\ in\ it\ and\ the\ ok\ button,\ but\ never\ returns\ from\ Dialog_Create.\ \[Dialog_Create,\ Dialog_Wait\ and\ Dialog_Dismiss\ are\ taken\ from\ Welch,\ Jones\ and\ Hobbs\ 2003\ \"Practical\ Programming\ in\ Tcl\ and\ Tk\"p\ 606-607\]\nIs\ there\ an\ issue\ with\ putting\ up\ a\ dialog\ box\ from\ within\ a\ key-binding?\n\n<<discussion>>\n**\ See\ also\ **\n\n\ \ \ *\ \[Bindings\ and\ why\ they\ are\ important\]\n\ \ \ *\ \[Bindings\ and\ variable\ substitution\]\n\ \ \ *\ \[Disable\ autorepeat\ under\ X11\]\n\ \ \ *\ \[mousewheel\]\ bindings\n\ \ \ *\ \[binding\ to\ a\ single\ mouse\ click\]\n\ \ \ *\ \[Key-press\ names\]\ \ \ \n} CALL {my revision bind} CALL {::oo::Obj2314228 process revision/bind} CALL {::oo::Obj2314226 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