home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / p / python / pytexdoc / ext / lib / libr / riscoslib / tex
LaTeX Document  |  1996-08-13  |  5.3 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: tex

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert LaTeX Document (document/latex) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file Python script text executable default (weak)
99% file LaTeX document text default
98% 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)



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 5c 73 65 63 74 69 6f 6e | 7b 42 75 69 6c 74 2d 69 |\section|{Built-i|
|00000010| 6e 20 4d 6f 64 75 6c 65 | 20 5c 73 65 63 74 63 6f |n Module| \sectco|
|00000020| 64 65 7b 52 69 73 63 4c | 69 62 7d 7d 0a 0a 5c 6d |de{RiscL|ib}}..\m|
|00000030| 6f 64 69 6e 64 65 78 7b | 72 69 73 63 6c 69 62 7d |odindex{|risclib}|
|00000040| 7b 65 78 70 65 72 69 6d | 65 6e 74 61 6c 7d 0a 0a |{experim|ental}..|
|00000050| 54 68 65 73 65 20 6d 6f | 64 75 6c 65 73 20 70 72 |These mo|dules pr|
|00000060| 6f 76 69 64 65 20 61 6e | 20 65 78 70 65 72 69 6d |ovide an| experim|
|00000070| 65 6e 74 61 6c 20 69 6e | 74 65 72 66 61 63 65 20 |ental in|terface |
|00000080| 74 6f 20 74 68 65 20 52 | 69 73 63 4f 53 20 74 6f |to the R|iscOS to|
|00000090| 6f 6c 62 6f 78 2e 0a 0a | 54 68 65 79 20 70 72 6f |olbox...|They pro|
|000000a0| 76 69 64 65 20 61 20 63 | 6c 61 73 73 20 5c 63 6f |vide a c|lass \co|
|000000b0| 64 65 7b 54 42 4f 62 6a | 65 63 74 7d 20 74 68 61 |de{TBObj|ect} tha|
|000000c0| 74 20 69 6d 70 6c 65 6d | 65 6e 74 73 20 74 68 65 |t implem|ents the|
|000000d0| 20 63 6f 6d 6d 6f 6e 20 | 74 6f 6f 6c 62 6f 78 0a | common |toolbox.|
|000000e0| 6d 65 74 68 6f 64 73 2c | 20 61 6e 64 20 64 65 72 |methods,| and der|
|000000f0| 69 76 65 64 20 63 6c 61 | 73 73 65 73 20 5c 63 6f |ived cla|sses \co|
|00000100| 64 65 7b 43 6f 6c 6f 75 | 72 44 62 6f 78 7d 2c 20 |de{Colou|rDbox}, |
|00000110| 5c 63 6f 64 65 7b 49 63 | 6f 6e 42 61 72 7d 2c 0a |\code{Ic|onBar},.|
|00000120| 20 5c 63 6f 64 65 7b 4d | 65 6e 75 7d 2c 20 5c 63 | \code{M|enu}, \c|
|00000130| 6f 64 65 7b 51 75 69 74 | 7d 2c 20 5c 63 6f 64 65 |ode{Quit|}, \code|
|00000140| 7b 53 61 76 65 41 73 7d | 2c 20 5c 63 6f 64 65 7b |{SaveAs}|, \code{|
|00000150| 57 69 6e 64 6f 77 7d 2e | 20 54 68 65 79 20 70 72 |Window}.| They pr|
|00000160| 6f 76 69 64 65 20 61 0a | 73 69 6d 70 6c 65 20 65 |ovide a.|simple e|
|00000170| 76 65 6e 74 20 70 6f 6c | 6c 69 6e 67 20 73 79 73 |vent pol|ling sys|
|00000180| 74 65 6d 2e 0a 0a 4e 65 | 69 74 68 65 72 20 74 68 |tem...Ne|ither th|
|00000190| 65 20 6d 6f 64 75 6c 65 | 73 20 6f 72 20 74 68 65 |e module|s or the|
|000001a0| 20 64 6f 63 75 6d 65 6e | 74 61 74 69 6f 6e 20 61 | documen|tation a|
|000001b0| 72 65 20 63 6f 6d 70 6c | 65 74 65 2e 20 49 20 68 |re compl|ete. I h|
|000001c0| 61 76 65 20 61 64 64 65 | 64 20 6d 65 74 68 6f 64 |ave adde|d method|
|000001d0| 73 0a 61 6e 64 20 6f 62 | 6a 65 63 74 73 20 77 68 |s.and ob|jects wh|
|000001e0| 65 6e 20 49 20 6e 65 65 | 64 65 64 20 74 6f 20 75 |en I nee|ded to u|
|000001f0| 73 65 20 74 68 65 6d 2e | 20 54 68 65 20 6d 65 74 |se them.| The met|
|00000200| 68 6f 64 73 20 70 72 6f | 76 69 64 65 64 20 6a 75 |hods pro|vided ju|
|00000210| 73 74 20 63 61 6c 6c 20 | 74 68 65 0a 74 6f 6f 6c |st call |the.tool|
|00000220| 62 6f 78 20 53 57 49 73 | 2c 20 61 6e 64 20 63 61 |box SWIs|, and ca|
|00000230| 6e 20 62 65 20 69 6e 73 | 70 65 63 74 65 64 20 62 |n be ins|pected b|
|00000240| 79 20 65 78 61 6d 69 6e | 69 6e 67 20 74 68 65 20 |y examin|ing the |
|00000250| 63 6f 64 65 2e 0a 0a 54 | 68 65 20 65 76 65 6e 74 |code...T|he event|
|00000260| 20 70 6f 6c 6c 69 6e 67 | 20 73 79 73 74 65 6d 20 | polling| system |
|00000270| 77 6f 72 6b 73 20 61 73 | 20 66 6f 6c 6c 6f 77 73 |works as| follows|
|00000280| 20 28 75 73 69 6e 67 20 | 21 49 62 72 6f 77 73 65 | (using |!Ibrowse|
|00000290| 20 61 73 20 61 6e 20 65 | 78 61 6d 70 6c 65 29 20 | as an e|xample) |
|000002a0| 3a 0a 0a 54 68 65 20 63 | 6f 6e 74 72 6f 6c 6c 69 |:..The c|ontrolli|
|000002b0| 6e 67 20 70 72 6f 67 72 | 61 6d 20 69 6d 70 6f 72 |ng progr|am impor|
|000002c0| 74 73 20 5c 63 6f 64 65 | 7b 74 62 65 76 65 6e 74 |ts \code|{tbevent|
|000002d0| 7d 2e 0a 5c 63 6f 64 65 | 7b 74 62 65 76 65 6e 74 |}..\code|{tbevent|
|000002e0| 7d 20 69 6d 70 6f 72 74 | 73 20 74 68 72 65 65 20 |} import|s three |
|000002f0| 64 69 63 74 69 6f 6e 61 | 72 69 65 73 20 66 72 6f |dictiona|ries fro|
|00000300| 6d 20 61 20 6d 6f 64 75 | 6c 65 20 5c 63 6f 64 65 |m a modu|le \code|
|00000310| 7b 65 76 65 6e 74 73 7d | 20 74 68 61 74 0a 69 6e |{events}| that.in|
|00000320| 63 6c 75 64 65 20 64 65 | 74 61 69 6c 73 20 6f 66 |clude de|tails of|
|00000330| 20 74 68 65 20 74 6f 6f | 6c 62 6f 78 20 65 76 65 | the too|lbox eve|
|00000340| 6e 74 73 2c 20 77 69 6d | 70 20 65 76 65 6e 74 73 |nts, wim|p events|
|00000350| 20 61 6e 64 20 77 69 6d | 70 20 6d 65 73 73 61 67 | and wim|p messag|
|00000360| 65 73 20 74 68 61 74 20 | 74 68 65 0a 61 70 70 6c |es that |the.appl|
|00000370| 69 63 61 74 69 6f 6e 20 | 69 73 20 69 6e 74 65 72 |ication |is inter|
|00000380| 65 73 74 65 64 20 69 6e | 2e 20 54 68 65 20 64 69 |ested in|. The di|
|00000390| 63 74 69 6f 6e 61 72 69 | 65 73 20 61 72 65 20 63 |ctionari|es are c|
|000003a0| 61 6c 6c 65 64 20 5c 63 | 6f 64 65 7b 65 64 69 63 |alled \c|ode{edic|
|000003b0| 74 7d 2c 20 0a 5c 63 6f | 64 65 7b 77 64 69 63 74 |t}, .\co|de{wdict|
|000003c0| 7d 20 61 6e 64 20 5c 63 | 6f 64 65 7b 6d 64 69 63 |} and \c|ode{mdic|
|000003d0| 74 7d 2e 20 54 68 65 79 | 20 63 6f 6e 74 61 69 6e |t}. They| contain|
|000003e0| 20 65 76 65 6e 74 20 6f | 72 20 6d 65 73 73 61 67 | event o|r messag|
|000003f0| 65 20 6e 75 6d 62 65 72 | 73 20 61 73 0a 6b 65 79 |e number|s as.key|
|00000400| 73 20 61 6e 64 20 6e 61 | 6d 65 73 20 61 73 20 76 |s and na|mes as v|
|00000410| 61 6c 75 65 73 2e 20 53 | 65 65 20 5c 76 65 72 62 |alues. S|ee \verb|
|00000420| 7c 21 69 62 72 6f 77 73 | 65 2e 70 79 2e 65 76 65 ||!ibrows|e.py.eve|
|00000430| 6e 74 73 7c 20 66 6f 72 | 20 61 6e 20 65 78 61 6d |nts| for| an exam|
|00000440| 70 6c 65 2e 0a 0a 54 68 | 65 20 70 72 6f 67 72 61 |ple...Th|e progra|
|00000450| 6d 20 6d 75 73 74 20 73 | 75 70 70 6c 79 20 63 6c |m must s|upply cl|
|00000460| 61 73 73 65 73 20 77 69 | 74 68 20 6d 65 74 68 6f |asses wi|th metho|
|00000470| 64 73 20 74 6f 20 68 61 | 6e 64 6c 65 20 74 68 65 |ds to ha|ndle the|
|00000480| 73 65 20 65 76 65 6e 74 | 73 2e 20 54 68 65 0a 6d |se event|s. The.m|
|00000490| 65 74 68 6f 64 73 20 77 | 69 6c 6c 20 68 61 76 65 |ethods w|ill have|
|000004a0| 20 74 68 65 20 73 61 6d | 65 20 6e 61 6d 65 73 20 | the sam|e names |
|000004b0| 61 73 20 74 68 65 20 64 | 69 63 74 69 6f 6e 61 72 |as the d|ictionar|
|000004c0| 79 20 76 61 6c 75 65 73 | 2e 20 0a 0a 54 68 65 20 |y values|. ..The |
|000004d0| 70 72 6f 67 72 61 6d 20 | 63 61 6c 6c 73 0a 20 5c |program |calls. \|
|000004e0| 76 65 72 62 7c 74 62 65 | 76 65 6e 74 2e 69 6e 69 |verb|tbe|vent.ini|
|000004f0| 74 69 61 6c 69 73 65 28 | 22 3c 69 62 72 6f 77 73 |tialise(|"<ibrows|
|00000500| 65 24 44 69 72 3e 22 29 | 7c 20 73 75 70 70 6c 79 |e$Dir>")|| supply|
|00000510| 69 6e 67 20 61 6e 20 61 | 70 70 6c 69 63 61 74 69 |ing an a|pplicati|
|00000520| 6f 6e 0a 20 64 69 72 65 | 63 74 6f 72 79 20 69 6e |on. dire|ctory in|
|00000530| 63 75 64 69 6e 67 20 61 | 20 52 65 73 6f 75 72 63 |cuding a| Resourc|
|00000540| 65 20 66 69 6c 65 20 60 | 60 72 65 73 27 27 20 61 |e file `|`res'' a|
|00000550| 6e 64 20 61 20 60 60 4d | 65 73 73 61 67 65 73 27 |nd a ``M|essages'|
|00000560| 27 20 66 69 6c 65 2e 0a | 0a 54 68 65 20 70 72 6f |' file..|.The pro|
|00000570| 67 72 61 6d 20 72 65 67 | 69 73 74 65 72 73 20 69 |gram reg|isters i|
|00000580| 6e 73 74 61 6e 63 65 73 | 20 6f 66 20 74 68 65 20 |nstances| of the |
|00000590| 68 61 6e 64 6c 65 72 20 | 63 6c 61 73 73 65 73 20 |handler |classes |
|000005a0| 77 69 74 68 20 74 62 65 | 76 65 6e 74 20 28 73 65 |with tbe|vent (se|
|000005b0| 65 20 62 65 6c 6f 77 29 | 2e 0a 0a 54 68 65 20 70 |e below)|...The p|
|000005c0| 72 6f 67 72 61 6d 20 74 | 68 65 6e 20 63 61 6c 6c |rogram t|hen call|
|000005d0| 73 20 5c 63 6f 64 65 7b | 74 62 65 76 65 6e 74 2e |s \code{|tbevent.|
|000005e0| 70 6f 6c 6c 28 29 7d 20 | 72 65 70 65 61 74 65 64 |poll()} |repeated|
|000005f0| 6c 79 2e 0a 0a 54 6f 6f | 6c 62 6f 78 20 65 76 65 |ly...Too|lbox eve|
|00000600| 6e 74 20 68 61 6e 64 6c | 69 6e 67 20 77 6f 72 6b |nt handl|ing work|
|00000610| 73 20 61 73 20 66 6f 6c | 6c 6f 77 73 3a 0a 0a 54 |s as fol|lows:..T|
|00000620| 68 65 20 61 6e 63 65 73 | 74 6f 72 20 6f 62 6a 65 |he ances|tor obje|
|00000630| 63 74 20 6e 75 6d 62 65 | 72 20 6f 66 20 74 68 65 |ct numbe|r of the|
|00000640| 20 65 76 65 6e 74 20 69 | 73 20 75 73 65 64 20 74 | event i|s used t|
|00000650| 6f 20 66 69 6e 64 20 61 | 20 63 6c 61 73 73 20 69 |o find a| class i|
|00000660| 6e 73 74 61 6e 63 65 20 | 74 6f 0a 68 61 6e 64 6c |nstance |to.handl|
|00000670| 65 20 74 68 65 20 65 76 | 65 6e 74 2e 20 49 74 20 |e the ev|ent. It |
|00000680| 69 73 20 6c 6f 6f 6b 65 | 64 20 75 70 20 69 6e 20 |is looke|d up in |
|00000690| 61 20 64 69 63 74 69 6f | 6e 61 72 79 20 5c 63 6f |a dictio|nary \co|
|000006a0| 64 65 7b 74 62 65 76 65 | 6e 74 2e 74 62 63 6c 61 |de{tbeve|nt.tbcla|
|000006b0| 73 73 65 73 7d 20 74 6f | 0a 66 69 6e 64 20 74 68 |sses} to|.find th|
|000006c0| 65 20 68 61 6e 64 6c 65 | 72 2c 20 73 6f 20 65 61 |e handle|r, so ea|
|000006d0| 63 68 20 63 6c 61 73 73 | 20 74 68 61 74 20 68 61 |ch class| that ha|
|000006e0| 6e 64 6c 65 73 20 74 6f | 6f 6c 62 6f 78 20 6d 65 |ndles to|olbox me|
|000006f0| 74 68 6f 64 73 20 73 68 | 6f 75 6c 64 20 68 61 76 |thods sh|ould hav|
|00000700| 65 20 61 0a 5c 63 6f 64 | 65 7b 5f 5f 69 6e 69 74 |e a.\cod|e{__init|
|00000710| 5f 5f 7d 20 6d 65 74 68 | 6f 64 20 74 68 61 74 20 |__} meth|od that |
|00000720| 72 65 67 69 73 74 65 72 | 73 20 69 74 73 65 6c 66 |register|s itself|
|00000730| 20 69 6e 20 74 68 69 73 | 20 64 69 63 74 69 6f 6e | in this| diction|
|00000740| 61 72 79 2e 0a 0a 48 65 | 72 65 20 69 73 20 61 6e |ary...He|re is an|
|00000750| 20 65 78 61 6d 70 6c 65 | 20 66 72 6f 6d 20 60 60 | example| from ``|
|00000760| 21 47 72 61 70 68 27 27 | 0a 0a 5c 62 65 67 69 6e |!Graph''|..\begin|
|00000770| 7b 76 65 72 62 61 74 69 | 6d 7d 0a 63 6c 61 73 73 |{verbati|m}.class|
|00000780| 20 44 69 73 70 6c 61 79 | 28 77 69 6e 64 6f 77 2e | Display|(window.|
|00000790| 57 69 6e 64 6f 77 29 3a | 0a 20 20 20 20 20 20 61 |Window):|. a|
|000007a0| 63 74 69 6f 6e 73 3d 7b | 7d 20 20 20 20 20 20 20 |ctions={|} |
|000007b0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000007c0| 20 20 20 20 20 20 20 20 | 20 20 23 31 0a 20 20 20 | | #1. |
|000007d0| 20 20 20 64 65 66 20 5f | 5f 69 6e 69 74 5f 5f 28 | def _|_init__(|
|000007e0| 73 65 6c 66 29 3a 0a 20 | 20 20 20 20 20 20 20 20 |self):. | |
|000007f0| 20 77 69 6e 64 6f 77 2e | 57 69 6e 64 6f 77 2e 5f | window.|Window._|
|00000800| 5f 69 6e 69 74 5f 5f 28 | 73 65 6c 66 2c 22 44 69 |_init__(|self,"Di|
|00000810| 73 70 6c 61 79 22 29 20 | 23 32 0a 20 20 20 20 20 |splay") |#2. |
|00000820| 20 20 20 20 20 74 62 65 | 76 65 6e 74 2e 74 62 63 | tbe|vent.tbc|
|00000830| 6c 61 73 73 65 73 5b 73 | 65 6c 66 2e 69 64 5d 3d |lasses[s|elf.id]=|
|00000840| 73 65 6c 66 20 20 20 20 | 20 20 20 20 23 33 0a 20 |self | #3. |
|00000850| 20 20 20 20 20 20 20 20 | 20 73 65 6c 66 2e 68 61 | | self.ha|
|00000860| 6e 64 6c 65 3d 73 65 6c | 66 2e 67 65 74 77 69 6d |ndle=sel|f.getwim|
|00000870| 70 68 61 6e 64 6c 65 28 | 29 20 20 20 20 20 20 20 |phandle(|) |
|00000880| 23 34 0a 20 20 20 20 20 | 20 20 20 20 20 74 62 65 |#4. | tbe|
|00000890| 76 65 6e 74 2e 77 69 6e | 63 6c 61 73 73 65 73 5b |vent.win|classes[|
|000008a0| 73 65 6c 66 2e 68 61 6e | 64 6c 65 5d 3d 73 65 6c |self.han|dle]=sel|
|000008b0| 66 20 20 20 23 35 0a 5c | 65 6e 64 7b 76 65 72 62 |f #5.\|end{verb|
|000008c0| 61 74 69 6d 7d 0a 0a 49 | 6e 20 6c 69 6e 65 20 5c |atim}..I|n line \|
|000008d0| 76 65 72 62 7c 23 32 7c | 20 74 68 65 20 75 6e 64 |verb|#2|| the und|
|000008e0| 65 72 6c 79 69 6e 67 20 | 77 69 6e 64 6f 77 20 63 |erlying |window c|
|000008f0| 6c 61 73 73 20 69 73 20 | 69 6e 69 74 69 61 6c 69 |lass is |initiali|
|00000900| 73 65 64 2e 20 54 68 69 | 73 20 63 72 65 61 74 65 |sed. Thi|s create|
|00000910| 73 0a 61 20 74 6f 6f 6c | 62 6f 78 20 6f 62 6a 65 |s.a tool|box obje|
|00000920| 63 74 20 66 72 6f 6d 20 | 61 20 74 65 6d 70 6c 61 |ct from |a templa|
|00000930| 74 65 20 6e 61 6d 65 64 | 20 27 27 44 69 73 70 6c |te named| ''Displ|
|00000940| 61 79 27 27 0a 20 28 54 | 68 69 73 20 6d 75 73 74 |ay''. (T|his must|
|00000950| 20 62 65 20 61 20 77 69 | 6e 64 6f 77 20 6f 62 6a | be a wi|ndow obj|
|00000960| 65 63 74 2e 20 49 74 20 | 73 68 6f 75 6c 64 20 62 |ect. It |should b|
|00000970| 65 20 61 6e 20 61 6e 63 | 65 73 74 6f 72 20 6f 62 |e an anc|estor ob|
|00000980| 6a 65 63 74 2c 20 62 75 | 74 20 6e 6f 74 0a 20 20 |ject, bu|t not. |
|00000990| 61 75 74 6f 63 72 65 61 | 74 65 64 29 2e 0a 20 5c |autocrea|ted).. \|
|000009a0| 63 6f 64 65 7b 73 65 6c | 66 2e 69 64 7d 20 69 73 |code{sel|f.id} is|
|000009b0| 20 73 65 74 20 74 6f 20 | 74 68 65 20 6f 62 6a 65 | set to |the obje|
|000009c0| 63 74 20 69 64 65 6e 74 | 69 66 69 65 72 2e 0a 4c |ct ident|ifier..L|
|000009d0| 69 6e 65 20 5c 76 65 72 | 62 7c 23 33 7c 20 6e 6f |ine \ver|b|#3| no|
|000009e0| 77 20 72 65 67 69 73 74 | 65 72 73 20 74 68 65 20 |w regist|ers the |
|000009f0| 63 6c 61 73 73 20 69 6e | 73 74 61 6e 63 65 20 61 |class in|stance a|
|00000a00| 73 20 61 20 74 6f 6f 6c | 62 6f 78 20 65 76 65 6e |s a tool|box even|
|00000a10| 74 20 68 61 6e 64 6c 65 | 72 2e 0a 0a 49 66 20 61 |t handle|r...If a|
|00000a20| 6e 20 65 76 65 6e 74 20 | 6e 6f 77 20 61 72 72 69 |n event |now arri|
|00000a30| 76 65 73 20 66 6f 72 20 | 61 6e 20 6f 62 6a 65 63 |ves for |an objec|
|00000a40| 74 20 77 69 74 68 20 74 | 68 69 73 20 61 6e 63 65 |t with t|his ance|
|00000a50| 73 74 6f 72 20 69 74 73 | 20 65 76 65 6e 74 20 6e |stor its| event n|
|00000a60| 75 6d 62 65 72 20 69 73 | 0a 6c 6f 6f 6b 65 64 20 |umber is|.looked |
|00000a70| 75 70 20 69 6e 20 5c 63 | 6f 64 65 7b 65 64 69 63 |up in \c|ode{edic|
|00000a80| 74 7d 2e 20 54 68 65 20 | 63 6f 72 72 65 73 70 6f |t}. The |correspo|
|00000a90| 6e 64 69 6e 67 20 6e 61 | 6d 65 20 73 68 6f 75 6c |nding na|me shoul|
|00000aa0| 64 20 62 65 20 74 68 65 | 20 6e 61 6d 65 20 6f 66 |d be the| name of|
|00000ab0| 20 61 0a 6d 65 74 68 6f | 64 20 69 6e 20 63 6c 61 | a.metho|d in cla|
|00000ac0| 73 73 20 5c 63 6f 64 65 | 7b 44 69 73 70 6c 61 79 |ss \code|{Display|
|00000ad0| 7d 2e 20 49 74 20 77 69 | 6c 6c 20 62 65 20 63 61 |}. It wi|ll be ca|
|00000ae0| 6c 6c 65 64 20 66 6f 72 | 20 74 68 69 73 20 63 6c |lled for| this cl|
|00000af0| 61 73 73 20 69 6e 73 74 | 61 6e 63 65 2e 0a 0a 54 |ass inst|ance...T|
|00000b00| 68 65 20 63 6c 61 73 73 | 20 6d 65 74 68 6f 64 20 |he class| method |
|00000b10| 6e 61 6d 65 73 20 61 72 | 65 20 63 61 63 68 65 64 |names ar|e cached|
|00000b20| 20 69 6e 20 61 20 64 69 | 63 74 69 6f 6e 61 72 79 | in a di|ctionary|
|00000b30| 20 63 61 6c 6c 65 64 20 | 5c 63 6f 64 65 7b 61 63 | called |\code{ac|
|00000b40| 74 69 6f 6e 73 7d 2c 20 | 73 6f 0a 65 61 63 68 20 |tions}, |so.each |
|00000b50| 68 61 6e 64 6c 65 72 20 | 63 6c 61 73 73 20 73 68 |handler |class sh|
|00000b60| 6f 75 6c 64 20 63 6f 6e | 74 61 69 6e 20 61 6e 20 |ould con|tain an |
|00000b70| 65 6d 70 74 79 20 64 69 | 63 74 69 6f 6e 61 72 79 |empty di|ctionary|
|00000b80| 20 61 73 20 69 6e 20 6c | 69 6e 65 20 5c 76 65 72 | as in l|ine \ver|
|00000b90| 62 7c 23 31 7c 2e 0a 0a | 53 6f 6d 65 20 74 6f 6f |b|#1|...|Some too|
|00000ba0| 6c 62 6f 78 20 65 76 65 | 6e 74 73 20 77 69 6c 6c |lbox eve|nts will|
|00000bb0| 20 68 61 76 65 20 6e 6f | 20 61 6e 63 65 73 74 6f | have no| ancesto|
|00000bc0| 72 2e 20 54 68 65 73 65 | 20 77 69 6c 6c 20 62 65 |r. These| will be|
|00000bd0| 20 73 65 6e 74 20 74 6f | 20 61 20 63 6c 61 73 73 | sent to| a class|
|00000be0| 0a 69 6e 73 74 61 6e 63 | 65 20 72 65 67 69 73 74 |.instanc|e regist|
|00000bf0| 65 72 65 64 20 77 69 74 | 68 20 61 20 7a 65 72 6f |ered wit|h a zero|
|00000c00| 20 69 64 65 6e 74 69 66 | 69 65 72 2e 20 4d 6f 73 | identif|ier. Mos|
|00000c10| 74 20 70 72 6f 67 72 61 | 6d 73 20 77 69 6c 6c 20 |t progra|ms will |
|00000c20| 68 61 76 65 20 63 6f 64 | 65 0a 73 75 63 68 20 61 |have cod|e.such a|
|00000c30| 73 20 74 68 69 73 2c 20 | 77 68 69 63 68 20 77 69 |s this, |which wi|
|00000c40| 6c 6c 20 68 61 6e 64 6c | 65 20 61 6e 20 61 75 74 |ll handl|e an aut|
|00000c50| 6f 63 72 65 61 74 65 64 | 20 62 61 72 20 69 63 6f |ocreated| bar ico|
|00000c60| 6e 20 6f 62 6a 65 63 74 | 2e 0a 0a 5c 62 65 67 69 |n object|...\begi|
|00000c70| 6e 7b 76 65 72 62 61 74 | 69 6d 7d 0a 0a 63 6c 61 |n{verbat|im}..cla|
|00000c80| 73 73 20 4f 72 70 68 61 | 6e 73 3a 20 23 63 6c 61 |ss Orpha|ns: #cla|
|00000c90| 73 73 20 74 6f 20 68 61 | 6e 64 6c 65 20 65 76 65 |ss to ha|ndle eve|
|00000ca0| 6e 74 73 20 77 69 74 68 | 20 7a 65 72 6f 20 61 6e |nts with| zero an|
|00000cb0| 63 65 73 74 6f 72 0a 20 | 20 20 20 20 20 61 63 74 |cestor. | act|
|00000cc0| 69 6f 6e 73 3d 7b 7d 0a | 20 20 20 20 20 20 64 65 |ions={}.| de|
|00000cd0| 66 20 5f 5f 69 6e 69 74 | 5f 5f 28 73 65 6c 66 29 |f __init|__(self)|
|00000ce0| 3a 0a 20 20 20 20 20 20 | 20 20 20 20 74 62 65 76 |:. | tbev|
|00000cf0| 65 6e 74 2e 74 62 63 6c | 61 73 73 65 73 5b 30 5d |ent.tbcl|asses[0]|
|00000d00| 3d 73 65 6c 66 0a 20 20 | 20 20 20 20 64 65 66 20 |=self. | def |
|00000d10| 42 61 72 43 6c 69 63 6b | 28 73 65 6c 66 29 3a 0a |BarClick|(self):.|
|00000d20| 20 20 20 20 20 20 20 20 | 20 20 61 3d 44 69 73 70 | | a=Disp|
|00000d30| 6c 61 79 28 22 64 69 72 | 22 2c 22 54 6f 70 22 29 |lay("dir|","Top")|
|00000d40| 0a 20 20 20 20 20 20 64 | 65 66 20 45 5f 51 5f 51 |. d|ef E_Q_Q|
|00000d50| 75 69 74 28 73 65 6c 66 | 29 3a 0a 20 20 20 20 20 |uit(self|):. |
|00000d60| 20 20 20 20 20 65 78 69 | 74 28 29 0a 0a 6f 69 3d | exi|t()..oi=|
|00000d70| 4f 72 70 68 61 6e 73 28 | 29 20 20 23 63 72 65 61 |Orphans(|) #crea|
|00000d80| 74 65 20 61 6e 20 69 6e | 73 74 61 6e 63 65 20 6f |te an in|stance o|
|00000d90| 66 20 74 68 65 20 63 6c | 61 73 73 20 28 74 68 65 |f the cl|ass (the|
|00000da0| 20 6f 6e 6c 79 20 6f 6e | 65 21 29 0a 0a 5c 65 6e | only on|e!)..\en|
|00000db0| 64 7b 76 65 72 62 61 74 | 69 6d 7d 0a 0a 57 69 6d |d{verbat|im}..Wim|
|00000dc0| 70 20 65 76 65 6e 74 20 | 68 61 6e 64 6c 69 6e 67 |p event |handling|
|00000dd0| 20 69 73 20 73 69 6d 69 | 6c 61 72 2e 20 57 69 6d | is simi|lar. Wim|
|00000de0| 70 20 63 6f 64 65 73 20 | 6f 74 68 65 72 20 74 68 |p codes |other th|
|00000df0| 61 6e 20 37 2c 20 39 2c | 20 31 33 2c 20 31 37 20 |an 7, 9,| 13, 17 |
|00000e00| 61 6e 64 20 31 38 0a 61 | 72 65 20 73 65 6e 74 20 |and 18.a|re sent |
|00000e10| 74 6f 20 63 6c 61 73 73 | 20 69 6e 73 74 61 6e 63 |to class| instanc|
|00000e20| 65 73 20 72 65 67 69 73 | 74 65 72 65 64 20 62 79 |es regis|tered by|
|00000e30| 20 74 68 65 69 72 20 77 | 69 6d 70 20 77 69 6e 64 | their w|imp wind|
|00000e40| 6f 77 20 68 61 6e 64 6c | 65 73 2e 0a 43 6f 64 65 |ow handl|es..Code|
|00000e50| 73 20 37 2c 20 39 20 61 | 6e 64 20 31 33 20 61 72 |s 7, 9 a|nd 13 ar|
|00000e60| 65 20 67 69 76 65 6e 20 | 68 61 6e 64 6c 65 73 20 |e given |handles |
|00000e70| 6f 66 20 7a 65 72 6f 2e | 20 54 68 65 20 63 6c 61 |of zero.| The cla|
|00000e80| 73 73 65 73 20 61 72 65 | 20 72 65 67 69 73 74 65 |sses are| registe|
|00000e90| 72 65 64 20 69 6e 0a 74 | 68 65 20 64 69 63 74 69 |red in.t|he dicti|
|00000ea0| 6f 6e 61 72 79 20 5c 63 | 6f 64 65 7b 74 62 65 76 |onary \c|ode{tbev|
|00000eb0| 65 6e 74 2e 77 69 6e 63 | 6c 61 73 73 65 73 7d 2e |ent.winc|lasses}.|
|00000ec0| 20 4c 69 6e 65 73 20 5c | 76 65 72 62 7c 23 34 7c | Lines \|verb|#4||
|00000ed0| 20 61 6e 64 20 5c 76 65 | 72 62 7c 23 35 7c 20 69 | and \ve|rb|#5| i|
|00000ee0| 6e 0a 74 68 65 20 65 78 | 61 6d 70 6c 65 20 61 62 |n.the ex|ample ab|
|00000ef0| 6f 76 65 20 67 69 76 65 | 20 61 6e 20 65 78 61 6d |ove give| an exam|
|00000f00| 70 6c 65 20 6f 66 20 72 | 65 67 69 73 74 72 61 74 |ple of r|egistrat|
|00000f10| 69 6f 6e 2e 20 54 68 65 | 20 6e 61 6d 65 73 20 6f |ion. The| names o|
|00000f20| 66 20 74 68 65 20 61 63 | 74 69 6f 6e 73 0a 61 72 |f the ac|tions.ar|
|00000f30| 65 20 6f 62 74 61 69 6e | 65 64 20 66 72 6f 6d 20 |e obtain|ed from |
|00000f40| 64 69 63 74 69 6f 6e 61 | 72 79 20 5c 63 6f 64 65 |dictiona|ry \code|
|00000f50| 7b 77 64 69 63 74 7d 2e | 20 43 6f 64 65 73 20 6e |{wdict}.| Codes n|
|00000f60| 6f 74 20 69 6e 20 74 68 | 69 73 20 64 69 63 74 69 |ot in th|is dicti|
|00000f70| 6f 6e 61 72 79 20 61 72 | 65 0a 69 67 6e 6f 72 65 |onary ar|e.ignore|
|00000f80| 64 2e 20 4e 6f 74 65 20 | 74 68 61 74 20 77 69 6d |d. Note |that wim|
|00000f90| 70 20 61 6e 64 20 74 6f | 6f 6c 62 6f 78 20 63 6f |p and to|olbox co|
|00000fa0| 64 65 73 20 75 73 65 20 | 74 68 65 20 73 61 6d 65 |des use |the same|
|00000fb0| 20 5c 63 6f 64 65 7b 61 | 63 74 69 6f 6e 73 7d 0a | \code{a|ctions}.|
|00000fc0| 20 64 69 63 74 69 6f 6e | 61 72 79 2e 20 54 68 69 | diction|ary. Thi|
|00000fd0| 73 20 6d 65 61 6e 73 20 | 74 68 65 79 20 6d 75 73 |s means |they mus|
|00000fe0| 74 20 68 61 76 65 20 7b | 5c 65 6d 20 64 69 66 66 |t have {|\em diff|
|00000ff0| 65 72 65 6e 74 20 65 76 | 65 6e 74 20 6e 75 6d 62 |erent ev|ent numb|
|00001000| 65 72 73 7d 2e 20 49 6e | 0a 20 20 70 72 61 63 74 |ers}. In|. pract|
|00001010| 69 63 65 20 74 68 69 73 | 20 6d 65 61 6e 73 20 6e |ice this| means n|
|00001020| 6f 74 20 67 69 76 69 6e | 67 20 6c 6f 77 20 6e 75 |ot givin|g low nu|
|00001030| 6d 62 65 72 73 20 74 6f | 20 75 73 65 72 20 64 65 |mbers to| user de|
|00001040| 66 69 6e 65 64 20 74 6f | 6f 6c 62 6f 78 20 65 76 |fined to|olbox ev|
|00001050| 65 6e 74 73 2e 0a 53 74 | 61 72 74 69 6e 67 20 75 |ents..St|arting u|
|00001060| 73 65 72 20 64 65 66 69 | 6e 65 64 20 6e 75 62 65 |ser defi|ned nube|
|00001070| 72 73 20 61 74 20 5c 63 | 6f 64 65 7b 30 78 31 30 |rs at \c|ode{0x10|
|00001080| 30 30 7d 20 69 73 20 61 | 20 73 61 66 65 20 72 75 |00} is a| safe ru|
|00001090| 6c 65 2e 0a 0a 4d 65 73 | 73 61 67 65 73 20 61 72 |le...Mes|sages ar|
|000010a0| 65 20 68 61 6e 64 6c 65 | 64 20 62 79 20 61 20 73 |e handle|d by a s|
|000010b0| 69 6e 67 6c 65 20 63 6c | 61 73 73 20 69 6e 73 74 |ingle cl|ass inst|
|000010c0| 61 6e 63 65 20 5c 63 6f | 64 65 7b 74 62 65 76 65 |ance \co|de{tbeve|
|000010d0| 6e 74 2e 6d 73 67 68 61 | 6e 64 6c 65 72 7d 0a 6d |nt.msgha|ndler}.m|
|000010e0| 65 74 68 6f 64 20 6e 61 | 6d 65 73 20 61 72 65 20 |ethod na|mes are |
|000010f0| 6c 6f 6f 6b 65 64 20 75 | 70 20 66 72 6f 6d 20 74 |looked u|p from t|
|00001100| 68 65 20 6d 65 73 73 61 | 67 65 20 6e 75 6d 62 65 |he messa|ge numbe|
|00001110| 72 20 69 6e 20 64 69 63 | 74 69 6f 6e 61 72 79 20 |r in dic|tionary |
|00001120| 5c 63 6f 64 65 7b 6d 64 | 69 63 74 7d 2e 0a 0a 46 |\code{md|ict}...F|
|00001130| 6f 72 20 65 78 61 6d 70 | 6c 65 20 68 65 72 65 20 |or examp|le here |
|00001140| 69 73 20 61 20 74 72 69 | 76 69 61 6c 20 6d 65 73 |is a tri|vial mes|
|00001150| 73 61 67 65 20 68 61 6e | 64 6c 69 6e 67 20 63 6c |sage han|dling cl|
|00001160| 61 73 73 20 74 68 61 74 | 20 6a 75 73 74 20 68 61 |ass that| just ha|
|00001170| 6e 64 6c 65 73 20 74 68 | 65 0a 71 75 69 74 20 6d |ndles th|e.quit m|
|00001180| 65 73 73 61 67 65 2e 0a | 0a 5c 62 65 67 69 6e 7b |essage..|.\begin{|
|00001190| 76 65 72 62 61 74 69 6d | 7d 0a 63 6c 61 73 73 20 |verbatim|}.class |
|000011a0| 4d 65 73 73 65 6e 67 65 | 72 3a 20 20 20 20 20 20 |Messenge|r: |
|000011b0| 20 20 20 20 20 20 20 20 | 20 20 23 54 68 69 73 20 | | #This |
|000011c0| 69 73 20 74 68 65 20 6d | 65 73 73 61 67 65 20 68 |is the m|essage h|
|000011d0| 61 6e 64 6c 65 72 20 63 | 6c 61 73 73 0a 20 20 20 |andler c|lass. |
|000011e0| 20 20 20 64 65 66 20 57 | 69 6d 70 5f 4d 51 75 69 | def W|imp_MQui|
|000011f0| 74 28 73 65 6c 66 29 3a | 0a 20 20 20 20 20 20 20 |t(self):|. |
|00001200| 20 20 20 65 78 69 74 28 | 29 0a 20 20 20 20 20 20 | exit(|). |
|00001210| 20 20 20 20 0a 74 62 65 | 76 65 6e 74 2e 6d 73 67 | .tbe|vent.msg|
|00001220| 68 61 6e 64 6c 65 72 3d | 4d 65 73 73 65 6e 67 65 |handler=|Messenge|
|00001230| 72 28 29 20 20 23 52 65 | 67 69 73 74 65 72 20 74 |r() #Re|gister t|
|00001240| 68 65 20 69 6e 73 74 61 | 6e 63 65 20 0a 5c 65 6e |he insta|nce .\en|
|00001250| 64 7b 76 65 72 62 61 74 | 69 6d 7d 0a 0a 54 6f 6f |d{verbat|im}..Too|
|00001260| 6c 62 6f 78 20 65 76 65 | 6e 74 20 6d 65 74 68 6f |lbox eve|nt metho|
|00001270| 64 73 20 63 61 6e 20 65 | 78 61 6d 69 6e 65 20 74 |ds can e|xamine t|
|00001280| 68 65 20 74 6f 6f 6c 62 | 6f 78 20 69 64 20 62 6c |he toolb|ox id bl|
|00001290| 6f 63 6b 20 61 73 20 5c | 76 61 72 7b 74 6f 6f 6c |ock as \|var{tool|
|000012a0| 62 6f 78 2e 69 64 62 6c | 6f 63 6b 7d 2e 0a 41 6c |box.idbl|ock}..Al|
|000012b0| 6c 20 6d 65 74 68 6f 64 | 73 20 63 61 6e 20 75 73 |l method|s can us|
|000012c0| 65 20 74 68 65 20 77 69 | 6d 70 20 70 6f 6c 6c 20 |e the wi|mp poll |
|000012d0| 62 6c 6f 63 6b 20 61 73 | 20 5c 76 61 72 7b 74 62 |block as| \var{tb|
|000012e0| 65 76 65 6e 74 2e 77 62 | 6c 6f 63 6b 7d 2e 0a 0a |event.wb|lock}...|
|000012f0| 0a 54 68 65 72 65 20 69 | 73 20 61 20 73 69 6d 70 |.There i|s a simp|
|00001300| 6c 65 20 73 79 73 74 65 | 6d 20 74 6f 20 61 73 73 |le syste|m to ass|
|00001310| 69 73 74 20 77 69 74 68 | 20 64 65 62 75 67 67 69 |ist with| debuggi|
|00001320| 6e 67 20 62 75 69 6c 74 | 20 69 6e 20 74 6f 20 5c |ng built| in to \|
|00001330| 63 6f 64 65 7b 74 62 65 | 76 65 6e 74 7d 2e 0a 54 |code{tbe|vent}..T|
|00001340| 68 65 20 66 75 6e 63 74 | 69 6f 6e 20 5c 63 6f 64 |he funct|ion \cod|
|00001350| 65 7b 74 62 65 76 65 6e | 74 2e 72 65 70 6f 72 74 |e{tbeven|t.report|
|00001360| 28 73 74 72 69 6e 67 2c | 5b 70 72 69 6f 72 69 74 |(string,|[priorit|
|00001370| 79 5d 29 7d 20 62 72 6f | 61 64 63 61 73 74 73 20 |y])} bro|adcasts |
|00001380| 61 20 77 69 6d 70 0a 6d | 65 73 73 61 67 65 20 63 |a wimp.m|essage c|
|00001390| 6f 6e 74 61 69 6e 69 6e | 67 20 74 68 65 20 73 74 |ontainin|g the st|
|000013a0| 72 69 6e 67 20 28 74 72 | 75 6e 63 61 74 65 64 20 |ring (tr|uncated |
|000013b0| 74 6f 20 32 30 30 20 63 | 68 61 72 61 63 74 65 72 |to 200 c|haracter|
|000013c0| 73 29 2e 20 54 68 65 20 | 61 70 70 6c 69 63 61 74 |s). The |applicat|
|000013d0| 69 6f 6e 0a 60 60 21 52 | 65 70 6f 72 74 65 72 27 |ion.``!R|eporter'|
|000013e0| 27 20 63 61 6e 20 64 69 | 73 70 6c 61 79 20 74 68 |' can di|splay th|
|000013f0| 65 73 65 20 6d 65 73 73 | 61 67 65 73 2e 20 4d 65 |ese mess|ages. Me|
|00001400| 73 73 61 67 65 73 20 61 | 72 65 20 6f 6e 6c 79 20 |ssages a|re only |
|00001410| 73 65 6e 74 20 69 66 0a | 5c 63 6f 64 65 7b 70 72 |sent if.|\code{pr|
|00001420| 69 6f 72 69 74 79 3c 3d | 74 62 65 76 65 6e 74 2e |iority<=|tbevent.|
|00001430| 75 73 65 72 65 70 6f 72 | 74 7d 2c 20 73 6f 20 64 |userepor|t}, so d|
|00001440| 65 62 75 67 67 69 6e 67 | 20 6d 65 73 73 61 67 65 |ebugging| message|
|00001450| 73 20 63 61 6e 20 62 65 | 20 73 75 70 70 72 65 73 |s can be| suppres|
|00001460| 73 65 64 0a 62 79 20 73 | 65 74 74 69 6e 67 20 74 |sed.by s|etting t|
|00001470| 68 69 73 20 76 61 72 69 | 61 62 6c 65 2e 20 5c 63 |his vari|able. \c|
|00001480| 6f 64 65 7b 70 72 69 6f | 72 69 74 79 7d 20 64 65 |ode{prio|rity} de|
|00001490| 66 61 75 6c 74 73 20 74 | 6f 20 31 36 2e 0a 5c 63 |faults t|o 16..\c|
|000014a0| 6f 64 65 7b 74 62 65 76 | 65 6e 74 2e 75 73 65 72 |ode{tbev|ent.user|
|000014b0| 65 70 6f 72 74 7d 20 69 | 73 20 69 6e 69 74 69 61 |eport} i|s initia|
|000014c0| 6c 6c 79 20 38 2e 20 5c | 63 6f 64 65 7b 74 62 65 |lly 8. \|code{tbe|
|000014d0| 76 65 6e 74 7d 20 67 65 | 6e 65 72 61 74 65 73 20 |vent} ge|nerates |
|000014e0| 73 6f 6d 65 0a 72 65 70 | 6f 72 74 73 20 69 74 73 |some.rep|orts its|
|000014f0| 65 6c 66 2c 20 65 72 72 | 6f 72 20 72 65 70 6f 72 |elf, err|or repor|
|00001500| 74 73 20 77 69 74 68 20 | 70 72 69 6f 72 69 74 79 |ts with |priority|
|00001510| 20 32 2c 20 61 6e 64 20 | 72 65 70 6f 72 74 73 20 | 2, and |reports |
|00001520| 6f 66 20 61 6c 6c 20 65 | 76 65 6e 74 73 0a 77 69 |of all e|vents.wi|
|00001530| 74 68 20 70 72 69 6f 72 | 69 74 79 20 33 32 2e 0a |th prior|ity 32..|
|00001540| 0a 0a | |.. | |
+--------+-------------------------+-------------------------+--------+--------+