home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / lisp / stk-3.002 / stk-3 / STk-3.1 / Doc / Reference / Appendix-A.tex next >
LaTeX Document  |  1996-01-21  |  7.6 KB

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: LaTeX Document (document/latex).

You can browse this item here: Appendix-A.tex

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert LaTeX Document (document/latex) magic Supported
1% dexvert Corel 10 Texture (image/corel10Texture) ext Unsupported
1% dexvert Croteam texture file (image/croteamTextureFile) ext Unsupported
1% dexvert Text File (text/txt) fallback Supported
100% file LaTeX document text default
99% file LaTeX document, ASCII text default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/281 LaTeX (Subdocument) default
100% detectItEasy Format: plain text[LF] default (weak)
100% xdgMime text/x-matlab default (weak)



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 25 0a 25 20 53 54 6b 20 | 52 65 66 65 72 65 6e 63 |%.% STk |Referenc|
|00000010| 65 20 6d 61 6e 75 61 6c | 20 28 41 70 70 65 6e 64 |e manual| (Append|
|00000020| 69 78 3a 20 55 73 69 6e | 67 20 74 68 65 20 54 6b |ix: Usin|g the Tk|
|00000030| 20 74 6f 6f 6c 6b 69 74 | 29 0a 25 0a 25 20 20 20 | toolkit|).%.% |
|00000040| 20 20 20 20 20 20 20 20 | 41 75 74 68 6f 72 3a 20 | |Author: |
|00000050| 45 72 69 63 6b 20 47 61 | 6c 6c 65 73 69 6f 20 5b |Erick Ga|llesio [|
|00000060| 65 67 40 75 6e 69 63 65 | 2e 66 72 5d 0a 25 20 20 |eg@unice|.fr].% |
|00000070| 20 20 43 72 65 61 74 69 | 6f 6e 20 64 61 74 65 3a | Creati|on date:|
|00000080| 20 3f 3f 2d 4e 6f 76 2d | 31 39 39 33 20 3f 3f 3a | ??-Nov-|1993 ??:|
|00000090| 3f 3f 0a 25 20 4c 61 73 | 74 20 66 69 6c 65 20 75 |??.% Las|t file u|
|000000a0| 70 64 61 74 65 3a 20 32 | 31 2d 4a 61 6e 2d 31 39 |pdate: 2|1-Jan-19|
|000000b0| 39 36 20 31 38 3a 32 39 | 0a 25 0a 0a 57 68 65 6e |96 18:29|.%..When|
|000000c0| 20 7b 5c 73 74 6b 7d 20 | 64 65 74 65 63 74 73 20 | {\stk} |detects |
|000000d0| 74 68 61 74 20 61 20 5c | 76 61 72 7b 74 6b 2d 63 |that a \|var{tk-c|
|000000e0| 6f 6d 6d 61 6e 64 7d 20 | 6d 75 73 74 20 62 65 20 |ommand} |must be |
|000000f0| 63 61 6c 6c 65 64 2c 20 | 70 61 72 61 6d 65 74 65 |called, |paramete|
|00000100| 72 73 20 61 72 65 0a 70 | 72 6f 63 65 73 73 65 64 |rs are.p|rocessed|
|00000110| 20 74 6f 20 62 65 20 72 | 65 63 6f 67 6e 69 7a 65 | to be r|ecognize|
|00000120| 64 20 62 79 20 74 68 65 | 20 63 6f 72 72 65 73 70 |d by the| corresp|
|00000130| 6f 6e 64 69 6e 67 20 74 | 6f 6f 6c 6b 69 74 20 66 |onding t|oolkit f|
|00000140| 75 6e 63 74 69 6f 6e 2e | 20 53 69 6e 63 65 20 74 |unction.| Since t|
|00000150| 68 65 20 54 6b 0a 74 6f | 6f 6c 6b 69 74 20 69 73 |he Tk.to|olkit is|
|00000160| 20 6c 65 66 74 20 28 6d | 6f 73 74 6c 79 29 20 75 | left (m|ostly) u|
|00000170| 6e 6d 6f 64 69 66 69 65 | 64 2c 20 61 6c 6c 20 69 |nmodifie|d, all i|
|00000180| 74 73 20 70 72 69 6d 69 | 74 69 76 65 73 20 60 60 |ts primi|tives ``|
|00000190| 74 68 69 6e 6b 27 27 20 | 74 68 65 72 65 20 69 73 |think'' |there is|
|000001a0| 20 61 0a 72 75 6e 6e 69 | 6e 67 20 54 63 6c 20 69 | a.runni|ng Tcl i|
|000001b0| 6e 74 65 72 70 72 65 74 | 65 72 20 62 65 68 69 6e |nterpret|er behin|
|000001c0| 64 20 74 68 65 20 73 63 | 65 6e 65 2e 20 43 6f 6e |d the sc|ene. Con|
|000001d0| 73 65 71 75 65 6e 74 6c | 79 2c 20 74 6f 20 77 6f |sequentl|y, to wo|
|000001e0| 72 6b 20 77 69 74 68 20 | 74 68 65 20 54 6b 0a 74 |rk with |the Tk.t|
|000001f0| 6f 6f 6c 6b 69 74 2c 20 | 61 20 6c 69 74 74 6c 65 |oolkit, |a little|
|00000200| 20 73 65 74 20 6f 66 20 | 72 65 77 72 69 74 69 6e | set of |rewritin|
|00000210| 67 20 72 75 6c 65 73 20 | 6d 75 73 74 20 62 65 20 |g rules |must be |
|00000220| 6b 6e 6f 77 6e 2e 20 54 | 68 65 73 65 20 72 75 6c |known. T|hese rul|
|00000230| 65 73 20 61 72 65 0a 64 | 65 73 63 72 69 62 65 64 |es are.d|escribed|
|00000240| 20 68 65 72 65 61 66 74 | 65 72 2e 0a 0a 5c 62 65 | hereaft|er...\be|
|00000250| 67 69 6e 7b 6e 6f 74 65 | 7d 0a 54 68 69 73 20 61 |gin{note|}.This a|
|00000260| 70 70 65 6e 64 69 78 20 | 69 73 20 70 6c 61 63 65 |ppendix |is place|
|00000270| 64 20 68 65 72 65 20 74 | 6f 20 70 65 72 6d 69 74 |d here t|o permit|
|00000280| 20 61 6e 20 7b 5c 73 74 | 6b 7d 20 75 73 65 72 20 | an {\st|k} user |
|00000290| 74 6f 20 6d 61 6b 65 20 | 70 72 6f 67 72 61 6d 73 |to make |programs|
|000002a0| 20 77 69 74 68 0a 74 68 | 65 20 6f 72 69 67 69 6e | with.th|e origin|
|000002b0| 61 6c 20 54 63 6c 2f 54 | 6b 20 64 6f 63 75 6d 65 |al Tcl/T|k docume|
|000002c0| 6e 74 61 74 69 6f 6e 20 | 62 79 20 68 61 6e 64 2e |ntation |by hand.|
|000002d0| 20 49 6e 20 6e 6f 20 63 | 61 73 65 20 77 69 6c 6c | In no c|ase will|
|000002e0| 20 69 74 20 73 75 62 73 | 74 69 74 75 74 65 20 74 | it subs|titute t|
|000002f0| 6f 0a 74 68 65 20 61 62 | 75 6e 64 61 6e 74 20 54 |o.the ab|undant T|
|00000300| 63 6c 2f 54 6b 20 6d 61 | 6e 75 61 6c 20 70 61 67 |cl/Tk ma|nual pag|
|00000310| 65 73 20 6e 6f 72 20 74 | 6f 20 74 68 65 20 65 78 |es nor t|o the ex|
|00000320| 63 65 6c 6c 65 6e 74 20 | 62 6f 6f 6b 20 62 79 0a |cellent |book by.|
|00000330| 4a 2e 7e 4f 75 73 74 65 | 72 68 6f 75 74 5c 63 69 |J.~Ouste|rhout\ci|
|00000340| 74 65 7b 4f 75 73 74 65 | 72 2d 62 6f 6f 6b 7d 0a |te{Ouste|r-book}.|
|00000350| 5c 65 6e 64 7b 6e 6f 74 | 65 7d 0a 0a 5c 73 65 63 |\end{not|e}..\sec|
|00000360| 74 69 6f 6e 7b 43 61 6c | 6c 69 6e 67 20 61 20 54 |tion{Cal|ling a T|
|00000370| 6b 2d 63 6f 6d 6d 61 6e | 64 7d 0a 0a 53 69 6e 63 |k-comman|d}..Sinc|
|00000380| 65 20 54 63 6c 20 75 73 | 65 73 20 73 74 72 69 6e |e Tcl us|es strin|
|00000390| 67 73 20 74 6f 20 63 6f | 6d 6d 75 6e 69 63 61 74 |gs to co|mmunicat|
|000003a0| 65 20 77 69 74 68 20 74 | 68 65 20 54 6b 20 74 6f |e with t|he Tk to|
|000003b0| 6f 6c 6b 69 74 2c 20 70 | 61 72 61 6d 65 74 65 72 |olkit, p|arameter|
|000003c0| 73 20 74 6f 20 61 0a 5c | 76 61 72 7b 54 6b 2d 63 |s to a.\|var{Tk-c|
|000003d0| 6f 6d 6d 61 6e 64 7d 20 | 6d 75 73 74 20 62 65 20 |ommand} |must be |
|000003e0| 74 72 61 6e 73 6c 61 74 | 65 64 20 74 6f 20 73 74 |translat|ed to st|
|000003f0| 72 69 6e 67 73 20 62 65 | 66 6f 72 65 20 63 61 6c |rings be|fore cal|
|00000400| 6c 69 6e 67 20 74 68 65 | 20 43 20 66 75 6e 63 74 |ling the| C funct|
|00000410| 69 6f 6e 0a 77 68 69 63 | 68 20 69 6d 70 6c 65 6d |ion.whic|h implem|
|00000420| 65 6e 74 20 69 74 2e 20 | 54 68 65 20 66 6f 6c 6c |ent it. |The foll|
|00000430| 6f 77 69 6e 67 20 63 6f | 6e 76 65 72 73 69 6f 6e |owing co|nversion|
|00000440| 73 20 61 72 65 20 64 6f | 6e 65 2c 20 64 65 70 65 |s are do|ne, depe|
|00000450| 6e 64 69 6e 67 20 6f 6e | 20 74 68 65 20 74 79 70 |nding on| the typ|
|00000460| 65 0a 6f 66 20 74 68 65 | 20 70 61 72 61 6d 65 74 |e.of the| paramet|
|00000470| 65 72 20 74 68 61 74 20 | 7b 5c 73 74 6b 7d 20 6d |er that |{\stk} m|
|00000480| 75 73 74 20 67 69 76 65 | 20 74 6f 20 74 68 65 20 |ust give| to the |
|00000490| 74 6f 6f 6c 6b 69 74 3a | 0a 5c 62 65 67 69 6e 7b |toolkit:|.\begin{|
|000004a0| 71 75 6f 74 65 7d 0a 5c | 62 65 67 69 6e 7b 64 65 |quote}.\|begin{de|
|000004b0| 73 63 72 69 70 74 69 6f | 6e 7d 0a 5c 69 74 65 6d |scriptio|n}.\item|
|000004c0| 5b 73 79 6d 62 6f 6c 3a | 5d 20 74 68 65 20 70 72 |[symbol:|] the pr|
|000004d0| 69 6e 74 20 6e 61 6d 65 | 20 6f 66 20 74 68 65 20 |int name| of the |
|000004e0| 73 79 6d 62 6f 6c 3b 0a | 5c 69 74 65 6d 5b 6e 75 |symbol;.|\item[nu|
|000004f0| 6d 62 65 72 3a 5d 20 74 | 68 65 20 65 78 74 65 72 |mber:] t|he exter|
|00000500| 6e 61 6c 20 72 65 70 72 | 65 73 65 6e 74 61 74 69 |nal repr|esentati|
|00000510| 6f 6e 20 6f 66 20 74 68 | 65 20 6e 75 6d 62 65 72 |on of th|e number|
|00000520| 20 65 78 70 72 65 73 73 | 65 64 20 69 6e 20 72 61 | express|ed in ra|
|00000530| 64 69 78 20 31 30 3b 0a | 5c 69 74 65 6d 5b 73 74 |dix 10;.|\item[st|
|00000540| 72 69 6e 67 3a 5d 20 6e | 6f 20 63 6f 6e 76 65 72 |ring:] n|o conver|
|00000550| 73 69 6f 6e 3b 0a 5c 69 | 74 65 6d 5b 6b 65 79 77 |sion;.\i|tem[keyw|
|00000560| 6f 72 64 3a 5d 20 74 68 | 65 20 70 72 69 6e 74 20 |ord:] th|e print |
|00000570| 6e 61 6d 65 20 6f 66 20 | 74 68 65 20 6b 65 79 77 |name of |the keyw|
|00000580| 6f 72 64 20 77 68 65 72 | 65 20 74 68 65 20 69 6e |ord wher|e the in|
|00000590| 69 74 69 61 6c 20 73 65 | 6d 69 63 6f 6c 6f 6e 20 |itial se|micolon |
|000005a0| 68 61 73 0a 62 65 65 6e | 20 72 65 70 6c 61 63 65 |has.been| replace|
|000005b0| 64 20 62 79 20 61 20 64 | 61 73 68 20 28 60 60 2d |d by a d|ash (``-|
|000005c0| 27 27 29 3b 0a 5c 69 74 | 65 6d 5b 62 6f 6f 6c 65 |'');.\it|em[boole|
|000005d0| 61 6e 3a 5d 20 74 68 65 | 20 73 74 72 69 6e 67 20 |an:] the| string |
|000005e0| 22 30 22 20 69 66 20 7b | 5c 73 63 68 66 61 6c 73 |"0" if {|\schfals|
|000005f0| 65 7d 20 61 6e 64 20 22 | 31 22 20 69 66 20 5c 73 |e} and "|1" if \s|
|00000600| 63 68 74 72 75 65 0a 5c | 69 74 65 6d 5b 74 6b 2d |chtrue.\|item[tk-|
|00000610| 63 6f 6d 6d 61 6e 64 3a | 5d 20 74 68 65 20 6e 61 |command:|] the na|
|00000620| 6d 65 20 6f 66 20 74 68 | 65 20 5c 76 61 72 7b 74 |me of th|e \var{t|
|00000630| 6b 2d 63 6f 6d 6d 61 6e | 64 7d 0a 5c 69 74 65 6d |k-comman|d}.\item|
|00000640| 5b 63 6c 6f 73 75 72 65 | 3a 5d 20 74 68 65 20 61 |[closure|:] the a|
|00000650| 64 64 72 65 73 73 20 6f | 66 20 74 68 65 20 63 6c |ddress o|f the cl|
|00000660| 6f 73 75 72 65 20 75 73 | 69 6e 67 20 74 68 65 20 |osure us|ing the |
|00000670| 72 65 70 72 65 73 65 6e | 74 61 74 69 6f 6e 0a 20 |represen|tation. |
|00000680| 20 73 68 6f 77 6e 20 69 | 6e 20 5c 72 65 66 7b 61 | shown i|n \ref{a|
|00000690| 64 64 72 65 73 73 65 73 | 7d 2e 0a 5c 69 74 65 6d |ddresses|}..\item|
|000006a0| 5b 6f 74 68 65 72 77 69 | 73 65 3a 5d 20 74 68 65 |[otherwi|se:] the|
|000006b0| 20 65 78 74 65 72 6e 61 | 6c 20 60 60 73 6c 61 73 | externa|l ``slas|
|000006c0| 68 69 66 69 65 64 27 27 | 20 76 65 72 73 69 6f 6e |hified''| version|
|000006d0| 20 6f 66 20 74 68 65 20 | 6f 62 6a 65 63 74 2e 0a | of the |object..|
|000006e0| 5c 65 6e 64 7b 64 65 73 | 63 72 69 70 74 69 6f 6e |\end{des|cription|
|000006f0| 7d 0a 5c 65 6e 64 7b 71 | 75 6f 74 65 7d 0a 41 73 |}.\end{q|uote}.As|
|00000700| 20 61 6e 20 65 78 61 6d | 70 6c 65 2c 20 6c 65 74 | an exam|ple, let|
|00000710| 20 75 73 20 6d 61 6b 65 | 20 61 20 62 75 74 74 6f | us make| a butto|
|00000720| 6e 20 77 69 74 68 20 61 | 20 6c 61 62 65 6c 20 63 |n with a| label c|
|00000730| 6f 6e 74 61 69 6e 69 6e | 67 20 74 68 65 0a 73 74 |ontainin|g the.st|
|00000740| 72 69 6e 67 20 7b 5c 74 | 74 20 22 48 65 6c 6c 6f |ring {\t|t "Hello|
|00000750| 2c 20 77 6f 72 64 22 7d | 2e 20 41 63 63 6f 72 64 |, word"}|. Accord|
|00000760| 69 6e 67 20 74 68 65 20 | 6f 72 69 67 69 6e 61 6c |ing the |original|
|00000770| 20 54 6b 2f 54 63 6c 20 | 64 6f 63 75 6d 65 6e 74 | Tk/Tcl |document|
|00000780| 61 74 69 6f 6e 2c 0a 74 | 68 69 73 20 63 61 6e 20 |ation,.t|his can |
|00000790| 62 65 20 64 6f 6e 65 20 | 69 6e 20 54 63 6c 20 77 |be done |in Tcl w|
|000007a0| 69 74 68 0a 5c 62 65 67 | 69 6e 7b 73 63 68 65 6d |ith.\beg|in{schem|
|000007b0| 65 7d 0a 62 75 74 74 6f | 6e 20 2e 68 65 6c 6c 6f |e}.butto|n .hello|
|000007c0| 20 2d 74 65 78 74 20 22 | 48 65 6c 6c 6f 2c 20 77 | -text "|Hello, w|
|000007d0| 6f 72 6c 64 22 0a 5c 65 | 6e 64 7b 73 63 68 65 6d |orld".\e|nd{schem|
|000007e0| 65 7d 0a 46 6f 6c 6c 6f | 77 69 6e 67 20 74 68 65 |e}.Follo|wing the|
|000007f0| 20 72 65 77 72 69 74 69 | 6e 67 20 72 75 6c 65 73 | rewriti|ng rules|
|00000800| 20 65 78 70 72 65 73 73 | 65 64 20 61 62 6f 76 65 | express|ed above|
|00000810| 2c 20 74 68 69 73 20 63 | 61 6e 20 62 65 20 64 6f |, this c|an be do|
|00000820| 6e 65 20 69 6e 20 7b 5c | 73 74 6b 7d 20 77 69 74 |ne in {\|stk} wit|
|00000830| 68 0a 5c 62 65 67 69 6e | 7b 73 63 68 65 6d 65 7d |h.\begin|{scheme}|
|00000840| 0a 28 62 75 74 74 6f 6e | 20 27 2e 68 65 6c 6c 6f |.(button| '.hello|
|00000850| 20 27 2d 74 65 78 74 20 | 22 48 65 6c 6c 6f 2c 20 | '-text |"Hello, |
|00000860| 77 6f 72 6c 64 22 29 0a | 5c 65 6e 64 7b 73 63 68 |world").|\end{sch|
|00000870| 65 6d 65 7d 0a 54 68 69 | 73 20 63 61 6c 6c 20 64 |eme}.Thi|s call d|
|00000880| 65 66 69 6e 65 73 20 61 | 20 6e 65 77 20 77 69 64 |efines a| new wid|
|00000890| 67 65 74 20 6f 62 6a 65 | 63 74 20 77 68 69 63 68 |get obje|ct which|
|000008a0| 20 69 73 20 73 74 6f 72 | 65 64 20 69 6e 20 74 68 | is stor|ed in th|
|000008b0| 65 20 7b 5c 73 74 6b 7d | 20 76 61 72 69 61 62 6c |e {\stk}| variabl|
|000008c0| 65 20 7b 5c 74 74 0a 2e | 68 65 6c 6c 6f 7d 2e 20 |e {\tt..|hello}. |
|000008d0| 54 68 69 73 20 6f 62 6a | 65 63 74 20 63 61 6e 20 |This obj|ect can |
|000008e0| 62 65 20 75 73 65 64 20 | 61 73 20 61 20 70 72 6f |be used |as a pro|
|000008f0| 63 65 64 75 72 65 20 74 | 6f 20 63 75 73 74 6f 6d |cedure t|o custom|
|00000900| 69 7a 65 20 6f 75 72 20 | 62 75 74 74 6f 6e 2e 0a |ize our |button..|
|00000910| 46 6f 72 20 69 6e 73 74 | 61 6e 63 65 2c 20 73 65 |For inst|ance, se|
|00000920| 74 74 69 6e 67 20 74 68 | 65 20 62 6f 72 64 65 72 |tting th|e border|
|00000930| 20 6f 66 20 74 68 69 73 | 20 62 75 74 74 6f 6e 20 | of this| button |
|00000940| 74 6f 20 35 20 70 69 78 | 65 6c 73 20 77 69 64 65 |to 5 pix|els wide|
|00000950| 20 61 6e 64 20 69 74 73 | 0a 62 61 63 6b 67 72 6f | and its|.backgro|
|00000960| 75 6e 64 20 74 6f 20 67 | 72 61 79 20 77 6f 75 6c |und to g|ray woul|
|00000970| 64 20 62 65 20 64 6f 6e | 65 20 69 6e 20 54 63 6c |d be don|e in Tcl|
|00000980| 20 77 69 74 68 0a 5c 62 | 65 67 69 6e 7b 73 63 68 | with.\b|egin{sch|
|00000990| 65 6d 65 7d 0a 2e 68 65 | 6c 6c 6f 20 63 6f 6e 66 |eme}..he|llo conf|
|000009a0| 69 67 75 72 65 20 2d 62 | 6f 72 64 65 72 20 35 20 |igure -b|order 5 |
|000009b0| 2d 62 61 63 6b 67 72 6f | 75 6e 64 20 67 72 61 79 |-backgro|und gray|
|000009c0| 0a 5c 65 6e 64 7b 73 63 | 68 65 6d 65 7d 0a 49 6e |.\end{sc|heme}.In|
|000009d0| 20 7b 5c 73 74 6b 7d 20 | 74 68 69 73 20 77 6f 75 | {\stk} |this wou|
|000009e0| 6c 64 20 62 65 20 65 78 | 70 72 65 73 73 65 64 20 |ld be ex|pressed |
|000009f0| 61 73 0a 5c 62 65 67 69 | 6e 7b 73 63 68 65 6d 65 |as.\begi|n{scheme|
|00000a00| 7d 0a 28 2e 68 65 6c 6c | 6f 20 27 63 6f 6e 66 69 |}.(.hell|o 'confi|
|00000a10| 67 75 72 65 20 27 2d 62 | 6f 72 64 65 72 20 35 20 |gure '-b|order 5 |
|00000a20| 27 2d 62 61 63 6b 67 72 | 6f 75 6e 64 20 22 67 72 |'-backgr|ound "gr|
|00000a30| 61 79 22 29 0a 5c 65 6e | 64 7b 73 63 68 65 6d 65 |ay").\en|d{scheme|
|00000a40| 7d 0a 53 69 6e 63 65 20 | 6b 65 79 77 6f 72 64 20 |}.Since |keyword |
|00000a50| 63 6f 6c 6f 6e 20 69 73 | 20 72 65 70 6c 61 63 65 |colon is| replace|
|00000a60| 64 20 62 79 20 61 20 64 | 61 73 68 20 77 68 65 6e |d by a d|ash when|
|00000a70| 20 61 20 5c 69 64 65 7b | 54 6b 2d 63 6f 6d 6d 61 | a \ide{|Tk-comma|
|00000a80| 6e 64 7d 20 69 73 20 63 | 61 6c 6c 65 64 2c 20 74 |nd} is c|alled, t|
|00000a90| 68 69 73 0a 65 78 70 72 | 65 73 73 69 6f 6e 20 63 |his.expr|ession c|
|00000aa0| 6f 75 6c 64 20 61 6c 73 | 6f 20 68 61 76 65 20 62 |ould als|o have b|
|00000ab0| 65 65 6e 20 77 72 69 74 | 74 65 6e 20 61 73 3a 0a |een writ|ten as:.|
|00000ac0| 5c 62 65 67 69 6e 7b 73 | 63 68 65 6d 65 7d 0a 28 |\begin{s|cheme}.(|
|00000ad0| 2e 68 65 6c 6c 6f 20 27 | 63 6f 6e 66 69 67 75 72 |.hello '|configur|
|00000ae0| 65 7b 5c 62 66 20 3a 62 | 6f 72 64 65 72 7d 20 35 |e{\bf :b|order} 5|
|00000af0| 7b 5c 62 66 20 3a 62 61 | 63 6b 67 72 6f 75 6e 64 |{\bf :ba|ckground|
|00000b00| 7d 20 22 67 72 61 79 22 | 29 0a 5c 65 6e 64 7b 73 |} "gray"|).\end{s|
|00000b10| 63 68 65 6d 65 7d 0a 0a | 5c 73 65 63 74 69 6f 6e |cheme}..|\section|
|00000b20| 7b 41 73 73 6f 63 69 61 | 74 69 6e 67 20 43 61 6c |{Associa|ting Cal|
|00000b30| 6c 62 61 63 6b 73 20 74 | 6f 20 54 6b 2d 63 6f 6d |lbacks t|o Tk-com|
|00000b40| 6d 61 6e 64 73 7d 0a 0a | 53 74 61 72 74 69 6e 67 |mands}..|Starting|
|00000b50| 20 77 69 74 68 20 76 65 | 72 73 69 6f 6e 20 33 2e | with ve|rsion 3.|
|00000b60| 30 2c 20 7b 5c 73 74 6b | 7d 20 63 61 6c 6c 62 61 |0, {\stk|} callba|
|00000b70| 63 6b 73 20 61 72 65 20 | 53 63 68 65 6d 65 0a 63 |cks are |Scheme.c|
|00000b80| 6c 6f 73 75 72 65 73 5c | 66 6f 6f 74 6e 6f 74 65 |losures\|footnote|
|00000b90| 7b 4f 6c 64 20 73 79 6e | 74 61 78 20 66 6f 72 20 |{Old syn|tax for |
|00000ba0| 63 61 6c 6c 62 61 63 6b | 73 20 28 69 2e 65 2e 20 |callback|s (i.e. |
|00000bb0| 73 74 72 69 6e 67 73 29 | 20 69 73 20 61 6c 77 61 |strings)| is alwa|
|00000bc0| 79 73 0a 20 20 73 75 70 | 70 6f 72 74 65 64 20 62 |ys. sup|ported b|
|00000bd0| 75 74 20 69 74 73 20 75 | 73 65 20 69 73 20 64 65 |ut its u|se is de|
|00000be0| 70 72 65 63 61 74 65 64 | 2e 7d 2e 20 41 70 61 72 |precated|.}. Apar|
|00000bf0| 74 20 73 63 72 6f 6c 6c | 20 63 6f 6d 6d 61 6e 64 |t scroll| command|
|00000c00| 73 2c 20 63 61 6c 6c 62 | 61 63 6b 73 20 61 72 65 |s, callb|acks are|
|00000c10| 20 0a 53 63 68 65 6d 65 | 73 20 70 72 6f 63 65 64 | .Scheme|s proced|
|00000c20| 75 72 65 73 20 77 69 74 | 68 6f 75 74 20 70 61 72 |ures wit|hout par|
|00000c30| 61 6d 65 74 65 72 2e 20 | 53 75 70 70 6f 73 65 20 |ameter. |Suppose |
|00000c40| 66 6f 72 20 65 78 61 6d | 70 6c 65 2c 20 74 68 61 |for exam|ple, tha|
|00000c50| 74 20 77 65 20 77 61 6e | 74 20 74 6f 0a 61 73 73 |t we wan|t to.ass|
|00000c60| 6f 63 69 61 74 65 20 61 | 20 63 6f 6d 6d 61 6e 64 |ociate a| command|
|00000c70| 20 77 69 74 68 20 74 68 | 65 20 70 72 65 76 69 6f | with th|e previo|
|00000c80| 75 73 20 7b 5c 74 74 20 | 2e 68 65 6c 6c 6f 7d 20 |us {\tt |.hello} |
|00000c90| 62 75 74 74 6f 6e 2e 20 | 49 6e 0a 54 63 6c 2c 20 |button. |In.Tcl, |
|00000ca0| 73 75 63 68 20 61 20 63 | 6f 6d 6d 61 6e 64 20 63 |such a c|ommand c|
|00000cb0| 61 6e 20 62 65 20 65 78 | 70 72 65 73 73 65 64 20 |an be ex|pressed |
|00000cc0| 61 73 0a 5c 62 65 67 69 | 6e 7b 73 63 68 65 6d 65 |as.\begi|n{scheme|
|00000cd0| 7d 0a 2e 68 65 6c 6c 6f | 20 63 6f 6e 66 69 67 75 |}..hello| configu|
|00000ce0| 72 65 20 2d 63 6f 6d 6d | 61 6e 64 20 5c 7b 70 75 |re -comm|and \{pu|
|00000cf0| 74 73 20 73 74 64 6f 75 | 74 20 22 48 65 6c 6c 6f |ts stdou|t "Hello|
|00000d00| 2c 20 77 6f 72 6c 64 22 | 3b 20 64 65 73 74 72 6f |, world"|; destro|
|00000d10| 79 20 2e 5c 7d 0a 5c 65 | 6e 64 7b 73 63 68 65 6d |y .\}.\e|nd{schem|
|00000d20| 65 7d 0a 49 6e 20 7b 5c | 73 74 6b 7d 2c 20 77 65 |e}.In {\|stk}, we|
|00000d30| 20 63 61 6e 20 77 72 69 | 74 65 0a 5c 62 65 67 69 | can wri|te.\begi|
|00000d40| 6e 7b 73 63 68 65 6d 65 | 7d 0a 28 2e 68 65 6c 6c |n{scheme|}.(.hell|
|00000d50| 6f 20 27 63 6f 6e 66 69 | 67 75 72 65 7b 5c 62 66 |o 'confi|gure{\bf|
|00000d60| 20 3a 63 6f 6d 6d 61 6e | 64 7d 20 28 6c 61 6d 62 | :comman|d} (lamb|
|00000d70| 64 61 20 28 29 0a 20 20 | 20 20 20 20 20 20 20 20 |da (). | |
|00000d80| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000d90| 20 20 20 20 20 20 20 20 | 20 28 64 69 73 70 6c 61 | | (displa|
|00000da0| 79 20 22 48 65 6c 6c 6f | 2c 20 77 6f 72 6c 64 5c |y "Hello|, world\|
|00000db0| 62 61 63 6b 77 68 61 63 | 6b 7b 7d 6e 22 29 0a 20 |backwhac|k{}n"). |
|00000dc0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000dd0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000de0| 20 20 28 64 65 73 74 72 | 6f 79 20 2a 72 6f 6f 74 | (destr|oy *root|
|00000df0| 2a 29 29 29 0a 5c 65 6e | 64 7b 73 63 68 65 6d 65 |*))).\en|d{scheme|
|00000e00| 7d 0a 0a 57 68 65 6e 20 | 74 68 65 20 75 73 65 72 |}..When |the user|
|00000e10| 20 77 69 6c 6c 20 70 72 | 65 73 73 20 74 68 65 20 | will pr|ess the |
|00000e20| 6d 6f 75 73 65 20 6c 65 | 66 74 20 62 75 74 74 6f |mouse le|ft butto|
|00000e30| 6e 2c 20 74 68 65 20 63 | 6c 6f 73 75 72 65 20 61 |n, the c|losure a|
|00000e40| 73 73 6f 63 69 61 74 65 | 64 0a 74 6f 20 74 68 65 |ssociate|d.to the|
|00000e50| 20 7b 5c 74 74 20 3a 63 | 6f 6d 6d 61 6e 64 7d 20 | {\tt :c|ommand} |
|00000e60| 6f 70 74 69 6f 6e 20 77 | 69 6c 6c 20 62 65 20 65 |option w|ill be e|
|00000e70| 76 61 6c 75 61 74 65 64 | 20 69 6e 20 74 68 65 20 |valuated| in the |
|00000e80| 67 6c 6f 62 61 6c 0a 65 | 6e 76 69 72 6f 6e 6d 65 |global.e|nvironme|
|00000e90| 6e 74 2e 20 20 45 76 61 | 6c 75 61 74 69 6f 6e 20 |nt. Eva|luation |
|00000ea0| 6f 66 20 74 68 65 20 67 | 69 76 65 6e 20 63 6c 6f |of the g|iven clo|
|00000eb0| 73 75 72 65 20 77 69 6c | 6c 20 64 69 73 70 6c 61 |sure wil|l displa|
|00000ec0| 79 20 74 68 65 20 6d 65 | 73 73 61 67 65 0a 61 6e |y the me|ssage.an|
|00000ed0| 64 20 63 61 6c 6c 20 74 | 68 65 20 7b 5c 74 74 20 |d call t|he {\tt |
|00000ee0| 64 65 73 74 72 6f 79 7d | 20 7b 5c 65 6d 20 54 6b |destroy}| {\em Tk|
|00000ef0| 2d 63 6f 6d 6d 61 6e 64 | 7d 2e 0a 0a 5c 62 65 67 |-command|}...\beg|
|00000f00| 69 6e 7b 6e 6f 74 65 7d | 0a 5c 6c 61 62 65 6c 7b |in{note}|.\label{|
|00000f10| 72 6f 6f 74 20 77 69 6e | 64 6f 77 7d 5c 6d 61 69 |root win|dow}\mai|
|00000f20| 6e 69 6e 64 65 78 7b 72 | 6f 6f 74 20 77 69 6e 64 |nindex{r|oot wind|
|00000f30| 6f 77 7d 0a 54 68 65 20 | 72 6f 6f 74 20 77 69 64 |ow}.The |root wid|
|00000f40| 67 65 74 20 69 73 20 64 | 65 6e 6f 74 65 64 20 60 |get is d|enoted `|
|00000f50| 60 2e 27 27 20 69 6e 20 | 54 63 6c 2e 20 54 68 69 |`.'' in |Tcl. Thi|
|00000f60| 73 20 63 6f 6e 76 65 6e | 74 69 6f 6e 20 69 73 20 |s conven|tion is |
|00000f70| 61 6d 62 69 67 75 6f 75 | 73 20 77 69 74 68 20 74 |ambiguou|s with t|
|00000f80| 68 65 0a 64 6f 74 74 65 | 64 20 70 61 69 72 20 63 |he.dotte|d pair c|
|00000f90| 6f 6e 76 65 6e 74 69 6f | 6e 20 61 6e 64 20 74 68 |onventio|n and th|
|00000fa0| 65 20 64 6f 74 20 6d 75 | 73 74 20 62 65 20 71 75 |e dot mu|st be qu|
|00000fb0| 6f 74 65 64 20 74 6f 20 | 61 76 6f 69 64 20 70 72 |oted to |avoid pr|
|00000fc0| 6f 62 6c 65 6d 73 2e 20 | 53 69 6e 63 65 0a 74 68 |oblems. |Since.th|
|00000fd0| 69 73 20 70 72 6f 62 6c | 65 6d 20 61 72 69 73 65 |is probl|em arise|
|00000fe0| 73 20 73 6f 20 6f 66 74 | 65 6e 2c 20 74 68 65 20 |s so oft|en, the |
|00000ff0| 76 61 72 69 61 62 6c 65 | 20 5c 69 64 65 7b 2a 72 |variable| \ide{*r|
|00001000| 6f 6f 74 2a 7d 20 68 61 | 73 20 62 65 65 6e 20 69 |oot*} ha|s been i|
|00001010| 6e 74 72 6f 64 75 63 65 | 64 20 69 6e 0a 7b 5c 73 |ntroduce|d in.{\s|
|00001020| 74 6b 7d 20 74 6f 20 64 | 65 6e 6f 74 65 20 74 68 |tk} to d|enote th|
|00001030| 65 20 54 6b 20 6d 61 69 | 6e 20 77 69 6e 64 6f 77 |e Tk mai|n window|
|00001040| 2e 0a 5c 65 6e 64 7b 6e | 6f 74 65 7d 0a 0a 5c 73 |..\end{n|ote}..\s|
|00001050| 75 62 73 65 63 74 69 6f | 6e 2a 7b 4d 61 6e 61 67 |ubsectio|n*{Manag|
|00001060| 69 6e 67 20 57 69 64 67 | 65 74 20 53 63 72 6f 6c |ing Widg|et Scrol|
|00001070| 6c 62 61 72 73 7d 0a 0a | 57 68 65 6e 20 75 73 69 |lbars}..|When usi|
|00001080| 6e 67 20 73 63 72 6f 6c | 6c 62 61 72 73 2c 20 54 |ng scrol|lbars, T|
|00001090| 6b 20 6c 69 62 72 61 72 | 79 20 70 61 73 73 65 73 |k librar|y passes|
|000010a0| 20 70 61 72 61 6d 65 74 | 65 72 73 20 74 6f 20 74 | paramet|ers to t|
|000010b0| 68 65 20 77 69 64 67 65 | 74 0a 61 73 73 6f 63 69 |he widge|t.associ|
|000010c0| 61 74 65 64 20 74 6f 20 | 74 68 65 20 73 63 72 6f |ated to |the scro|
|000010d0| 6c 6c 62 61 72 20 28 61 | 6e 64 20 7b 5c 65 6d 20 |llbar (a|nd {\em |
|000010e0| 76 69 63 65 20 76 65 72 | 73 61 7d 29 2e 20 4c 65 |vice ver|sa}). Le|
|000010f0| 74 20 75 73 20 6c 6f 6f | 6b 20 61 74 20 61 0a 74 |t us loo|k at a.t|
|00001100| 65 78 74 20 77 69 64 67 | 65 74 20 77 69 74 68 20 |ext widg|et with |
|00001110| 61 6e 20 61 73 73 6f 63 | 69 61 74 65 64 20 73 63 |an assoc|iated sc|
|00001120| 72 6f 6c 6c 62 61 72 2e | 20 57 68 65 6e 20 74 68 |rollbar.| When th|
|00001130| 65 20 73 63 72 6f 6c 6c | 62 61 72 20 69 73 20 6d |e scroll|bar is m|
|00001140| 6f 76 65 64 2c 0a 74 68 | 65 20 63 6f 6d 6d 61 6e |oved,.th|e comman|
|00001150| 64 20 6f 66 20 74 68 65 | 20 61 73 73 6f 63 69 61 |d of the| associa|
|00001160| 74 65 64 20 77 69 64 67 | 65 74 20 69 73 20 69 6e |ted widg|et is in|
|00001170| 76 6f 6b 65 64 20 74 6f | 20 63 68 61 6e 67 65 20 |voked to| change |
|00001180| 69 74 73 20 76 69 65 77 | 2e 0a 4f 6e 20 74 68 65 |its view|..On the|
|00001190| 20 6f 74 68 65 72 20 73 | 69 64 65 2c 20 77 68 65 | other s|ide, whe|
|000011a0| 6e 20 62 72 6f 77 73 69 | 6e 67 20 74 68 65 20 63 |n browsi|ng the c|
|000011b0| 6f 6e 74 65 6e 74 20 6f | 66 20 74 68 65 20 74 65 |ontent o|f the te|
|000011c0| 78 74 20 77 69 64 67 65 | 74 20 28 77 69 74 68 0a |xt widge|t (with.|
|000011d0| 61 72 72 6f 77 73 20 66 | 6f 72 20 65 78 61 6d 70 |arrows f|or examp|
|000011e0| 6c 65 29 2c 20 74 68 65 | 20 73 63 72 6f 6c 6c 62 |le), the| scrollb|
|000011f0| 61 72 20 69 73 20 75 70 | 64 61 74 65 64 20 62 79 |ar is up|dated by|
|00001200| 20 63 61 6c 6c 69 6e 67 | 20 69 74 27 73 0a 61 73 | calling| it's.as|
|00001210| 73 6f 63 69 61 74 65 64 | 20 63 6c 6f 73 75 72 65 |sociated| closure|
|00001220| 2e 20 54 6b 20 6c 69 62 | 72 61 72 79 20 70 61 73 |. Tk lib|rary pas|
|00001230| 73 65 73 20 70 6f 73 69 | 74 69 6f 6e 20 69 6e 66 |ses posi|tion inf|
|00001240| 6f 72 6d 61 74 69 6f 6e | 73 20 74 6f 0a 73 63 72 |ormation|s to.scr|
|00001250| 6f 6c 6c 69 6e 67 20 63 | 6c 6f 73 75 72 65 73 2e |olling c|losures.|
|00001260| 20 54 68 69 73 20 69 6e | 66 6f 72 6d 61 74 69 6f | This in|formatio|
|00001270| 6e 73 20 61 72 65 20 74 | 68 65 20 70 61 72 61 6d |ns are t|he param|
|00001280| 65 74 65 72 73 20 6f 66 | 20 74 68 65 0a 63 6c 6f |eters of| the.clo|
|00001290| 73 75 72 65 2e 20 20 48 | 65 72 65 61 66 74 65 72 |sure. H|ereafter|
|000012a0| 20 69 73 20 61 6e 20 65 | 78 61 6d 70 6c 65 20 69 | is an e|xample i|
|000012b0| 6d 70 6c 65 6d 65 6e 74 | 69 6e 67 20 61 20 74 65 |mplement|ing a te|
|000012c0| 78 74 20 77 69 64 67 65 | 74 20 77 69 74 68 20 61 |xt widge|t with a|
|000012d0| 0a 73 63 72 6f 6c 6c 62 | 61 72 20 28 73 65 65 20 |.scrollb|ar (see |
|000012e0| 74 68 65 20 68 65 6c 70 | 20 70 61 67 65 73 20 66 |the help| pages f|
|000012f0| 6f 72 20 64 65 74 61 69 | 6c 73 29 3a 0a 5c 62 65 |or detai|ls):.\be|
|00001300| 67 69 6e 7b 73 63 68 65 | 6d 65 7d 0a 28 74 65 78 |gin{sche|me}.(tex|
|00001310| 74 20 27 2e 74 78 74 20 | 3a 79 73 63 72 6f 6c 6c |t '.txt |:yscroll|
|00001320| 63 6f 6d 6d 61 6e 64 20 | 20 28 6c 61 6d 62 64 61 |command | (lambda|
|00001330| 20 6c 20 28 61 70 70 6c | 79 20 2e 73 63 72 6f 6c | l (appl|y .scrol|
|00001340| 6c 20 27 73 65 74 20 6c | 29 29 29 0a 28 73 63 72 |l 'set l|))).(scr|
|00001350| 6f 6c 6c 62 61 72 20 27 | 2e 73 63 72 6f 6c 6c 20 |ollbar '|.scroll |
|00001360| 3a 63 6f 6d 6d 61 6e 64 | 20 28 6c 61 6d 62 64 61 |:command| (lambda|
|00001370| 20 6c 20 28 61 70 70 6c | 79 20 2e 74 78 74 20 27 | l (appl|y .txt '|
|00001380| 79 76 69 65 77 20 6c 29 | 29 29 0a 0a 28 70 61 63 |yview l)|))..(pac|
|00001390| 6b 20 2e 74 78 74 20 3a | 73 69 64 65 20 22 6c 65 |k .txt :|side "le|
|000013a0| 66 74 22 29 20 20 20 0a | 28 70 61 63 6b 20 2e 73 |ft") .|(pack .s|
|000013b0| 63 72 6f 6c 6c 20 3a 66 | 69 6c 6c 20 22 79 22 20 |croll :f|ill "y" |
|000013c0| 3a 65 78 70 61 6e 64 20 | 5c 73 63 68 74 72 75 65 |:expand |\schtrue|
|000013d0| 20 3a 73 69 64 65 20 22 | 6c 65 66 74 22 29 0a 5c | :side "|left").\|
|000013e0| 65 6e 64 7b 73 63 68 65 | 6d 65 7d 0a 0a 5c 73 65 |end{sche|me}..\se|
|000013f0| 63 74 69 6f 6e 7b 54 6b | 20 62 69 6e 64 69 6e 67 |ction{Tk| binding|
|00001400| 73 7d 0a 0a 5c 73 75 62 | 73 65 63 74 69 6f 6e 2a |s}..\sub|section*|
|00001410| 7b 42 69 6e 64 69 6e 67 | 73 20 61 72 65 20 53 63 |{Binding|s are Sc|
|00001420| 68 65 6d 65 20 63 6c 6f | 73 75 72 65 73 7d 0a 0a |heme clo|sures}..|
|00001430| 54 68 65 20 54 6b 20 5c | 69 64 65 7b 62 69 6e 64 |The Tk \|ide{bind|
|00001440| 7d 20 63 6f 6d 6d 61 6e | 64 20 61 73 73 6f 63 69 |} comman|d associ|
|00001450| 61 74 65 73 20 53 63 68 | 65 6d 65 20 73 63 72 69 |ates Sch|eme scri|
|00001460| 70 74 73 20 77 69 74 68 | 20 58 20 65 76 65 6e 74 |pts with| X event|
|00001470| 73 2e 0a 53 74 61 72 74 | 69 6e 67 20 77 69 74 68 |s..Start|ing with|
|00001480| 20 76 65 72 73 69 6f 6e | 20 33 2e 30 20 74 68 6f | version| 3.0 tho|
|00001490| 73 65 20 73 63 72 69 70 | 74 73 20 6d 75 73 74 20 |se scrip|ts must |
|000014a0| 62 65 20 53 63 68 65 6d | 65 0a 63 6c 6f 73 75 72 |be Schem|e.closur|
|000014b0| 65 73 5c 66 6f 6f 74 6e | 6f 74 65 7b 4f 6c 64 20 |es\footn|ote{Old |
|000014c0| 73 79 6e 74 61 78 20 66 | 6f 72 20 62 69 6e 64 69 |syntax f|or bindi|
|000014d0| 6e 67 73 20 28 69 2e 65 | 2e 20 73 74 72 69 6e 67 |ngs (i.e|. string|
|000014e0| 73 29 20 69 73 20 6e 6f | 20 6d 6f 72 65 0a 20 20 |s) is no| more. |
|000014f0| 73 75 70 70 6f 72 74 65 | 64 2e 20 4f 6c 64 20 62 |supporte|d. Old b|
|00001500| 69 6e 64 69 6e 67 73 20 | 73 63 72 69 70 74 73 20 |indings |scripts |
|00001510| 6d 75 73 74 20 68 65 6e | 63 65 20 62 65 20 72 65 |must hen|ce be re|
|00001520| 77 72 69 74 74 65 6e 2e | 7d 2e 20 42 69 6e 64 69 |written.|}. Bindi|
|00001530| 6e 67 0a 63 6c 6f 73 75 | 72 65 73 20 63 61 6e 20 |ng.closu|res can |
|00001540| 68 61 76 65 20 70 61 72 | 61 6d 65 74 65 72 73 2e |have par|ameters.|
|00001550| 20 54 68 6f 73 65 20 70 | 61 72 61 6d 65 74 65 72 | Those p|arameter|
|00001560| 73 20 61 72 65 20 6f 6e | 65 20 63 68 61 72 20 73 |s are on|e char s|
|00001570| 79 6d 62 6f 6c 73 0a 28 | 77 69 74 68 20 74 68 65 |ymbols.(|with the|
|00001580| 20 73 61 6d 65 20 63 6f | 6e 76 65 6e 74 69 6f 6e | same co|nvention|
|00001590| 73 20 74 68 61 6e 20 74 | 68 65 20 54 63 6c 20 5c |s than t|he Tcl \|
|000015a0| 25 20 63 68 61 72 2c 20 | 73 65 65 20 74 68 65 20 |% char, |see the |
|000015b0| 5c 74 65 78 74 74 74 7b | 62 69 6e 64 7d 0a 68 65 |\texttt{|bind}.he|
|000015c0| 6c 70 20 70 61 67 65 20 | 66 6f 72 20 64 65 74 61 |lp page |for deta|
|000015d0| 69 6c 73 29 2e 20 46 6f | 72 20 69 6e 73 74 61 6e |ils). Fo|r instan|
|000015e0| 63 65 2c 20 74 68 65 20 | 66 6f 6c 6c 6f 77 69 6e |ce, the |followin|
|000015f0| 67 20 54 63 6c 20 73 63 | 72 69 70 74 20 0a 5c 62 |g Tcl sc|ript .\b|
|00001600| 65 67 69 6e 7b 73 63 68 | 65 6d 65 7d 0a 62 69 6e |egin{sch|eme}.bin|
|00001610| 64 20 2e 77 20 3c 42 75 | 74 74 6f 6e 50 72 65 73 |d .w <Bu|ttonPres|
|00001620| 73 2d 33 3e 20 5c 7b 70 | 75 74 73 20 22 50 72 65 |s-3> \{p|uts "Pre|
|00001630| 73 73 20 6f 6e 20 77 69 | 64 67 65 74 20 5c 25 57 |ss on wi|dget \%W|
|00001640| 20 61 74 20 70 6f 73 69 | 74 69 6f 6e 20 5c 25 78 | at posi|tion \%x|
|00001650| 20 5c 25 79 22 5c 7d 0a | 5c 65 6e 64 7b 73 63 68 | \%y"\}.|\end{sch|
|00001660| 65 6d 65 7d 0a 63 61 6e | 20 62 65 20 74 72 61 6e |eme}.can| be tran|
|00001670| 73 6c 61 74 65 64 20 69 | 6e 74 6f 0a 5c 62 65 67 |slated i|nto.\beg|
|00001680| 69 6e 7b 73 63 68 65 6d | 65 7d 0a 28 62 69 6e 64 |in{schem|e}.(bind|
|00001690| 20 2e 77 20 22 3c 42 75 | 74 74 6f 6e 50 72 65 73 | .w "<Bu|ttonPres|
|000016a0| 73 2d 33 3e 22 20 0a 20 | 20 20 20 20 20 20 20 20 |s-3>" . | |
|000016b0| 28 6c 61 6d 62 64 61 20 | 28 7c 57 7c 20 78 20 79 |(lambda |(|W| x y|
|000016c0| 29 0a 20 20 20 20 20 20 | 20 20 20 20 20 20 28 66 |). | (f|
|000016d0| 6f 72 6d 61 74 20 5c 73 | 63 68 74 72 75 65 20 22 |ormat \s|chtrue "|
|000016e0| 50 72 65 73 73 20 6f 6e | 20 77 69 64 67 65 74 20 |Press on| widget |
|000016f0| 5c 76 65 72 62 2b 7e 2b | 41 20 61 74 20 70 6f 73 |\verb+~+|A at pos|
|00001700| 69 74 69 6f 6e 20 5c 76 | 65 72 62 2b 7e 2b 41 20 |ition \v|erb+~+A |
|00001710| 5c 76 65 72 62 2b 7e 2b | 41 5c 76 65 72 62 2b 5c |\verb+~+|A\verb+\|
|00001720| 2b 6e 22 20 7c 57 7c 20 | 78 20 79 29 29 29 0a 5c |+n" |W| |x y))).\|
|00001730| 65 6e 64 7b 73 63 68 65 | 6d 65 7d 0a 0a 5c 62 65 |end{sche|me}..\be|
|00001740| 67 69 6e 7b 6e 6f 74 65 | 7d 0a 20 20 55 73 61 67 |gin{note|}. Usag|
|00001750| 65 20 6f 66 20 76 65 72 | 74 69 63 61 6c 73 20 62 |e of ver|ticals b|
|00001760| 61 72 73 20 66 6f 72 20 | 74 68 65 20 5c 74 65 78 |ars for |the \tex|
|00001770| 74 74 74 7b 57 7d 20 73 | 79 6d 62 6f 6c 20 69 73 |ttt{W} s|ymbol is|
|00001780| 20 6e 65 63 65 73 73 61 | 72 79 20 68 65 72 65 0a | necessa|ry here.|
|00001790| 20 20 62 65 63 61 75 73 | 65 20 74 68 65 20 54 6b | becaus|e the Tk|
|000017a0| 20 74 6f 6f 6c 6b 69 74 | 20 69 73 20 63 61 73 65 | toolkit| is case|
|000017b0| 20 73 65 6e 73 69 74 69 | 76 65 20 28 7b 5c 65 6d | sensiti|ve ({\em|
|000017c0| 20 65 2e 67 2e 7d 7e 5c | 74 65 78 74 74 74 7b 57 | e.g.}~\|texttt{W|
|000017d0| 7d 7e 69 6e 0a 20 20 62 | 69 6e 64 69 6e 67 73 20 |}~in. b|indings |
|000017e0| 69 73 20 74 68 65 20 70 | 61 74 68 20 6e 61 6d 65 |is the p|ath name|
|000017f0| 20 6f 66 20 74 68 65 20 | 77 69 6e 64 6f 77 20 74 | of the |window t|
|00001800| 6f 20 77 68 69 63 68 20 | 74 68 65 20 65 76 65 6e |o which |the even|
|00001810| 74 20 77 61 73 0a 20 20 | 72 65 70 6f 72 74 65 64 |t was. |reported|
|00001820| 2c 20 77 68 65 72 65 61 | 73 20 5c 74 65 78 74 74 |, wherea|s \textt|
|00001830| 74 7b 77 7d 20 69 73 20 | 74 68 65 20 77 69 64 74 |t{w} is |the widt|
|00001840| 68 20 66 69 65 6c 64 20 | 66 72 6f 6d 20 74 68 65 |h field |from the|
|00001850| 20 65 76 65 6e 74 2e 20 | 0a 5c 65 6e 64 7b 6e 6f | event. |.\end{no|
|00001860| 74 65 7d 0a 0a 5c 73 75 | 62 73 65 63 74 69 6f 6e |te}..\su|bsection|
|00001870| 2a 7b 42 69 6e 64 69 6e | 67 73 20 61 72 65 20 63 |*{Bindin|gs are c|
|00001880| 68 61 69 6e 65 64 7d 0a | 0a 49 6e 20 54 6b 34 2e |hained}.|.In Tk4.|
|00001890| 30 20 61 6e 64 20 6c 61 | 74 65 72 2c 20 62 69 6e |0 and la|ter, bin|
|000018a0| 64 69 6e 67 73 20 61 72 | 65 20 63 68 61 69 6e 65 |dings ar|e chaine|
|000018b0| 64 20 73 69 6e 63 65 20 | 69 74 20 69 73 20 70 6f |d since |it is po|
|000018c0| 73 73 69 62 6c 65 20 66 | 6f 72 0a 73 65 76 65 72 |ssible f|or.sever|
|000018d0| 61 6c 20 62 69 6e 64 69 | 6e 67 73 20 74 6f 20 6d |al bindi|ngs to m|
|000018e0| 61 74 63 68 20 61 20 67 | 69 76 65 6e 20 58 20 65 |atch a g|iven X e|
|000018f0| 76 65 6e 74 2e 20 20 49 | 66 20 74 68 65 20 62 69 |vent. I|f the bi|
|00001900| 6e 64 69 6e 67 73 20 61 | 72 65 0a 61 73 73 6f 63 |ndings a|re.assoc|
|00001910| 69 61 74 65 64 20 77 69 | 74 68 20 64 69 66 66 65 |iated wi|th diffe|
|00001920| 72 65 6e 74 20 74 61 67 | 73 2c 20 74 68 65 6e 20 |rent tag|s, then |
|00001930| 65 61 63 68 20 6f 66 20 | 74 68 65 20 62 69 6e 64 |each of |the bind|
|00001940| 69 6e 67 73 20 77 69 6c | 6c 20 62 65 0a 65 78 65 |ings wil|l be.exe|
|00001950| 63 75 74 65 64 2c 20 69 | 6e 20 6f 72 64 65 72 2e |cuted, i|n order.|
|00001960| 20 20 42 79 20 64 65 66 | 61 75 6c 74 2c 20 61 20 | By def|ault, a |
|00001970| 63 6c 61 73 73 20 62 69 | 6e 64 69 6e 67 20 77 69 |class bi|nding wi|
|00001980| 6c 6c 20 62 65 20 65 78 | 65 63 75 74 65 64 0a 66 |ll be ex|ecuted.f|
|00001990| 69 72 73 74 2c 20 66 6f | 6c 6c 6f 77 65 64 20 62 |irst, fo|llowed b|
|000019a0| 79 20 61 20 62 69 6e 64 | 69 6e 67 20 66 6f 72 20 |y a bind|ing for |
|000019b0| 74 68 65 20 77 69 64 67 | 65 74 2c 20 61 20 62 69 |the widg|et, a bi|
|000019c0| 6e 64 69 6e 67 20 66 6f | 72 20 69 74 73 0a 74 6f |nding fo|r its.to|
|000019d0| 70 6c 65 76 65 6c 2c 20 | 61 6e 64 20 61 6e 20 5c |plevel, |and an \|
|000019e0| 74 65 78 74 74 74 7b 61 | 6c 6c 7d 20 62 69 6e 64 |texttt{a|ll} bind|
|000019f0| 69 6e 67 2e 20 20 54 68 | 65 20 5c 69 64 65 7b 62 |ing. Th|e \ide{b|
|00001a00| 69 6e 64 74 61 67 73 7d | 20 63 6f 6d 6d 61 6e 64 |indtags}| command|
|00001a10| 20 6d 61 79 0a 62 65 20 | 75 73 65 64 20 74 6f 20 | may.be |used to |
|00001a20| 63 68 61 6e 67 65 20 74 | 68 69 73 20 6f 72 64 65 |change t|his orde|
|00001a30| 72 20 66 6f 72 20 61 20 | 70 61 72 74 69 63 75 6c |r for a |particul|
|00001a40| 61 72 20 77 69 6e 64 6f | 77 20 6f 72 20 74 6f 20 |ar windo|w or to |
|00001a50| 61 73 73 6f 63 69 61 74 | 65 0a 61 64 64 69 74 69 |associat|e.additi|
|00001a60| 6f 6e 61 6c 20 62 69 6e | 64 69 6e 67 20 74 61 67 |onal bin|ding tag|
|00001a70| 73 20 77 69 74 68 20 74 | 68 65 20 77 69 6e 64 6f |s with t|he windo|
|00001a80| 77 20 28 73 65 65 20 63 | 6f 72 72 65 73 70 6f 6e |w (see c|orrespon|
|00001a90| 64 69 6e 67 20 68 65 6c | 70 20 70 61 67 65 0a 66 |ding hel|p page.f|
|00001aa0| 6f 72 20 64 65 74 61 69 | 6c 73 29 2e 20 49 66 20 |or detai|ls). If |
|00001ab0| 74 68 65 20 72 65 73 75 | 6c 74 20 6f 66 20 63 6c |the resu|lt of cl|
|00001ac0| 6f 73 75 72 65 20 69 6e | 20 74 68 65 20 62 69 6e |osure in| the bin|
|00001ad0| 64 69 6e 67 73 20 63 68 | 61 69 6e 20 69 73 20 74 |dings ch|ain is t|
|00001ae0| 68 65 20 73 79 6d 62 6f | 6c 20 0a 5c 69 64 65 7b |he symbo|l .\ide{|
|00001af0| 62 72 65 61 6b 7d 2c 20 | 74 68 65 20 6e 65 78 74 |break}, |the next|
|00001b00| 20 63 6c 6f 73 75 72 65 | 73 20 6f 66 20 74 68 65 | closure|s of the|
|00001b10| 20 63 68 61 69 6e 20 61 | 72 65 20 6e 6f 74 20 65 | chain a|re not e|
|00001b20| 78 65 63 75 74 65 64 2e | 20 54 68 65 20 65 78 61 |xecuted.| The exa|
|00001b30| 6d 70 6c 65 20 62 65 6c | 6f 77 0a 69 6c 6c 75 73 |mple bel|ow.illus|
|00001b40| 74 72 61 74 65 73 20 74 | 68 69 73 3a 0a 5c 62 65 |trates t|his:.\be|
|00001b50| 67 69 6e 7b 73 63 68 65 | 6d 65 7d 0a 28 70 61 63 |gin{sche|me}.(pac|
|00001b60| 6b 20 28 65 6e 74 72 79 | 20 27 2e 65 29 29 0a 28 |k (entry| '.e)).(|
|00001b70| 62 69 6e 64 20 2e 65 20 | 22 3c 4b 65 79 50 72 65 |bind .e |"<KeyPre|
|00001b80| 73 73 3e 22 20 28 6c 61 | 6d 62 64 61 20 28 7c 41 |ss>" (la|mbda (|A|
|00001b90| 7c 29 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 ||). | |
|00001ba0| 20 20 20 20 20 20 20 20 | 20 20 20 28 75 6e 6c 65 | | (unle|
|00001bb0| 73 73 20 28 73 74 72 69 | 6e 67 2d 3e 6e 75 6d 62 |ss (stri|ng->numb|
|00001bc0| 65 72 20 7c 41 7c 29 20 | 27 62 72 65 61 6b 29 29 |er |A|) |'break))|
|00001bd0| 29 0a 5c 65 6e 64 7b 73 | 63 68 65 6d 65 7d 0a 0a |).\end{s|cheme}..|
|00001be0| 42 69 6e 64 69 6e 67 73 | 20 66 6f 72 20 74 68 65 |Bindings| for the|
|00001bf0| 20 65 6e 74 72 79 20 5c | 74 65 78 74 74 74 7b 2e | entry \|texttt{.|
|00001c00| 65 7d 20 61 72 65 20 65 | 78 65 63 75 74 65 64 20 |e} are e|xecuted |
|00001c10| 62 65 66 6f 72 65 20 74 | 68 6f 73 65 20 66 6f 72 |before t|hose for|
|00001c20| 20 69 74 73 0a 63 6c 61 | 73 73 20 28 69 2e 65 2e | its.cla|ss (i.e.|
|00001c30| 20 5c 74 65 78 74 74 74 | 7b 45 6e 74 72 79 7d 29 | \texttt|{Entry})|
|00001c40| 2e 20 54 68 69 73 20 61 | 6c 6c 6f 77 73 20 75 73 |. This a|llows us|
|00001c50| 20 74 6f 20 66 69 6c 74 | 65 72 20 74 68 65 20 63 | to filt|er the c|
|00001c60| 68 61 72 61 63 74 65 72 | 73 0a 77 68 69 63 68 20 |haracter|s.which |
|00001c70| 61 72 65 20 65 66 66 65 | 63 74 69 76 65 6c 79 20 |are effe|ctively |
|00001c80| 70 61 73 73 65 64 20 74 | 6f 20 74 68 65 20 5c 74 |passed t|o the \t|
|00001c90| 65 78 74 74 74 7b 2e 65 | 7d 20 77 69 64 67 65 74 |exttt{.e|} widget|
|00001ca0| 2e 20 54 68 65 20 74 65 | 73 74 20 69 6e 20 74 68 |. The te|st in th|
|00001cb0| 69 73 0a 62 69 6e 64 69 | 6e 67 20 63 6c 6f 73 75 |is.bindi|ng closu|
|00001cc0| 72 65 20 62 72 65 61 6b | 73 20 74 68 65 20 63 68 |re break|s the ch|
|00001cd0| 61 69 6e 20 6f 66 20 62 | 69 6e 64 69 6e 67 73 20 |ain of b|indings |
|00001ce0| 69 66 20 74 68 65 20 74 | 79 70 65 64 20 63 68 61 |if the t|yped cha|
|00001cf0| 72 61 63 74 65 72 20 69 | 73 0a 6e 6f 74 20 61 20 |racter i|s.not a |
|00001d00| 64 69 67 69 74 2e 20 4f | 74 68 65 72 77 69 73 65 |digit. O|therwise|
|00001d10| 2c 20 74 68 65 20 66 6f | 6c 6c 6f 77 69 6e 67 20 |, the fo|llowing |
|00001d20| 62 69 6e 64 69 6e 67 2c | 20 74 68 65 20 6f 6e 65 |binding,| the one|
|00001d30| 20 66 6f 72 20 74 68 65 | 0a 5c 74 65 78 74 74 74 | for the|.\texttt|
|00001d40| 7b 45 6e 74 72 79 7d 20 | 63 6c 61 73 73 2c 20 69 |{Entry} |class, i|
|00001d50| 73 20 65 78 65 63 75 74 | 65 64 20 61 6e 64 20 69 |s execut|ed and i|
|00001d60| 6e 73 65 72 74 73 20 74 | 68 65 20 63 68 61 72 61 |nserts t|he chara|
|00001d70| 63 74 65 72 20 74 79 70 | 65 64 20 28 61 0a 64 69 |cter typ|ed (a.di|
|00001d80| 67 69 74 29 2e 0a 43 6f | 6e 73 65 71 75 65 6e 74 |git)..Co|nsequent|
|00001d90| 6c 79 2c 20 74 68 65 20 | 73 69 6d 70 6c 65 20 70 |ly, the |simple p|
|00001da0| 72 65 76 69 6f 75 73 20 | 62 69 6e 64 69 6e 67 20 |revious |binding |
|00001db0| 6d 61 6b 65 73 20 5c 74 | 65 78 74 74 74 7b 2e 65 |makes \t|exttt{.e|
|00001dc0| 7d 20 61 0a 63 6f 6e 74 | 72 6f 6c 6c 65 64 20 65 |} a.cont|rolled e|
|00001dd0| 6e 74 72 79 20 77 68 69 | 63 68 20 6f 6e 6c 79 20 |ntry whi|ch only |
|00001de0| 61 63 63 65 70 74 73 20 | 69 6e 74 65 67 65 72 20 |accepts |integer |
|00001df0| 6e 75 6d 62 65 72 73 2e | 0a 0a 0a 0a 25 20 4c 6f |numbers.|....% Lo|
|00001e00| 63 61 6c 57 6f 72 64 73 | 3a 20 20 74 6b 20 4f 75 |calWords|: tk Ou|
|00001e10| 73 74 65 72 68 6f 75 74 | 20 73 6c 61 73 68 69 66 |sterhout| slashif|
|00001e20| 69 65 64 20 73 74 64 6f | 75 74 0a 0a 25 25 25 20 |ied stdo|ut..%%% |
|00001e30| 4c 6f 63 61 6c 20 56 61 | 72 69 61 62 6c 65 73 3a |Local Va|riables:|
|00001e40| 20 0a 25 25 25 20 6d 6f | 64 65 3a 20 6c 61 74 65 | .%%% mo|de: late|
|00001e50| 78 0a 25 25 25 20 54 65 | 58 2d 6d 61 73 74 65 72 |x.%%% Te|X-master|
|00001e60| 3a 20 22 6d 61 6e 75 61 | 6c 22 0a 25 25 25 20 45 |: "manua|l".%%% E|
|00001e70| 6e 64 3a 20 0a 0a | |nd: .. | |
+--------+-------------------------+-------------------------+--------+--------+