home *** CD-ROM | disk | FTP | other *** search
Unknown | 1993-06-20 | 24.6 KB |
open in:
MacOS 8.1
|
Win98
|
DOS
view JSON data
|
view as text
This file was not able to be converted.
This format is not currently supported by dexvert.
Confidence | Program | Detection | Match Type | Support
|
---|
66%
| dexvert
| Wanton Packer Module (music/wantonPacker)
| ext
| Supported |
100%
| file
| data
| default
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 00 00 00 00 00 00 01 | 04 00 61 68 04 00 62 30 |........|..ah..b0|
|00000010| 04 00 02 14 04 00 02 0c | 04 00 02 16 00 05 47 c8 |........|......G.|
|00000020| 00 1e 2d e8 00 1e 2d 84 | 00 1e 2d 48 00 05 49 18 |..-...-.|..-H..I.|
|00000030| 00 00 00 00 00 00 00 00 | 00 05 00 00 00 00 00 00 |........|........|
|00000040| 09 00 00 00 00 00 00 ff | 00 00 00 00 01 00 ff 66 |........|.......f|
|00000050| 00 00 01 ae 02 64 00 00 | 00 9a 00 2b 22 2d 00 cd |.....d..|...+"-..|
|00000060| 23 06 01 cc 00 39 00 00 | 00 00 ff 00 00 00 00 00 |#....9..|........|
|00000070| 00 00 00 00 00 00 01 01 | 02 64 00 00 00 48 00 48 |........|.d...H.H|
|00000080| 00 01 00 18 03 18 02 64 | 00 00 00 00 02 da 02 2f |.......d|......./|
|00000090| 00 64 00 04 19 00 04 00 | 5e 3d 00 0a ff b7 00 5a |.d......|^=.....Z|
|000000a0| 00 2a 04 00 5e 3d 00 0a | ff b7 00 5a 00 2a fc 71 |.*..^=..|...Z.*.q|
|000000b0| 00 00 18 75 00 00 00 00 | ff 00 00 00 00 00 00 00 |...u....|........|
|000000c0| 62 4a 00 00 62 4a 00 00 | 62 4a 00 00 7f 80 00 00 |bJ..bJ..|bJ......|
|000000d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000100| 00 00 00 00 04 00 60 7d | 04 00 5e 23 04 00 02 14 |......`}|..^#....|
|00000110| 04 00 02 0c 04 00 02 16 | 00 1e 2d 90 00 1e 2d c0 |........|..-...-.|
|00000120| 00 1e 2d b4 00 05 47 e8 | 00 1e 2e 88 00 00 00 00 |..-...G.|........|
|00000130| 00 00 00 00 00 04 00 00 | 00 00 00 00 09 00 00 00 |........|........|
|00000140| 00 00 00 ff 00 00 00 00 | 01 00 ff 66 00 00 01 ae |........|...f....|
|00000150| 02 64 00 00 00 9a 00 2b | 22 2d 00 cd 23 06 01 cc |.d.....+|"-..#...|
|00000160| 00 39 00 00 00 00 ff 00 | 00 00 00 00 00 00 00 00 |.9......|........|
|00000170| 00 00 01 01 02 64 00 00 | 00 48 00 48 00 01 00 18 |.....d..|.H.H....|
|00000180| 03 18 02 64 00 00 00 00 | 02 da 02 2f 00 64 00 04 |...d....|.../.d..|
|00000190| 19 00 04 00 5e 3d 00 0a | ff b7 00 5a 00 2a 04 00 |....^=..|...Z.*..|
|000001a0| 5e 3d 00 0a ff b7 00 5a | 00 2a fc 71 00 00 17 70 |^=.....Z|.*.q...p|
|000001b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 61 45 00 00 |........|....aE..|
|000001c0| 61 45 00 00 61 45 00 00 | 7f 80 00 00 00 00 00 00 |aE..aE..|........|
|000001d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000200| 00 04 0d 0d 0d 0d 00 04 | 0d 0d 0d 0d 00 06 00 08 |........|........|
|00000210| 00 00 00 00 00 00 00 78 | 00 03 00 00 00 48 00 48 |.......x|.....H.H|
|00000220| 00 00 00 00 02 da 02 2f | 00 00 00 00 03 18 02 64 |......./|.......d|
|00000230| 01 5b 05 28 03 fc 00 02 | 00 00 00 48 00 48 00 00 |.[.(....|...H.H..|
|00000240| 00 00 03 18 02 64 00 01 | 00 00 00 64 00 00 00 01 |.....d..|...d....|
|00000250| 00 01 01 01 00 00 00 01 | 27 0f 00 01 00 01 00 00 |........|'.......|
|00000260| 00 00 00 00 00 00 00 00 | 00 00 00 02 00 19 01 90 |........|........|
|00000270| 00 00 00 00 00 40 00 00 | 00 00 00 00 00 00 00 00 |.....@..|........|
|00000280| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000290| 00 21 0d 50 61 67 65 20 | 32 2d fd 00 f7 20 20 20 |.!.Page |2-... |
|000002a0| 20 20 20 20 fd 01 f7 20 | 20 20 20 20 20 20 fd 02 | ... | ..|
|000002b0| f7 0d 0d 00 21 fb 00 00 | 00 01 00 db 01 01 43 68 |....!...|......Ch|
|000002c0| 33 2e 74 65 78 74 6f 75 | 74 2e 32 36 33 34 39 33 |3.textou|t.263493|
|000002d0| 2e 65 70 73 f7 0d 01 8d | 0d fc 00 90 02 0a 00 90 |.eps....|........|
|000002e0| 00 0e 02 1c 06 30 f7 0d | 43 72 65 61 74 65 20 61 |.....0..|Create a|
|000002f0| 6e 20 6f 75 74 6c 65 74 | 20 66 6f 72 20 4d 79 48 |n outlet| for MyH|
|00000300| 65 6c 6c 6f 43 6c 61 73 | 73 20 75 73 69 6e 67 20 |elloClas|s using |
|00000310| 74 68 65 20 69 6e 73 70 | 65 63 74 6f 72 20 70 61 |the insp|ector pa|
|00000320| 6e 65 6c 2e 20 20 43 61 | 6c 6c 20 69 74 20 74 65 |nel. Ca|ll it te|
|00000330| 78 74 4f 75 74 6c 65 74 | 2e 20 20 54 68 69 73 20 |xtOutlet|. This |
|00000340| 69 73 20 69 64 65 6e 74 | 69 61 6c 20 74 6f 20 63 |is ident|ial to c|
|00000350| 72 65 61 74 69 6e 67 20 | 61 6e 20 61 63 74 69 6f |reating |an actio|
|00000360| 6e 20 77 69 74 68 20 74 | 68 65 20 65 78 63 65 70 |n with t|he excep|
|00000370| 74 69 6f 6e 20 74 68 61 | 74 20 74 68 65 20 6f 75 |tion tha|t the ou|
|00000380| 74 6c 65 74 20 69 73 20 | 73 65 6c 65 63 74 65 64 |tlet is |selected|
|00000390| 20 69 6e 73 74 65 61 64 | 20 6f 66 20 61 6e 20 61 | instead| of an a|
|000003a0| 63 74 69 6f 6e 2e 20 20 | 4d 61 6b 65 20 61 20 63 |ction. |Make a c|
|000003b0| 6f 6e 6e 65 63 74 69 6f | 6e 20 66 72 6f 6d 20 74 |onnectio|n from t|
|000003c0| 68 65 20 69 6e 73 74 61 | 6e 63 65 20 6f 66 20 74 |he insta|nce of t|
|000003d0| 68 65 20 6f 62 6a 65 63 | 74 20 74 6f 20 74 68 65 |he objec|t to the|
|000003e0| 20 46 6f 72 6d 20 28 6e | 6f 74 65 20 74 68 61 74 | Form (n|ote that|
|000003f0| 20 74 68 69 73 20 69 73 | 20 74 68 65 20 6f 70 70 | this is| the opp|
|00000400| 6f 73 69 74 65 20 64 69 | 72 65 63 74 69 6f 6e 20 |osite di|rection |
|00000410| 74 68 61 74 20 77 65 20 | 75 73 65 64 20 77 68 65 |that we |used whe|
|00000420| 6e 20 77 65 20 6d 61 64 | 65 20 61 20 63 6f 6e 6e |n we mad|e a conn|
|00000430| 65 63 74 69 6f 6e 20 66 | 72 6f 6d 20 74 68 65 20 |ection f|rom the |
|00000440| 62 75 74 74 6f 6e 20 74 | 6f 20 49 6e 73 74 61 6e |button t|o Instan|
|00000450| 63 65 20 6f 66 20 4d 79 | 48 65 6c 6c 6f 43 6c 61 |ce of My|HelloCla|
|00000460| 73 73 29 2e 0d 02 ba 0d | ff 00 15 0a 01 f7 53 74 |ss).....|......St|
|00000470| 65 70 20 32 3a ff 00 15 | 0a 00 f7 20 41 64 64 20 |ep 2:...|... Add |
|00000480| 74 68 65 20 66 6f 6c 6c | 6f 77 69 6e 67 20 6c 69 |the foll|owing li|
|00000490| 6e 65 20 74 6f 20 74 68 | 65 20 4d 79 56 69 65 77 |ne to th|e MyView|
|000004a0| 43 6c 61 73 73 2e 68 20 | 66 69 6c 65 3a 0d 0d 0d |Class.h |file:...|
|000004b0| fc 00 b4 02 0a 00 b4 00 | 0e 03 64 06 30 f7 ff 00 |........|..d.0...|
|000004c0| 16 0a 00 f7 2f 2a 20 47 | 65 6e 65 72 61 74 65 64 |..../* G|enerated|
|000004d0| 20 62 79 20 49 6e 74 65 | 72 66 61 63 65 20 42 75 | by Inte|rface Bu|
|000004e0| 69 6c 64 65 72 20 2a 2f | 0d 0d 23 69 6d 70 6f 72 |ilder */|..#impor|
|000004f0| 74 20 3c 6f 62 6a 63 2f | 4f 62 6a 65 63 74 2e 68 |t <objc/|Object.h|
|00000500| 3e 0d 0d 40 69 6e 74 65 | 72 66 61 63 65 20 4d 79 |>..@inte|rface My|
|00000510| 4f 62 6a 65 63 74 3a 4f | 62 6a 65 63 74 0d 7b 0d |Object:O|bject.{.|
|00000520| 20 20 20 20 69 64 09 74 | 65 78 74 4f 75 74 6c 65 | id.t|extOutle|
|00000530| 74 3b 0d 20 20 20 20 ff | 00 16 0a 01 f7 63 68 61 |t;. .|.....cha|
|00000540| 72 20 6d 79 53 74 72 69 | 6e 67 5b 31 30 30 30 30 |r myStri|ng[10000|
|00000550| 5d 3b ff 00 16 0a 00 f7 | 0d 7d 0d 0d 2d 20 73 65 |];......|.}..- se|
|00000560| 74 54 65 78 74 4f 75 74 | 6c 65 74 3a 61 6e 4f 62 |tTextOut|let:anOb|
|00000570| 6a 65 63 74 3b 0d 2d 20 | 62 75 74 74 6f 6e 41 63 |ject;.- |buttonAc|
|00000580| 74 69 6f 6e 3a 73 65 6e | 64 65 72 3b 0d 0d 40 65 |tion:sen|der;..@e|
|00000590| 6e 64 0d ff 00 15 0a 00 | f7 fc 00 90 02 0a 00 90 |nd......|........|
|000005a0| 00 0e 02 1c 06 30 f7 0d | 54 68 69 73 20 77 69 6c |.....0..|This wil|
|000005b0| 6c 20 63 72 65 61 74 65 | 20 61 6e 20 69 6e 73 74 |l create| an inst|
|000005c0| 61 6e 63 65 20 76 61 72 | 69 61 62 6c 65 20 6f 66 |ance var|iable of|
|000005d0| 20 74 79 70 65 20 63 68 | 61 72 61 63 74 65 72 20 | type ch|aracter |
|000005e0| 77 68 69 63 68 20 77 69 | 6c 6c 20 62 65 20 61 20 |which wi|ll be a |
|000005f0| 72 65 67 69 6f 6e 20 69 | 6e 20 6d 65 6d 6f 72 79 |region i|n memory|
|00000600| 20 74 68 61 74 20 79 6f | 75 20 63 61 6e 20 77 72 | that yo|u can wr|
|00000610| 69 74 65 20 74 68 65 20 | 73 74 72 69 6e 67 20 74 |ite the |string t|
|00000620| 6f 2e 20 20 4e 6f 74 65 | 20 74 68 61 74 20 69 6e |o. Note| that in|
|00000630| 20 74 68 69 73 20 65 78 | 61 6d 70 6c 65 20 49 20 | this ex|ample I |
|00000640| 70 72 65 2d 61 6c 6c 6f | 63 61 74 65 64 20 31 30 |pre-allo|cated 10|
|00000650| 30 30 30 20 63 68 61 72 | 61 63 74 65 72 73 20 74 |000 char|acters t|
|00000660| 6f 20 70 72 69 6e 74 20 | 74 6f 2e 20 20 54 68 69 |o print |to. Thi|
|00000670| 73 20 73 68 6f 75 6c 64 | 20 62 65 20 72 65 70 6c |s should| be repl|
|00000680| 61 63 65 64 20 77 69 74 | 68 20 61 20 72 6f 75 74 |aced wit|h a rout|
|00000690| 69 6e 65 20 74 68 61 74 | 20 77 69 6c 6c 20 64 79 |ine that| will dy|
|000006a0| 6e 61 6d 69 63 61 6c 6c | 79 20 61 6c 6c 6f 63 61 |namicall|y alloca|
|000006b0| 74 65 20 6d 65 6d 6f 72 | 79 20 66 6f 72 20 61 20 |te memor|y for a |
|000006c0| 72 65 61 6c 20 70 72 6f | 64 75 63 74 69 6f 6e 20 |real pro|duction |
|000006d0| 70 72 6f 67 72 61 6d 2e | 0d 0d ff 00 15 0a 01 f7 |program.|........|
|000006e0| 53 74 65 70 20 33 ff 00 | 15 0a 00 f7 3a 20 41 64 |Step 3..|....: Ad|
|000006f0| 64 20 74 68 65 20 66 6f | 6c 6c 6f 77 69 6e 67 20 |d the fo|llowing |
|00000700| 6c 69 6e 65 73 20 74 6f | 20 74 68 65 20 4d 79 56 |lines to| the MyV|
|00000710| 69 65 77 43 6c 61 73 73 | 2e 6d 20 66 69 6c 65 3a |iewClass|.m file:|
|00000720| 0d 02 96 fc 00 90 02 0a | 00 90 00 0e 02 d4 06 30 |........|.......0|
|00000730| f7 09 0d fc 00 b4 02 0a | 00 b4 00 0e 03 64 06 30 |........|.....d.0|
|00000740| f7 ff 00 16 0a 00 f7 2f | 2a 20 47 65 6e 65 72 61 |......./|* Genera|
|00000750| 74 65 64 20 62 79 20 49 | 6e 74 65 72 66 61 63 65 |ted by I|nterface|
|00000760| 20 42 75 69 6c 64 65 72 | 20 2a 2f 0d 0d 23 69 6d | Builder| */..#im|
|00000770| 70 6f 72 74 20 22 4d 79 | 4f 62 6a 65 63 74 2e 68 |port "My|Object.h|
|00000780| 22 0d ff 00 16 0a 01 f7 | 23 69 6d 70 6f 72 74 20 |".......|#import |
|00000790| 3c 61 70 70 6b 69 74 2f | 43 6f 6e 74 72 6f 6c 2e |<appkit/|Control.|
|000007a0| 68 3e 0d 23 69 6d 70 6f | 72 74 20 3c 73 74 72 69 |h>.#impo|rt <stri|
|000007b0| 6e 67 73 2e 68 3e 0d ff | 00 16 0a 00 f7 0d 40 69 |ngs.h>..|......@i|
|000007c0| 6d 70 6c 65 6d 65 6e 74 | 61 74 69 6f 6e 20 4d 79 |mplement|ation My|
|000007d0| 4f 62 6a 65 63 74 0d fc | 00 b4 02 0a 00 b4 00 0e |Object..|........|
|000007e0| 03 3c 06 30 f7 0d 2d 20 | 62 75 74 74 6f 6e 41 63 |.<.0..- |buttonAc|
|000007f0| 74 69 6f 6e 3a 73 65 6e | 64 65 72 0d 7b 0d 09 ff |tion:sen|der.{...|
|00000800| 00 16 0a 01 f7 73 74 72 | 63 61 74 28 6d 79 53 74 |.....str|cat(mySt|
|00000810| 72 69 6e 67 2c 20 22 68 | 65 6c 6c 6f 2c 20 77 6f |ring, "h|ello, wo|
|00000820| 72 6c 64 5c 6e 22 29 3b | 0d 09 5b 74 65 78 74 4f |rld\n");|..[textO|
|00000830| 75 74 6c 65 74 20 73 65 | 74 53 74 72 69 6e 67 56 |utlet se|tStringV|
|00000840| 61 6c 75 65 3a 6d 79 53 | 74 72 69 6e 67 5d 3b 0d |alue:myS|tring];.|
|00000850| 09 ff 00 16 0a 00 f7 72 | 65 74 75 72 6e 20 73 65 |.......r|eturn se|
|00000860| 6c 66 3b 0d fc 00 b4 02 | 0a 00 b4 00 0e 03 64 06 |lf;.....|......d.|
|00000870| 30 f7 7d 0d 0d 0d 40 65 | 6e 64 0d 0d fc 00 91 02 |0.}...@e|nd......|
|00000880| 0a 00 91 00 0e 03 64 06 | 30 f7 ff 00 15 0a 00 f7 |......d.|0.......|
|00000890| 54 68 65 20 66 75 6e 63 | 74 69 6f 6e 20 ff 00 16 |The func|tion ...|
|000008a0| 0a 00 f7 73 74 72 63 61 | 74 ff 00 15 0a 00 f7 20 |...strca|t...... |
|000008b0| 77 69 6c 6c 20 63 6f 6e | 63 61 74 69 6e 61 74 65 |will con|catinate|
|000008c0| 20 74 68 65 20 73 74 72 | 69 6e 67 20 22 68 65 6c | the str|ing "hel|
|000008d0| 6c 6f 2c 20 77 6f 72 6c | 64 22 20 20 74 6f 20 74 |lo, worl|d" to t|
|000008e0| 68 65 20 65 6e 64 20 6f | 66 20 74 68 65 20 73 74 |he end o|f the st|
|000008f0| 72 69 6e 67 20 6d 79 53 | 74 72 69 6e 67 20 65 76 |ring myS|tring ev|
|00000900| 65 72 79 20 74 69 6d 65 | 20 79 6f 75 20 70 72 65 |ery time| you pre|
|00000910| 73 73 20 74 68 65 20 62 | 75 74 74 6f 6e 2e 20 20 |ss the b|utton. |
|00000920| 4e 6f 74 65 20 74 68 61 | 74 20 74 68 69 73 20 61 |Note tha|t this a|
|00000930| 73 73 75 6d 65 73 20 74 | 68 61 74 20 6d 79 53 74 |ssumes t|hat mySt|
|00000940| 72 69 6e 67 20 69 73 20 | 6e 75 6c 6c 20 6f 72 20 |ring is |null or |
|00000950| 65 6d 70 74 79 20 77 68 | 65 6e 20 74 68 65 20 70 |empty wh|en the p|
|00000960| 72 6f 67 72 61 6d 20 73 | 74 61 72 74 73 20 75 70 |rogram s|tarts up|
|00000970| 2e 20 20 4e 6f 74 20 61 | 6c 77 61 79 73 20 61 20 |. Not a|lways a |
|00000980| 67 6f 6f 64 20 61 73 73 | 75 6d 70 74 69 6f 6e 20 |good ass|umption |
|00000990| 62 75 74 20 69 74 20 73 | 65 65 6d 73 20 74 6f 20 |but it s|eems to |
|000009a0| 77 6f 72 6b 20 69 6e 20 | 74 68 69 73 20 63 61 73 |work in |this cas|
|000009b0| 65 2e ff 00 16 0a 00 f7 | 0d 00 59 0d ff 00 15 0a |e.......|..Y.....|
|000009c0| 00 f7 4f 62 6a 65 63 74 | 20 42 61 73 65 64 20 43 |..Object| Based C|
|000009d0| 6f 6d 70 75 74 69 6e 67 | 3a 20 41 20 4e 65 78 74 |omputing|: A Next|
|000009e0| 53 74 65 70 20 54 75 74 | 6f 72 69 61 6c 20 61 6e |Step Tut|orial an|
|000009f0| 64 20 43 6f 6f 6b 62 6f | 6f 6b 20 2d 20 44 47 4d |d Cookbo|ok - DGM|
|00000a00| 0d 43 68 61 70 74 65 72 | 20 36 3a 20 45 76 65 6e |.Chapter| 6: Even|
|00000a10| 74 73 0d 0d 00 18 04 00 | 02 00 00 38 04 00 02 06 |ts......|...8....|
|00000a20| 00 38 24 00 09 b9 00 38 | 04 00 02 90 00 2a 00 2d |.8$....8|.....*.-|
|00000a30| fc 00 5a 02 0a 00 5a 02 | 0e 01 b0 06 30 f7 fb 00 |..Z...Z.|....0...|
|00000a40| 00 00 01 01 06 00 cb 43 | 68 30 36 2e 68 69 6c 6f |.......C|h06.hilo|
|00000a50| 2e 39 34 38 39 30 37 2e | 65 70 73 f7 0d 02 3f f5 |.948907.|eps...?.|
|00000a60| f6 ff 00 15 24 01 f7 43 | 68 61 70 74 65 72 20 36 |....$..C|hapter 6|
|00000a70| 3a 20 45 76 65 6e 74 73 | 20 2d 20 4f 75 74 6c 65 |: Events| - Outle|
|00000a80| 74 73 20 66 6f 72 20 79 | 6f 75 72 20 46 72 75 73 |ts for y|our Frus|
|00000a90| 74 72 61 74 69 6f 6e 73 | ff 00 15 0c 00 f7 0d 0d |trations|........|
|00000aa0| 0d 0d 0d 0d 0d 0d 0d 0d | ff 00 15 0c 02 f7 0d 0d |........|........|
|00000ab0| ff 00 15 24 01 f7 0d ff | 00 15 18 01 f7 ff 00 15 |...$....|........|
|00000ac0| 0c 02 f7 0d fc 00 7e 01 | e6 00 7e 00 0e 02 b0 06 |......~.|..~.....|
|00000ad0| 30 f7 49 74 20 74 6f 6f | 6b 20 6d 65 20 61 20 79 |0.It too|k me a y|
|00000ae0| 65 61 72 20 74 6f 20 6c | 65 61 72 6e 20 74 6f 20 |ear to l|earn to |
|00000af0| 63 72 65 61 74 65 20 61 | 20 73 6d 61 6c 6c 20 70 |create a| small p|
|00000b00| 72 6f 67 72 61 6d 20 77 | 69 74 68 20 5b 6d 79 20 |rogram w|ith [my |
|00000b10| 70 72 65 76 69 6f 75 73 | 20 73 79 73 74 65 6d 5d |previous| system]|
|00000b20| 2e 20 20 49 20 77 61 73 | 20 76 65 72 79 20 66 72 |. I was| very fr|
|00000b30| 75 73 74 72 61 74 65 64 | 20 74 68 61 74 20 6a 75 |ustrated| that ju|
|00000b40| 73 74 20 74 6f 20 63 72 | 65 61 74 65 20 61 20 73 |st to cr|eate a s|
|00000b50| 6d 61 6c 6c 20 70 72 6f | 67 72 61 6d 20 74 6f 6f |mall pro|gram too|
|00000b60| 6b 20 6d 65 20 73 65 76 | 65 72 61 6c 20 64 61 79 |k me sev|eral day|
|00000b70| 73 20 61 6e 64 20 74 68 | 6f 75 73 61 6e 64 73 20 |s and th|ousands |
|00000b80| 6f 66 20 6c 69 6e 65 73 | 20 6f 66 20 63 6f 64 65 |of lines| of code|
|00000b90| 2e 20 20 43 68 61 6e 67 | 69 6e 67 20 6f 6e 65 20 |. Chang|ing one |
|00000ba0| 73 6d 61 6c 6c 20 66 65 | 61 74 75 72 65 20 69 6e |small fe|ature in|
|00000bb0| 20 61 6e 20 6f 6c 64 20 | 70 72 6f 67 72 61 6d 20 | an old |program |
|00000bc0| 77 61 73 20 61 20 64 61 | 79 20 6c 6f 6e 67 20 74 |was a da|y long t|
|00000bd0| 61 73 6b 2e 20 20 54 68 | 65 6e 20 49 20 73 74 61 |ask. Th|en I sta|
|00000be0| 72 74 65 64 20 75 73 69 | 6e 67 20 4e 65 58 54 73 |rted usi|ng NeXTs|
|00000bf0| 74 65 70 2e 20 20 49 6e | 20 6f 6e 65 20 77 65 65 |tep. In| one wee|
|00000c00| 6b 20 49 20 77 61 73 20 | 64 6f 69 6e 67 20 69 6e |k I was |doing in|
|00000c10| 20 6d 6f 72 65 20 69 6e | 20 61 20 64 6f 7a 65 6e | more in| a dozen|
|00000c20| 20 6c 69 6e 65 73 20 74 | 68 65 6e 20 49 20 63 6f | lines t|hen I co|
|00000c30| 75 6c 64 20 62 65 66 6f | 72 65 20 69 6e 20 61 20 |uld befo|re in a |
|00000c40| 74 68 6f 75 73 61 6e 64 | 20 6c 69 6e 65 73 20 6f |thousand| lines o|
|00000c50| 66 20 63 6f 64 65 2e 20 | 20 57 68 79 20 64 69 64 |f code. | Why did|
|00000c60| 6e 27 74 20 5b 6d 79 20 | 70 72 65 76 69 6f 75 73 |n't [my |previous|
|00000c70| 20 63 6f 6d 70 75 74 65 | 72 20 76 65 6e 64 6f 72 | compute|r vendor|
|00000c80| 5d 20 64 6f 20 74 68 69 | 73 20 69 6e 20 74 68 65 |] do thi|s in the|
|00000c90| 20 66 69 72 73 74 20 70 | 6c 61 63 65 3f 0d 00 21 | first p|lace?..!|
|00000ca0| fb 00 00 00 01 00 75 00 | 9f 43 68 36 2e 69 6e 63 |......u.|.Ch6.inc|
|00000cb0| 5f 64 65 63 2e 32 32 36 | 33 35 37 2e 65 70 73 f7 |_dec.226|357.eps.|
|00000cc0| 0d 03 1f fc 00 90 02 0a | 00 6c 00 0e 06 30 f7 0d |........|.l...0..|
|00000cd0| 0d 20 20 20 33 29 20 43 | 72 65 61 74 65 20 61 20 |. 3) C|reate a |
|00000ce0| 73 75 62 63 6c 61 73 73 | 20 6f 66 20 74 68 65 20 |subclass| of the |
|00000cf0| ff 00 16 0a 01 f7 4f 62 | 6a 65 63 74 ff 00 15 0a |......Ob|ject....|
|00000d00| 00 f7 20 63 6c 61 73 73 | 20 75 73 69 6e 67 20 74 |.. class| using t|
|00000d10| 68 65 20 63 6c 61 73 73 | 20 65 64 69 74 6f 72 20 |he class| editor |
|00000d20| 61 6e 64 20 74 68 65 20 | 63 72 65 61 74 65 20 61 |and the |create a|
|00000d30| 6e 20 69 6e 73 74 61 6e | 63 65 20 6f 66 20 74 68 |n instan|ce of th|
|00000d40| 61 74 20 6f 62 6a 65 63 | 74 20 75 73 69 6e 67 20 |at objec|t using |
|00000d50| 74 68 65 20 22 49 6e 73 | 74 61 6e 74 69 61 74 65 |the "Ins|tantiate|
|00000d60| 22 20 6d 65 6e 75 20 73 | 65 6c 65 63 74 69 6f 6e |" menu s|election|
|00000d70| 2e 0d 0d 20 20 34 29 20 | 57 69 74 68 20 74 68 65 |... 4) |With the|
|00000d80| 20 69 6e 73 74 61 6e 63 | 65 20 6f 66 20 6f 62 6a | instanc|e of obj|
|00000d90| 65 63 74 20 73 65 6c 65 | 63 74 65 64 20 28 74 68 |ect sele|cted (th|
|00000da0| 65 20 73 70 68 65 72 65 | 20 6c 6f 77 65 72 20 6c |e sphere| lower l|
|00000db0| 65 66 74 20 77 69 6e 64 | 6f 77 20 6d 75 73 74 20 |eft wind|ow must |
|00000dc0| 62 65 20 73 65 6c 65 63 | 74 65 64 29 20 62 72 69 |be selec|ted) bri|
|00000dd0| 6e 67 20 75 70 20 74 68 | 65 20 49 6e 73 70 65 63 |ng up th|e Inspec|
|00000de0| 74 6f 72 20 28 73 65 6c | 65 63 74 20 57 69 6e 64 |tor (sel|ect Wind|
|00000df0| 6f 77 73 2f 49 6e 73 70 | 65 63 74 6f 72 20 66 72 |ows/Insp|ector fr|
|00000e00| 6f 6d 20 74 68 65 20 6d | 61 69 6e 20 49 42 20 6d |om the m|ain IB m|
|00000e10| 65 75 6e 29 20 61 6e 64 | 20 61 64 64 20 74 68 65 |eun) and| add the|
|00000e20| 20 66 6f 6c 6c 6f 77 69 | 6e 67 20 61 63 74 69 6f | followi|ng actio|
|00000e30| 6e 73 20 75 73 69 6e 67 | 20 74 68 65 20 ff 00 16 |ns using| the ...|
|00000e40| 0a 01 f7 63 6c 61 73 73 | ff 00 15 0a 00 f7 20 70 |...class|...... p|
|00000e50| 6f 70 2d 75 70 20 6c 69 | 73 74 3a 0d 0d fc 00 b3 |op-up li|st:.....|
|00000e60| 02 0a 00 8f 00 0e 06 30 | f7 09 ff 00 16 0a 00 f7 |.......0|........|
|00000e70| 69 6e 63 72 65 6d 65 6e | 74 42 75 74 74 6f 6e 0d |incremen|tButton.|
|00000e80| 09 64 65 63 72 65 6d 65 | 6e 74 42 75 74 74 6f 6e |.decreme|ntButton|
|00000e90| 0d ff 00 15 0a 00 f7 fc | 00 90 02 0a 00 6c 00 0e |........|.....l..|
|00000ea0| 06 30 f7 0d 20 20 20 35 | 29 20 43 6f 6e 6e 65 63 |.0.. 5|) Connec|
|00000eb0| 74 20 74 68 65 20 62 75 | 74 74 6f 6e 73 20 74 6f |t the bu|ttons to|
|00000ec0| 20 74 68 65 20 69 6e 73 | 74 61 6e 63 65 20 6f 66 | the ins|tance of|
|00000ed0| 20 74 68 65 20 6f 62 6a | 65 63 74 20 62 79 20 43 | the obj|ect by C|
|00000ee0| 4f 4e 54 52 4f 4c 2f 43 | 4c 49 43 4b 69 6e 67 20 |ONTROL/C|LICKing |
|00000ef0| 66 72 6f 6d 20 74 68 65 | 20 62 75 74 74 6f 6e 73 |from the| buttons|
|00000f00| 20 74 6f 20 74 68 65 20 | 67 65 6e 65 72 69 63 20 | to the |generic |
|00000f10| 6f 62 6a 65 63 74 20 69 | 63 6f 6e 20 6c 61 62 65 |object i|con labe|
|00000f20| 6c 65 64 20 ff 00 16 0a | 01 f7 4d 79 4f 62 6a 65 |led ....|..MyObje|
|00000f30| 63 74 31 ff 00 15 0a 00 | f7 20 20 69 6e 20 74 68 |ct1.....|. in th|
|00000f40| 65 20 6c 6f 77 65 72 20 | 6c 65 66 74 20 68 61 6e |e lower |left han|
|00000f50| 64 20 63 6f 72 6e 65 72 | 20 6f 66 20 74 68 65 20 |d corner| of the |
|00000f60| 73 63 72 65 65 6e 2e 20 | 20 43 6f 6e 6e 65 63 74 |screen. | Connect|
|00000f70| 20 74 68 65 20 22 69 6e | 63 72 65 6d 65 6e 74 22 | the "in|crement"|
|00000f80| 20 62 75 74 74 6f 6e 20 | 74 6f 20 74 68 65 20 69 | button |to the i|
|00000f90| 6e 63 72 65 6d 65 6e 74 | 42 75 74 74 6f 6e 20 61 |ncrement|Button a|
|00000fa0| 63 74 69 6f 6e 20 61 6e | 64 20 74 68 65 20 22 64 |ction an|d the "d|
|00000fb0| 65 63 72 65 6d 65 6e 74 | 22 20 62 75 74 74 6f 6e |ecrement|" button|
|00000fc0| 20 74 6f 20 74 68 65 20 | 22 64 65 63 72 65 6d 65 | to the |"decreme|
|00000fd0| 6e 74 42 75 74 74 6f 6e | 22 20 61 63 74 69 6f 6e |ntButton|" action|
|00000fe0| 2e 0d 02 14 fc 00 91 02 | 0a 00 6c 00 0e 06 30 f7 |........|..l...0.|
|00000ff0| 0d 36 29 20 53 61 76 65 | 20 74 68 65 20 49 6e 74 |.6) Save| the Int|
|00001000| 65 72 66 61 63 65 20 62 | 75 69 6c 64 65 72 20 66 |erface b|uilder f|
|00001010| 69 6c 65 20 61 6e 64 20 | 63 72 65 61 74 65 20 61 |ile and |create a|
|00001020| 20 70 72 6f 6a 65 63 74 | 20 66 69 6c 65 20 6c 69 | project| file li|
|00001030| 6b 65 20 69 6e 20 63 68 | 61 70 74 65 72 20 33 2e |ke in ch|apter 3.|
|00001040| 20 20 57 69 74 68 20 4d | 79 4f 6a 65 63 74 20 73 | With M|yOject s|
|00001050| 65 6c 65 63 74 65 64 20 | 75 73 65 20 74 68 65 20 |elected |use the |
|00001060| ff 00 16 0a 01 f7 75 6e | 70 61 72 73 65 ff 00 15 |......un|parse...|
|00001070| 0a 00 f7 20 63 6f 6d 6d | 61 6e 64 20 61 6e 64 20 |... comm|and and |
|00001080| 65 6e 74 65 72 20 59 65 | 73 20 77 68 65 6e 20 69 |enter Ye|s when i|
|00001090| 74 20 61 73 6b 73 20 79 | 6f 75 20 69 66 20 79 6f |t asks y|ou if yo|
|000010a0| 75 20 77 61 6e 74 20 74 | 6f 20 61 64 64 20 69 74 |u want t|o add it|
|000010b0| 20 74 6f 20 74 68 65 20 | 70 72 6f 6a 65 63 74 20 | to the |project |
|000010c0| 6d 61 6e 61 67 65 72 2e | 0d 0d fc 00 6c 02 0a 00 |manager.|....l...|
|000010d0| 6c 00 0e 02 1c 06 30 f7 | 37 29 20 41 64 64 20 74 |l.....0.|7) Add t|
|000010e0| 68 65 20 66 6f 6c 6c 6f | 77 69 6e 67 20 6c 69 6e |he follo|wing lin|
|000010f0| 65 20 28 69 6e 20 62 6f | 6c 64 29 20 69 6e 20 74 |e (in bo|ld) in t|
|00001100| 68 65 20 4d 79 48 65 6c | 6c 6f 43 6c 61 73 73 2e |he MyHel|loClass.|
|00001110| 68 20 66 69 6c 65 3a 0d | 0d 0d fc 00 90 02 0a 00 |h file:.|........|
|00001120| 90 00 0e 02 1c 06 30 f7 | ff 00 16 0a 00 f7 ff 00 |......0.|........|
|00001130| 16 0a 00 f7 23 69 6d 70 | 6f 72 74 20 3c 6f 62 6a |....#imp|ort <obj|
|00001140| 63 2f 4f 62 6a 65 63 74 | 2e 68 3e 0d 0d 40 69 6e |c/Object|.h>..@in|
|00001150| 74 65 72 66 61 63 65 20 | 4d 79 4f 62 6a 65 63 74 |terface |MyObject|
|00001160| 3a 4f 62 6a 65 63 74 0d | 7b 0d fc 00 90 02 0a 00 |:Object.|{.......|
|00001170| 90 00 0e 02 d0 06 30 f7 | ff 00 16 0a 01 f7 09 69 |......0.|.......i|
|00001180| 6e 74 20 6d 79 49 6e 74 | 3b ff 00 16 0a 00 f7 0d |nt myInt|;.......|
|00001190| fc 00 90 02 0a 00 90 00 | 0e 02 1c 06 30 f7 7d 0d |........|....0.}.|
|000011a0| 0d 2d 20 69 6e 63 72 65 | 6d 65 6e 74 42 75 74 74 |.- incre|mentButt|
|000011b0| 6f 6e 3a 73 65 6e 64 65 | 72 3b 0d 2d 20 64 65 63 |on:sende|r;.- dec|
|000011c0| 72 65 6d 65 6e 74 42 75 | 74 74 6f 6e 3a 73 65 6e |rementBu|tton:sen|
|000011d0| 64 65 72 3b 0d 0d 40 65 | 6e 64 0d 0d fc 00 6c 02 |der;..@e|nd....l.|
|000011e0| 0a 00 6c 00 0e 02 1c 06 | 30 f7 ff 00 15 0a 00 f7 |..l.....|0.......|
|000011f0| ff 00 15 0a 00 f7 20 0d | 00 25 fb 00 00 00 01 00 |...... .|.%......|
|00001200| 6d 01 23 43 68 30 36 2e | 49 6e 63 44 65 63 46 6f |m.#Ch06.|IncDecFo|
|00001210| 72 6d 2e 38 32 38 35 34 | 39 2e 65 70 73 f7 0d 03 |rm.82854|9.eps...|
|00001220| 6f 0d fc 00 7e 02 0a 00 | 7e 00 0e 02 40 02 88 02 |o...~...|~...@...|
|00001230| d0 03 18 06 30 f7 ff 00 | 16 0a 00 f7 23 69 6e 63 |....0...|....#inc|
|00001240| 6c 75 64 65 20 3c 73 74 | 64 69 6f 2e 68 3e 0d 23 |lude <st|dio.h>.#|
|00001250| 69 6e 63 6c 75 64 65 20 | 3c 6c 69 62 63 2e 68 3e |include |<libc.h>|
|00001260| 0d 65 78 74 65 72 6e 20 | 76 6f 69 64 20 73 72 61 |.extern |void sra|
|00001270| 6e 64 6f 6d 28 29 3b 0d | 0d 6d 61 69 6e 28 29 20 |ndom();.|.main() |
|00001280| 7b 0d 69 6e 74 20 74 68 | 65 4e 75 6d 62 65 72 2c |{.int th|eNumber,|
|00001290| 20 67 75 65 73 73 2c 20 | 6e 75 6d 47 75 65 73 73 | guess, |numGuess|
|000012a0| 65 73 3b 0d 63 68 61 72 | 20 73 74 69 6c 6c 5f 70 |es;.char| still_p|
|000012b0| 6c 61 79 69 6e 67 20 3d | 20 27 79 27 3b 0d 63 68 |laying =| 'y';.ch|
|000012c0| 61 72 20 73 74 69 6c 6c | 5f 67 75 65 73 73 69 6e |ar still|_guessin|
|000012d0| 67 3b 0d 09 77 68 69 6c | 65 20 28 73 74 69 6c 6c |g;..whil|e (still|
|000012e0| 5f 70 6c 61 79 69 6e 67 | 20 3d 3d 20 27 79 27 29 |_playing| == 'y')|
|000012f0| 20 7b 0d 09 09 73 72 61 | 6e 64 6f 6d 28 74 69 6d | {...sra|ndom(tim|
|00001300| 65 28 30 29 29 3b 0d 09 | 09 74 68 65 4e 75 6d 62 |e(0));..|.theNumb|
|00001310| 65 72 20 3d 20 72 61 6e | 64 6f 6d 28 29 20 25 20 |er = ran|dom() % |
|00001320| 28 28 31 30 30 29 2b 31 | 29 3b 0d 09 09 6e 75 6d |((100)+1|);...num|
|00001330| 47 75 65 73 73 65 73 20 | 3d 20 31 3b 0d 09 09 73 |Guesses |= 1;...s|
|00001340| 74 69 6c 6c 5f 67 75 65 | 73 73 69 6e 67 20 3d 20 |till_gue|ssing = |
|00001350| 27 79 27 3b 0d 09 09 77 | 68 69 6c 65 20 28 73 74 |'y';...w|hile (st|
|00001360| 69 6c 6c 5f 67 75 65 73 | 73 69 6e 67 20 3d 3d 20 |ill_gues|sing == |
|00001370| 27 79 27 29 20 7b 0d 09 | 09 09 70 72 69 6e 74 66 |'y') {..|..printf|
|00001380| 28 22 47 75 65 73 73 20 | 61 20 6e 75 6d 62 65 72 |("Guess |a number|
|00001390| 20 66 72 6f 6d 20 31 20 | 74 6f 20 31 30 30 3a 20 | from 1 |to 100: |
|000013a0| 22 29 3b 0d 09 09 09 73 | 63 61 6e 66 28 22 25 64 |");....s|canf("%d|
|000013b0| 22 2c 20 26 67 75 65 73 | 73 29 3b 0d 09 09 09 69 |", &gues|s);....i|
|000013c0| 66 20 28 67 75 65 73 73 | 20 3d 3d 20 74 68 65 4e |f (guess| == theN|
|000013d0| 75 6d 62 65 72 29 20 7b | 0d 09 09 09 09 70 72 69 |umber) {|.....pri|
|000013e0| 6e 74 66 28 22 43 6f 72 | 72 65 63 74 20 69 6e 20 |ntf("Cor|rect in |
|000013f0| 25 64 20 67 75 65 73 73 | 65 73 21 5c 6e 22 2c 20 |%d guess|es!\n", |
|00001400| 6e 75 6d 47 75 65 73 73 | 65 73 29 3b 0d 09 09 09 |numGuess|es);....|
|00001410| 09 73 74 69 6c 6c 5f 67 | 75 65 73 73 69 6e 67 20 |.still_g|uessing |
|00001420| 3d 20 27 6e 27 3b 0d 09 | 09 09 09 70 72 69 6e 74 |= 'n';..|...print|
|00001430| 66 28 22 44 6f 20 79 6f | 75 20 77 61 6e 74 20 74 |f("Do yo|u want t|
|00001440| 6f 20 70 6c 61 79 20 61 | 67 61 69 6e 20 28 79 2f |o play a|gain (y/|
|00001450| 6e 29 3f 20 22 29 3b 0d | 09 09 09 09 73 63 61 6e |n)? ");.|....scan|
|00001460| 66 28 22 25 31 73 22 2c | 20 26 73 74 69 6c 6c 5f |f("%1s",| &still_|
|00001470| 70 6c 61 79 69 6e 67 29 | 3b 0d 09 09 09 7d 0d 09 |playing)|;....}..|
|00001480| 09 09 65 6c 73 65 20 69 | 66 20 28 67 75 65 73 73 |..else i|f (guess|
|00001490| 20 3e 20 74 68 65 4e 75 | 6d 62 65 72 29 0d 09 09 | > theNu|mber)...|
|000014a0| 09 09 70 72 69 6e 74 66 | 28 22 47 75 65 73 73 20 |..printf|("Guess |
|000014b0| 25 64 20 69 73 20 74 6f | 6f 20 68 69 67 68 5c 6e |%d is to|o high\n|
|000014c0| 22 2c 20 6e 75 6d 47 75 | 65 73 73 65 73 29 3b 0d |", numGu|esses);.|
|000014d0| 09 09 09 65 6c 73 65 20 | 69 66 20 28 67 75 65 73 |...else |if (gues|
|000014e0| 73 20 3c 20 74 68 65 4e | 75 6d 62 65 72 29 0d 09 |s < theN|umber)..|
|000014f0| 09 09 09 70 72 69 6e 74 | 66 28 22 47 75 65 73 73 |...print|f("Guess|
|00001500| 20 25 64 20 69 73 20 74 | 6f 6f 20 6c 6f 77 5c 6e | %d is t|oo low\n|
|00001510| 22 2c 20 6e 75 6d 47 75 | 65 73 73 65 73 29 3b 0d |", numGu|esses);.|
|00001520| 09 09 09 6e 75 6d 47 75 | 65 73 73 65 73 20 2b 2b |...numGu|esses ++|
|00001530| 3b 0d 09 09 7d 0d 09 7d | 0d 7d 0d 0d ff 00 15 0a |;...}..}|.}......|
|00001540| 00 f7 46 69 67 75 72 65 | 20 31 20 2d 20 54 72 61 |..Figure| 1 - Tra|
|00001550| 64 69 74 69 6f 6e 61 6c | 20 43 20 6c 61 6e 67 75 |ditional| C langu|
|00001560| 61 67 65 20 70 72 6f 67 | 72 61 6d 20 66 6f 72 20 |age prog|ram for |
|00001570| 74 68 65 20 67 61 6d 65 | 20 6f 66 20 48 69 4c 6f |the game| of HiLo|
|00001580| 0d fc 00 5a 02 0a 00 5a | 00 0e 01 b0 06 30 f7 0d |...Z...Z|.....0..|
|00001590| 02 88 20 20 20 20 2d 20 | 20 43 6f 6d 6d 65 6e 74 |.. - | Comment|
|000015a0| 20 66 72 6f 6d 20 4e 65 | 58 54 73 74 65 70 20 73 | from Ne|XTstep s|
|000015b0| 65 6d 69 6e 61 72 20 65 | 76 61 6c 75 61 74 69 6f |eminar e|valuatio|
|000015c0| 6e 20 66 6f 72 6d ff 00 | 15 0c 00 f7 0d 0d fc 00 |n form..|........|
|000015d0| 6d 02 0a 00 6d 00 0e 01 | b0 06 30 f7 ff 00 15 0a |m...m...|..0.....|
|000015e0| 00 f7 41 20 6c 6f 74 20 | 6f 66 20 70 65 6f 70 6c |..A lot |of peopl|
|000015f0| 65 20 61 72 65 20 66 72 | 75 73 74 72 61 74 65 64 |e are fr|ustrated|
|00001600| 20 77 69 74 68 20 74 68 | 65 69 72 20 63 75 72 72 | with th|eir curr|
|00001610| 65 6e 74 20 73 6f 66 74 | 77 61 72 65 20 64 65 76 |ent soft|ware dev|
|00001620| 65 6c 6f 70 6d 65 6e 74 | 20 65 6e 76 69 72 6f 6e |elopment| environ|
|00001630| 6d 65 6e 74 73 ff 00 15 | 0a 00 f7 2e 20 20 54 72 |ments...|.... Tr|
|00001640| 79 69 6e 67 20 74 6f 20 | 77 72 69 74 65 20 61 20 |ying to |write a |
|00001650| 70 72 6f 67 72 61 6d 20 | 74 68 61 74 20 75 73 65 |program |that use|
|00001660| 73 20 67 72 61 70 68 69 | 63 61 6c 20 69 6e 74 65 |s graphi|cal inte|
|00001670| 72 66 61 63 65 73 20 69 | 73 20 6e 6f 74 20 61 20 |rfaces i|s not a |
|00001680| 74 72 69 76 69 61 6c 20 | 74 61 73 6b 2e 20 20 49 |trivial |task. I|
|00001690| 74 20 74 61 6b 65 73 20 | 61 20 6c 6f 74 20 6f 66 |t takes |a lot of|
|000016a0| 20 74 69 6d 65 20 61 6e | 64 20 79 6f 75 20 73 6f | time an|d you so|
|000016b0| 6d 65 74 69 6d 65 73 20 | 6e 65 65 64 20 74 6f 20 |metimes |need to |
|000016c0| 74 68 6f 75 73 61 6e 64 | 73 20 6f 66 20 6c 69 6e |thousand|s of lin|
|000016d0| 65 73 20 6f 66 20 74 65 | 6d 70 6c 61 74 65 20 63 |es of te|mplate c|
|000016e0| 6f 64 65 20 74 6f 20 6a | 75 73 74 20 67 65 74 20 |ode to j|ust get |
|000016f0| 74 68 65 20 70 72 6f 67 | 72 61 6d 20 73 74 61 72 |the prog|ram star|
|00001700| 74 65 64 2e 20 20 4d 61 | 6e 61 67 65 69 6e 67 20 |ted. Ma|nageing |
|00001710| 74 68 65 20 66 6c 6f 77 | 20 6f 66 20 65 76 65 6e |the flow| of even|
|00001720| 74 73 20 73 75 63 68 20 | 61 73 20 6d 6f 75 73 65 |ts such |as mouse|
|00001730| 20 63 6c 69 63 6b 73 2c | 20 74 79 70 69 6e 67 20 | clicks,| typing |
|00001740| 74 65 78 74 20 69 6e 74 | 6f 20 61 20 77 69 6e 64 |text int|o a wind|
|00001750| 6f 77 20 61 6e 64 20 74 | 72 61 63 6b 69 6e 67 20 |ow and t|racking |
|00001760| 74 68 65 20 6d 6f 75 73 | 65 20 61 73 20 69 74 20 |the mous|e as it |
|00001770| 64 72 61 67 73 20 61 6e | 20 6f 62 6a 65 63 74 20 |drags an| object |
|00001780| 61 63 63 72 6f 73 73 20 | 74 68 65 20 73 63 72 65 |accross |the scre|
|00001790| 65 6e 20 62 65 74 77 65 | 65 6e 20 77 69 6e 64 6f |en betwe|en windo|
|000017a0| 77 73 20 61 72 65 20 61 | 6c 6c 20 63 6f 6d 70 6c |ws are a|ll compl|
|000017b0| 69 63 61 74 65 64 20 70 | 72 6f 63 65 73 73 65 73 |icated p|rocesses|
|000017c0| 20 74 68 61 74 20 6d 75 | 73 74 20 62 65 20 63 61 | that mu|st be ca|
|000017d0| 72 65 66 75 6c 6c 79 20 | 73 74 75 64 69 65 64 20 |refully |studied |
|000017e0| 61 6e 64 20 74 68 65 6e | 20 69 6e 63 6f 72 70 6f |and then| incorpo|
|000017f0| 72 61 74 65 64 20 69 6e | 74 6f 20 74 65 6d 70 6c |rated in|to templ|
|00001800| 61 74 65 73 20 74 68 61 | 74 20 79 6f 75 20 63 61 |ates tha|t you ca|
|00001810| 6e 20 72 65 2d 75 73 65 | 2e 0d 07 df 0d 54 68 69 |n re-use|.....Thi|
|00001820| 73 20 63 68 61 70 74 65 | 72 20 64 65 61 6c 73 20 |s chapte|r deals |
|00001830| 77 69 74 68 20 65 76 65 | 6e 74 73 2e 20 20 54 68 |with eve|nts. Th|
|00001840| 69 73 20 68 61 73 20 6c | 69 74 74 6c 65 20 74 6f |is has l|ittle to|
|00001850| 20 64 6f 20 6f 62 6a 65 | 63 74 20 62 61 73 65 64 | do obje|ct based|
|00001860| 20 63 6f 6d 70 75 74 69 | 6e 67 20 77 69 74 68 20 | computi|ng with |
|00001870| 74 68 65 20 65 78 63 65 | 70 74 69 6f 6e 20 20 74 |the exce|ption t|
|00001880| 68 61 74 20 77 65 20 6e | 65 65 64 20 74 6f 20 75 |hat we n|eed to u|
|00001890| 73 65 20 69 74 20 74 6f | 20 6d 61 6e 61 67 65 20 |se it to| manage |
|000018a0| 74 68 65 20 77 61 79 20 | 74 68 65 20 75 73 65 72 |the way |the user|
|000018b0| 20 69 6e 74 65 72 61 63 | 74 73 20 77 69 74 68 20 | interac|ts with |
|000018c0| 6f 62 6a 65 63 74 73 20 | 6f 6e 20 74 68 65 20 73 |objects |on the s|
|000018d0| 63 72 65 65 6e 2e 20 20 | 57 65 20 77 69 6c 6c 20 |creen. |We will |
|000018e0| 69 6e 74 72 6f 64 75 63 | 65 20 73 6f 6d 65 20 74 |introduc|e some t|
|000018f0| 65 72 6d 73 20 77 68 69 | 63 68 20 61 72 65 20 75 |erms whi|ch are u|
|00001900| 73 65 64 20 77 69 74 68 | 69 6e 20 49 6e 74 65 72 |sed with|in Inter|
|00001910| 66 61 63 65 20 42 75 69 | 6c 64 65 72 20 61 6e 64 |face Bui|lder and|
|00001920| 20 74 68 65 6e 20 67 69 | 76 65 20 79 6f 75 20 61 | then gi|ve you a|
|00001930| 20 73 61 6d 70 6c 65 20 | 70 72 6f 67 72 61 6d 20 | sample |program |
|00001940| 74 68 61 74 20 6d 61 6e | 61 67 65 73 20 74 77 6f |that man|ages two|
|00001950| 20 65 76 65 6e 74 73 20 | 74 6f 20 63 68 61 6e 67 | events |to chang|
|00001960| 65 20 74 68 65 20 73 74 | 61 74 65 20 6f 66 20 61 |e the st|ate of a|
|00001970| 6e 20 6f 62 6a 65 63 74 | 2e 0d fc 00 5a 02 0a 00 |n object|....Z...|
|00001980| 5a 00 0e 01 b0 06 30 f7 | 0d ff 00 15 18 01 f7 0d |Z.....0.|........|
|00001990| fc 00 49 02 0a 00 49 00 | 0e 01 b0 06 30 f7 41 63 |..I...I.|....0.Ac|
|000019a0| 74 69 6f 6e 73 3a 20 46 | 72 6f 6d 20 45 76 65 6e |tions: F|rom Even|
|000019b0| 74 73 20 69 6e 74 6f 20 | 43 6f 64 65 ff 00 15 0a |ts into |Code....|
|000019c0| 00 f7 0d fc 00 5a 02 0a | 00 5a 00 0e 01 b0 06 30 |.....Z..|.Z.....0|
|000019d0| f7 0d fc 00 6d 02 0a 00 | 6d 00 0e 02 1c 06 30 f7 |....m...|m.....0.|
|000019e0| 49 6e 20 74 72 61 64 69 | 74 69 6f 6e 61 6c 20 70 |In tradi|tional p|
|000019f0| 72 6f 67 72 61 6d 6d 69 | 6e 67 2c 20 70 72 6f 67 |rogrammi|ng, prog|
|00001a00| 72 61 6d 6d 65 72 73 20 | 74 68 69 6e 6b 20 6f 66 |rammers |think of|
|00001a10| 20 61 20 70 72 6f 67 72 | 61 6d 20 69 6e 20 77 68 | a progr|am in wh|
|00001a20| 69 63 68 20 74 68 65 20 | 70 72 6f 67 72 61 6d 20 |ich the |program |
|00001a30| 63 6f 75 6e 74 65 72 20 | 73 74 61 72 74 73 20 61 |counter |starts a|
|00001a40| 74 20 74 68 65 20 74 6f | 70 20 6f 66 20 61 20 70 |t the to|p of a p|
|00001a50| 6f 67 72 61 6d 28 69 6e | 20 43 20 74 68 69 73 20 |ogram(in| C this |
|00001a60| 69 73 20 63 61 6c 6c 20 | 74 68 65 20 22 6d 61 69 |is call |the "mai|
|00001a70| 6e 22 20 29 20 61 6e 64 | 20 63 6f 6e 74 69 6e 75 |n" ) and| continu|
|00001a80| 65 73 20 69 6e 20 61 20 | 6c 69 6e 65 61 72 20 6d |es in a |linear m|
|00001a90| 61 6e 6e 65 72 20 74 68 | 72 6f 75 67 68 20 74 68 |anner th|rough th|
|00001aa0| 65 20 65 6e 64 20 6f 66 | 20 74 68 65 20 70 72 6f |e end of| the pro|
|00001ab0| 67 72 61 6d 2e 20 20 45 | 61 63 68 20 6c 69 6e 65 |gram. E|ach line|
|00001ac0| 20 6f 66 20 70 72 6f 67 | 72 61 6d 20 63 6f 64 65 | of prog|ram code|
|00001ad0| 20 69 73 20 65 78 65 63 | 75 74 65 64 2c 20 6f 6e | is exec|uted, on|
|00001ae0| 65 20 61 66 74 65 72 20 | 74 68 65 20 6f 74 68 65 |e after |the othe|
|00001af0| 72 20 75 6e 74 69 6c 20 | 74 68 65 20 65 6e 64 20 |r until |the end |
|00001b00| 6f 66 20 74 68 65 20 70 | 72 6f 67 72 61 6d 20 69 |of the p|rogram i|
|00001b10| 73 20 72 65 61 63 68 65 | 64 2e 20 20 54 68 65 72 |s reache|d. Ther|
|00001b20| 65 20 61 72 65 20 77 61 | 79 73 20 74 6f 20 6d 61 |e are wa|ys to ma|
|00001b30| 6b 65 20 74 68 65 20 70 | 72 6f 67 72 61 6d 20 63 |ke the p|rogram c|
|00001b40| 6f 75 6e 74 65 72 20 67 | 6f 20 69 6e 20 63 69 72 |ounter g|o in cir|
|00001b50| 63 6c 65 73 20 28 63 61 | 6c 6c 65 64 20 6c 6f 6f |cles (ca|lled loo|
|00001b60| 70 73 29 20 61 6e 64 20 | 74 68 65 69 72 20 61 72 |ps) and |their ar|
|00001b70| 65 20 77 61 79 73 20 74 | 6f 20 63 68 61 6e 67 65 |e ways t|o change|
|00001b80| 20 74 68 65 20 6f 72 64 | 65 72 20 74 68 65 20 69 | the ord|er the i|
|00001b90| 6e 73 74 72 75 63 74 69 | 6f 6e 73 20 67 65 74 20 |nstructi|ons get |
|00001ba0| 65 78 65 63 75 74 65 64 | 2c 20 28 63 6f 6e 64 69 |executed|, (condi|
|00001bb0| 74 69 6f 6e 61 6c 20 73 | 74 61 74 65 6d 65 6e 74 |tional s|tatement|
|00001bc0| 73 29 20 62 75 74 20 74 | 68 65 20 70 72 6f 67 72 |s) but t|he progr|
|00001bd0| 61 6d 6d 65 72 20 61 6c | 77 61 79 73 20 63 72 65 |ammer al|ways cre|
|00001be0| 61 74 65 73 20 61 20 6d | 65 6e 74 61 6c 20 69 6d |ates a m|ental im|
|00001bf0| 61 67 65 73 20 6f 66 20 | 74 68 65 20 70 72 6f 67 |ages of |the prog|
|00001c00| 72 61 6d 20 63 6f 75 6e | 74 65 72 20 73 74 61 72 |ram coun|ter star|
|00001c10| 74 69 6e 67 20 61 74 20 | 74 68 65 20 62 65 67 69 |ting at |the begi|
|00001c20| 6e 6e 69 6e 67 20 61 6e | 64 20 66 69 6e 69 73 68 |nning an|d finish|
|00001c30| 69 6e 67 20 61 74 20 74 | 68 65 20 65 6e 64 2e 20 |ing at t|he end. |
|00001c40| 20 4e 6f 77 20 77 65 20 | 6d 75 73 74 20 75 6e 6c | Now we |must unl|
|00001c50| 65 61 72 6e 20 6d 75 63 | 68 20 6f 66 20 74 68 69 |earn muc|h of thi|
|00001c60| 73 20 70 72 65 2d 63 6f | 6e 63 69 65 76 65 64 20 |s pre-co|ncieved |
|00001c70| 69 64 65 61 73 20 6f 66 | 20 77 68 61 74 20 61 20 |ideas of| what a |
|00001c80| 70 72 6f 67 72 61 6d 20 | 69 73 2e 20 20 57 69 74 |program |is. Wit|
|00001c90| 68 20 4e 65 58 54 73 74 | 65 70 20 28 61 6e 64 20 |h NeXTst|ep (and |
|00001ca0| 77 69 74 68 20 6d 6f 73 | 74 20 6f 74 68 65 72 20 |with mos|t other |
|00001cb0| 67 72 61 70 68 69 63 73 | 20 62 61 73 65 64 20 70 |graphics| based p|
|00001cc0| 72 6f 67 72 61 6d 6d 69 | 6e 67 20 65 6e 76 69 72 |rogrammi|ng envir|
|00001cd0| 6f 6e 6d 65 6e 74 29 20 | 77 65 20 68 61 76 65 20 |onment) |we have |
|00001ce0| 61 20 74 77 6f 20 64 69 | 6d 65 6e 73 69 6f 6e 61 |a two di|mensiona|
|00001cf0| 6c 20 6d 61 74 72 69 78 | 20 6f 66 20 6f 62 6a 65 |l matrix| of obje|
|00001d00| 63 74 73 2e 20 20 57 68 | 65 6e 20 74 68 65 20 70 |cts. Wh|en the p|
|00001d10| 72 6f 67 72 61 6d 20 73 | 74 61 72 74 73 2c 20 74 |rogram s|tarts, t|
|00001d20| 68 65 20 75 73 65 72 20 | 70 65 72 66 6f 72 6d 73 |he user |performs|
|00001d30| 20 61 63 74 69 6f 6e 73 | 20 28 73 75 63 68 20 61 | actions| (such a|
|00001d40| 73 20 61 20 6d 6f 75 73 | 65 20 63 6c 69 63 6b 29 |s a mous|e click)|
|00001d50| 20 6f 6e 20 61 6e 79 20 | 6e 75 6d 62 65 72 20 6f | on any |number o|
|00001d60| 66 20 6f 62 6a 65 63 74 | 20 74 68 65 79 20 73 65 |f object| they se|
|00001d70| 65 20 6f 6e 20 74 68 65 | 20 73 63 72 65 65 6e 2e |e on the| screen.|
|00001d80| 20 20 54 68 65 73 65 20 | 61 63 74 69 6f 6e 73 20 | These |actions |
|00001d90| 63 61 75 73 65 20 74 68 | 65 20 77 69 6e 64 6f 77 |cause th|e window|
|00001da0| 20 6d 61 6e 61 67 65 72 | 20 74 6f 20 61 64 64 20 | manager| to add |
|00001db0| 65 76 65 6e 74 73 20 74 | 6f 20 61 20 71 75 65 75 |events t|o a queu|
|00001dc0| 65 2e 20 20 54 68 65 20 | 6f 70 65 72 61 74 69 6e |e. The |operatin|
|00001dd0| 67 20 73 79 73 74 65 6d | 20 74 68 65 6e 20 6c 6f |g system| then lo|
|00001de0| 6f 6b 73 20 61 74 20 74 | 68 65 20 71 75 65 75 65 |oks at t|he queue|
|00001df0| 20 61 6e 64 20 74 68 65 | 20 65 76 65 6e 74 73 20 | and the| events |
|00001e00| 61 72 65 20 74 68 65 6e | 20 64 69 73 70 61 74 63 |are then| dispatc|
|00001e10| 68 65 64 20 74 6f 20 6f | 62 6a 65 63 74 73 20 74 |hed to o|bjects t|
|00001e20| 68 72 6f 75 67 68 20 61 | 63 74 69 6f 6e 20 6d 65 |hrough a|ction me|
|00001e30| 73 73 61 67 65 73 2e 20 | 20 49 6e 20 65 76 65 6e |ssages. | In even|
|00001e40| 74 20 62 61 73 65 64 20 | 20 70 72 6f 67 72 61 6d |t based | program|
|00001e50| 6d 69 6e 67 20 77 65 20 | 74 68 69 6e 6b 20 6f 66 |ming we |think of|
|00001e60| 20 61 20 74 77 6f 20 64 | 69 6d 65 6e 73 69 6f 6e | a two d|imension|
|00001e70| 61 6c 20 61 72 72 61 79 | 20 6f 66 20 22 65 76 65 |al array| of "eve|
|00001e80| 6e 74 73 22 20 77 68 69 | 63 68 20 73 65 6e 64 20 |nts" whi|ch send |
|00001e90| 22 61 63 74 69 6f 6e 20 | 6d 65 73 73 61 67 65 73 |"action |messages|
|00001ea0| 22 20 74 6f 20 76 61 72 | 69 6f 75 73 20 73 65 63 |" to var|ious sec|
|00001eb0| 74 69 6f 6e 73 20 6f 66 | 20 63 6f 64 65 20 77 68 |tions of| code wh|
|00001ec0| 69 63 68 20 72 65 73 70 | 6f 6e 64 20 74 6f 20 20 |ich resp|ond to |
|00001ed0| 74 68 65 73 65 20 22 65 | 76 65 6e 74 73 22 2e 20 |these "e|vents". |
|00001ee0| 20 54 68 65 20 6f 72 64 | 65 72 20 6f 66 20 77 68 | The ord|er of wh|
|00001ef0| 65 6e 20 65 61 63 68 20 | 73 65 63 74 69 6f 6e 20 |en each |section |
|00001f00| 6f 66 20 63 6f 64 65 20 | 69 73 20 65 78 65 63 75 |of code |is execu|
|00001f10| 74 65 64 20 64 6f 65 73 | 20 6e 6f 74 20 64 65 70 |ted does| not dep|
|00001f20| 65 6e 64 61 6e 74 20 6f | 6e 20 74 68 65 20 6f 72 |endant o|n the or|
|00001f30| 64 65 72 20 69 74 20 61 | 70 70 65 61 72 73 20 69 |der it a|ppears i|
|00001f40| 6e 20 74 68 65 20 66 69 | 6c 65 20 62 75 74 20 6f |n the fi|le but o|
|00001f50| 6e 20 74 68 65 20 6f 72 | 64 65 72 20 74 68 61 74 |n the or|der that|
|00001f60| 20 74 68 65 73 65 20 65 | 76 65 6e 74 73 20 6f 63 | these e|vents oc|
|00001f70| 63 75 72 2e 20 20 53 6f | 20 74 68 6f 77 20 6f 75 |cur. So| thow ou|
|00001f80| 74 20 79 6f 75 20 6f 6c | 64 20 6d 65 6e 74 61 6c |t you ol|d mental|
|00001f90| 20 69 6d 6d 61 67 65 73 | 20 6f 66 20 68 6f 77 20 | immages| of how |
|00001fa0| 61 20 70 72 6f 67 72 61 | 6d 20 75 73 75 61 6c 6c |a progra|m usuall|
|00001fb0| 79 20 73 74 61 72 74 73 | 20 65 78 65 63 75 74 69 |y starts| executi|
|00001fc0| 6e 67 20 61 6e 64 20 73 | 74 61 72 74 20 74 68 69 |ng and s|tart thi|
|00001fd0| 6e 6b 69 6e 67 20 6f 66 | 20 65 76 65 6e 74 73 20 |nking of| events |
|00001fe0| 74 72 69 67 67 65 72 69 | 6e 67 20 61 63 74 69 6f |triggeri|ng actio|
|00001ff0| 6e 20 6d 65 74 68 6f 64 | 73 2e 0d 02 81 fc 00 5a |n method|s......Z|
|00002000| 02 0a 00 5a 00 0e 01 b0 | 06 30 f7 0d fc 00 49 02 |...Z....|.0....I.|
|00002010| 0a 00 49 00 0e 01 b0 06 | 30 f7 ff 00 15 12 01 f7 |..I.....|0.......|
|00002020| 45 78 61 6d 70 6c 65 20 | 36 2d 31 3a 20 49 6e 63 |Example |6-1: Inc|
|00002030| 72 65 6d 65 6e 74 69 6e | 67 20 61 6e 64 20 44 65 |rementin|g and De|
|00002040| 63 72 65 6d 65 6e 74 69 | 6e 67 20 61 6e 20 49 6e |crementi|ng an In|
|00002050| 74 65 67 65 72 ff 00 15 | 0a 00 f7 0d fc 00 6c 02 |teger...|......l.|
|00002060| 0a 00 6c 00 0e 02 1c 06 | 30 f7 0d 54 68 69 73 20 |..l.....|0..This |
|00002070| 65 78 61 6d 70 6c 65 20 | 69 73 20 76 65 72 79 20 |example |is very |
|00002080| 73 69 6d 69 6c 61 72 20 | 74 6f 20 74 68 65 20 22 |similar |to the "|
|00002090| 68 65 6c 6c 6f 2c 20 77 | 6f 72 6c 64 22 20 70 72 |hello, w|orld" pr|
|000020a0| 6f 67 72 61 6d 20 77 65 | 20 63 72 65 61 74 65 64 |ogram we| created|
|000020b0| 20 69 6e 20 63 68 61 70 | 74 65 72 20 33 2e 2e 20 | in chap|ter 3.. |
|000020c0| 54 68 65 20 64 69 66 66 | 65 72 65 6e 63 65 20 69 |The diff|erence i|
|000020d0| 73 20 77 65 20 77 69 6c | 6c 20 63 72 65 61 74 65 |s we wil|l create|
|000020e0| 20 74 77 6f 20 62 75 74 | 74 6f 6e 73 20 69 6e 73 | two but|tons ins|
|000020f0| 74 65 61 64 20 6f 66 20 | 6a 75 73 74 20 6f 6e 65 |tead of |just one|
|00002100| 2c 20 61 6e 64 20 74 68 | 61 74 20 77 65 20 77 69 |, and th|at we wi|
|00002110| 6c 6c 20 68 61 76 65 20 | 65 61 63 68 20 62 75 74 |ll have |each but|
|00002120| 74 6f 6e 20 74 72 69 67 | 67 65 72 20 61 6e 20 65 |ton trig|ger an e|
|00002130| 76 65 6e 74 20 74 68 61 | 74 20 77 69 6c 6c 20 63 |vent tha|t will c|
|00002140| 68 61 6e 67 65 20 74 68 | 65 20 73 74 61 74 65 20 |hange th|e state |
|00002150| 6f 66 20 61 6e 20 69 6e | 73 74 61 6e 63 65 20 76 |of an in|stance v|
|00002160| 61 72 69 61 62 6c 65 2e | 20 20 54 68 69 73 20 65 |ariable.| This e|
|00002170| 78 61 6d 70 6c 65 20 69 | 73 20 76 65 72 79 20 69 |xample i|s very i|
|00002180| 6d 70 6f 72 74 61 6e 74 | 2e 20 20 49 74 20 77 69 |mportant|. It wi|
|00002190| 6c 6c 20 62 65 20 74 68 | 65 20 66 69 72 73 74 20 |ll be th|e first |
|000021a0| 74 69 6d 65 20 77 65 20 | 75 73 65 20 61 6e 20 69 |time we |use an i|
|000021b0| 6e 73 74 61 6e 63 65 20 | 76 61 72 69 61 62 6c 65 |nstance |variable|
|000021c0| 20 61 6e 64 20 68 6f 6f | 6b 20 65 76 65 6e 74 73 | and hoo|k events|
|000021d0| 20 75 70 20 74 68 61 74 | 20 63 68 61 6e 67 65 20 | up that| change |
|000021e0| 74 68 65 20 73 74 61 74 | 65 20 6f 66 20 61 6e 20 |the stat|e of an |
|000021f0| 6f 62 6a 65 63 74 2e 20 | 20 54 68 69 73 20 69 73 |object. | This is|
|00002200| 20 74 68 65 20 66 75 6e | 64 61 6d 65 6e 74 61 6c | the fun|damental|
|00002210| 20 74 61 73 6b 20 6f 66 | 20 6d 6f 73 74 20 6f 66 | task of| most of|
|00002220| 20 6f 75 72 20 61 70 70 | 6c 69 63 61 74 69 6f 6e | our app|lication|
|00002230| 73 3a 20 77 65 20 61 6c | 6c 6f 77 20 75 73 65 72 |s: we al|low user|
|00002240| 73 20 74 6f 20 63 68 61 | 6e 67 65 20 74 68 65 20 |s to cha|nge the |
|00002250| 69 6e 74 65 72 6e 61 6c | 20 73 74 61 74 65 73 20 |internal| states |
|00002260| 6f 66 20 6f 62 6a 65 63 | 74 73 20 62 79 20 63 61 |of objec|ts by ca|
|00002270| 75 73 69 6e 67 20 65 76 | 65 6e 74 73 2e 0d 01 06 |using ev|ents....|
|00002280| fc 00 5a 02 0a 00 5a 00 | 0e 01 b0 06 30 f7 0d ff |..Z...Z.|....0...|
|00002290| 00 15 0c 01 f7 4d 65 74 | 68 6f 64 3a ff 00 15 0a |.....Met|hod:....|
|000022a0| 00 f7 0d fc 00 90 02 0a | 00 6c 00 0e 06 30 f7 20 |........|.l...0. |
|000022b0| 20 20 31 29 20 43 72 65 | 61 74 65 20 61 20 6e 65 | 1) Cre|ate a ne|
|000022c0| 77 20 61 70 70 6c 69 63 | 61 74 69 6f 6e 20 77 69 |w applic|ation wi|
|000022d0| 74 68 20 49 6e 74 65 72 | 66 61 63 65 20 42 75 69 |th Inter|face Bui|
|000022e0| 6c 64 65 72 2e 0d 0d 20 | 20 20 32 29 20 44 72 61 |lder... | 2) Dra|
|000022f0| 67 20 74 77 6f 20 62 75 | 74 74 6f 6e 73 20 69 6e |g two bu|ttons in|
|00002300| 20 74 6f 20 74 68 65 20 | 6d 61 69 6e 20 77 69 6e | to the |main win|
|00002310| 64 6f 77 20 73 63 72 65 | 65 6e 20 61 6e 64 20 6c |dow scre|en and l|
|00002320| 61 62 65 6c 20 74 68 65 | 6d 20 22 49 6e 63 72 65 |abel the|m "Incre|
|00002330| 6d 65 6e 74 22 20 61 6e | 64 20 22 44 65 63 72 65 |ment" an|d "Decre|
|00002340| 6d 65 6e 74 22 2e 20 20 | 54 68 65 20 6d 61 69 6e |ment". |The main|
|00002350| 20 77 69 6e 64 6f 77 20 | 73 68 6f 75 6c 64 20 6c | window |should l|
|00002360| 6f 6f 6b 20 6c 69 6b 65 | 20 74 68 65 20 66 6f 6c |ook like| the fol|
|00002370| 6c 6f 77 69 6e 67 3a 0d | 0d fc 00 5a 02 0a 00 5a |lowing:.|...Z...Z|
|00002380| 02 0e 06 30 f7 0d 02 d8 | 4e 6f 77 20 61 64 64 20 |...0....|Now add |
|00002390| 74 68 65 20 66 6f 6c 6c | 6f 77 69 6e 67 20 66 69 |the foll|owing fi|
|000023a0| 6c 65 73 20 69 6e 20 ff | 00 15 0a 01 f7 62 6f 6c |les in .|.....bol|
|000023b0| 64 ff 00 15 0a 00 f7 20 | 74 6f 20 74 68 65 20 4d |d...... |to the M|
|000023c0| 79 4f 62 6a 65 63 74 2e | 6d 20 66 69 6c 65 73 20 |yObject.|m files |
|000023d0| 77 69 74 68 20 74 68 65 | 20 66 6f 6c 6c 6f 77 69 |with the| followi|
|000023e0| 6e 67 3a 0d 0d fc 00 90 | 02 0a 00 90 00 0e 06 30 |ng:.....|.......0|
|000023f0| f7 ff 00 16 0a 00 f7 23 | 69 6d 70 6f 72 74 20 4d |.......#|import M|
|00002400| 79 4f 62 6a 65 63 74 2e | 68 0d f9 00 f7 ff 00 15 |yObject.|h.......|
|00002410| 0a 00 f7 0d ff 00 16 0a | 00 f7 40 69 6d 70 6c 65 |........|..@imple|
|00002420| 6d 65 6e 74 61 74 69 6f | 6e 20 4d 79 4f 62 6a 65 |mentatio|n MyObje|
|00002430| 63 74 0d ff 00 15 0a 00 | f7 0d ff 00 16 0a 00 f7 |ct......|........|
|00002440| fc 00 91 02 0a 00 91 00 | 0e 02 d0 06 30 f7 2d 20 |........|....0.- |
|00002450| 69 6e 63 72 65 6d 65 6e | 74 42 75 74 74 6f 6e 3a |incremen|tButton:|
|00002460| 73 65 6e 64 65 72 0d 7b | 0d 20 09 ff 00 16 0a 01 |sender.{|. ......|
|00002470| f7 6d 79 49 6e 74 2b 2b | 3b 0d 09 70 72 69 6e 74 |.myInt++|;..print|
|00002480| 66 28 22 6d 79 49 6e 74 | 2b 2b 20 3d 20 25 64 5c |f("myInt|++ = %d\|
|00002490| 6e 22 2c 20 6d 79 49 6e | 74 29 3b ff 00 16 0a 00 |n", myIn|t);.....|
|000024a0| f7 0d 09 72 65 74 75 72 | 6e 20 73 65 6c 66 3b 0d |...retur|n self;.|
|000024b0| 7d 0d 0d 2d 20 64 65 63 | 72 65 6d 65 6e 74 42 75 |}..- dec|rementBu|
|000024c0| 74 74 6f 6e 3a 73 65 6e | 64 65 72 0d 7b 0d 09 ff |tton:sen|der.{...|
|000024d0| 00 16 0a 01 f7 6d 79 49 | 6e 74 2d 2d 3b 0d 09 70 |.....myI|nt--;..p|
|000024e0| 72 69 6e 74 66 28 22 6d | 79 49 6e 74 2d 2d 20 3d |rintf("m|yInt-- =|
|000024f0| 20 25 64 5c 6e 22 2c 20 | 6d 79 49 6e 74 29 3b 0d | %d\n", |myInt);.|
|00002500| 09 ff 00 16 0a 00 f7 72 | 65 74 75 72 6e 20 73 65 |.......r|eturn se|
|00002510| 6c 66 3b 0d 7d 0d f9 00 | f7 ff 00 15 0a 00 f7 fc |lf;.}...|........|
|00002520| 00 6c 02 0a 00 6c 00 0e | 02 1c 06 30 f7 0d fc 00 |.l...l..|...0....|
|00002530| 5a 02 0a 00 5a 00 0e 02 | 1c 06 30 f7 41 66 74 65 |Z...Z...|..0.Afte|
|00002540| 72 20 79 6f 75 20 63 6f | 6d 70 69 6c 65 20 61 6e |r you co|mpile an|
|00002550| 64 20 72 75 6e 2c 20 79 | 6f 75 20 73 68 6f 75 6c |d run, y|ou shoul|
|00002560| 64 20 73 65 65 20 74 68 | 65 20 6e 75 6d 62 65 72 |d see th|e number|
|00002570| 73 20 69 6e 63 72 65 6d | 65 6e 74 69 6e 67 20 61 |s increm|enting a|
|00002580| 6e 64 20 64 65 63 72 65 | 6d 65 6e 74 69 6e 67 2e |nd decre|menting.|
|00002590| 20 20 49 66 20 79 6f 75 | 20 6e 65 65 64 20 74 6f | If you| need to|
|000025a0| 20 63 68 61 6e 67 65 20 | 74 68 65 20 69 6e 69 74 | change |the init|
|000025b0| 69 61 6c 20 73 74 61 74 | 65 20 6f 66 20 ff 00 16 |ial stat|e of ...|
|000025c0| 0a 01 f7 6d 79 49 6e 74 | ff 00 15 0a 00 f7 20 79 |...myInt|...... y|
|000025d0| 6f 75 20 77 69 6c 6c 20 | 6e 65 65 64 20 74 6f 20 |ou will |need to |
|000025e0| 75 73 65 20 69 6e 66 6f | 72 6d 61 74 69 6f 6e 20 |use info|rmation |
|000025f0| 69 6e 20 43 68 61 70 74 | 65 72 20 37 20 2d 20 49 |in Chapt|er 7 - I|
|00002600| 6e 69 74 69 61 6c 69 7a | 69 6e 67 20 4f 62 6a 65 |nitializ|ing Obje|
|00002610| 63 74 73 2e 0d fc 00 6c | 02 0a 00 6c 00 0e 02 1c |cts....l|...l....|
|00002620| 06 30 f7 0d fc 00 48 02 | 0a 00 48 00 0e 01 f0 08 |.0....H.|..H.....|
|00002630| 06 30 f7 ff 00 15 18 01 | f7 4f 75 74 6c 65 74 73 |.0......|.Outlets|
|00002640| 3a 20 47 69 76 69 6e 67 | 20 4e 61 6d 65 73 20 74 |: Giving| Names t|
|00002650| 6f 20 4f 62 6a 65 63 74 | 73 ff 00 15 0a 00 f7 0d |o Object|s.......|
|00002660| 02 bd fc 00 5a 02 0a 00 | 5a 00 0e 01 f0 08 06 30 |....Z...|Z......0|
|00002670| f7 0d fc 00 6c 02 0a 00 | 6c 00 0e 01 f0 08 06 30 |....l...|l......0|
|00002680| f7 57 65 20 68 61 76 65 | 20 6e 6f 77 20 6c 65 61 |.We have| now lea|
|00002690| 72 6e 65 64 20 68 6f 77 | 20 75 73 65 72 20 61 63 |rned how| user ac|
|000026a0| 74 69 6f 6e 73 20 74 72 | 69 67 67 65 72 20 65 76 |tions tr|igger ev|
|000026b0| 65 6e 74 73 20 61 6e 64 | 20 68 6f 77 20 74 68 65 |ents and| how the|
|000026c0| 73 65 20 65 76 65 6e 74 | 73 20 61 72 65 20 74 69 |se event|s are ti|
|000026d0| 65 64 20 74 6f 20 73 65 | 63 74 69 6f 6e 73 20 6f |ed to se|ctions o|
|000026e0| 66 20 63 6f 64 65 20 69 | 6e 20 6f 75 72 20 70 72 |f code i|n our pr|
|000026f0| 6f 67 72 61 6d 73 20 74 | 68 61 74 20 67 65 74 20 |ograms t|hat get |
|00002700| 65 78 65 63 75 74 65 64 | 2e 20 20 54 68 69 73 20 |executed|. This |
|00002710| 69 73 20 77 6f 6e 64 65 | 72 66 75 6c 20 69 66 20 |is wonde|rful if |
|00002720| 77 65 20 68 61 76 65 20 | 61 20 76 65 72 79 20 73 |we have |a very s|
|00002730| 69 6d 70 6c 65 20 69 6e | 74 65 72 66 61 63 65 2e |imple in|terface.|
|00002740| 20 20 42 75 74 20 77 68 | 61 74 20 69 66 20 77 65 | But wh|at if we|
|00002750| 20 77 61 6e 74 20 74 6f | 20 75 70 64 61 74 65 20 | want to| update |
|00002760| 61 6e 20 6f 62 6a 65 63 | 74 20 6f 6e 20 74 68 65 |an objec|t on the|
|00002770| 20 73 63 72 65 65 6e 20 | 66 72 6f 6d 20 77 69 74 | screen |from wit|
|00002780| 68 69 6e 20 6f 75 72 20 | 6f 62 6a 65 63 74 3f 20 |hin our |object? |
|00002790| 20 49 6e 20 74 68 65 20 | 49 6e 63 72 65 6d 65 6e | In the |Incremen|
|000027a0| 74 2f 44 65 63 72 65 6d | 65 6e 74 20 65 78 61 6d |t/Decrem|ent exam|
|000027b0| 70 6c 65 20 61 62 6f 76 | 65 20 77 65 20 6d 69 67 |ple abov|e we mig|
|000027c0| 68 74 20 77 61 6e 74 20 | 74 6f 20 68 61 76 65 20 |ht want |to have |
|000027d0| 61 20 74 65 78 74 20 66 | 69 65 6c 64 20 6f 6e 20 |a text f|ield on |
|000027e0| 74 68 65 20 73 63 72 65 | 65 6e 20 64 69 61 70 6c |the scre|en diapl|
|000027f0| 61 79 20 74 68 65 20 63 | 75 72 72 65 6e 74 20 76 |ay the c|urrent v|
|00002800| 61 6c 75 65 20 6f 75 72 | 20 69 6e 74 65 67 65 72 |alue our| integer|
|00002810| 2e 20 20 48 6f 77 20 64 | 6f 20 77 65 20 22 74 61 |. How d|o we "ta|
|00002820| 6c 6b 20 74 6f 22 20 74 | 68 65 20 74 65 78 74 20 |lk to" t|he text |
|00002830| 6f 62 6a 65 63 74 20 66 | 72 6f 6d 20 77 69 74 68 |object f|rom with|
|00002840| 69 6e 20 6f 75 72 20 70 | 72 6f 67 72 61 6d 3f 20 |in our p|rogram? |
|00002850| 20 57 65 20 63 6f 75 6c | 64 20 68 61 76 65 20 61 | We coul|d have a|
|00002860| 6e 20 61 74 74 72 69 62 | 75 74 65 20 77 69 74 68 |n attrib|ute with|
|00002870| 69 6e 20 74 68 65 20 6f | 62 6a 65 63 74 20 74 68 |in the o|bject th|
|00002880| 61 74 20 68 6f 6c 64 73 | 20 74 68 65 20 6e 61 6d |at holds| the nam|
|00002890| 65 20 6f 66 20 74 68 65 | 20 6f 62 6a 65 63 74 2e |e of the| object.|
|000028a0| 20 20 57 68 65 6e 20 77 | 65 20 22 69 6e 73 70 65 | When w|e "inspe|
|000028b0| 63 74 22 20 74 68 65 20 | 6f 62 6a 65 63 74 20 77 |ct" the |object w|
|000028c0| 65 20 63 6f 75 6c 64 20 | 73 65 74 20 74 68 65 20 |e could |set the |
|000028d0| 6e 61 6d 65 20 74 6f 20 | 62 65 20 ff 00 16 0a 01 |name to |be .....|
|000028e0| f7 6d 79 54 65 78 74 ff | 00 15 0a 00 f7 20 61 6e |.myText.|..... an|
|000028f0| 64 20 74 68 65 20 77 69 | 74 68 69 6e 20 6f 75 72 |d the wi|thin our|
|00002900| 20 6f 62 6a 65 63 74 20 | 77 65 20 63 6f 75 6c 64 | object |we could|
|00002910| 20 61 64 64 20 74 68 65 | 20 6c 69 6e 65 3a 0d 04 | add the| line:..|
|00002920| 7c 0d 09 ff 00 16 0a 01 | f7 5b 6d 79 54 65 78 74 ||.......|.[myText|
|00002930| 20 69 6e 74 56 61 6c 75 | 65 3a 6d 79 49 6e 74 5d | intValu|e:myInt]|
|00002940| ff 00 15 0a 00 f7 0d 0d | 41 6c 74 68 6f 75 67 68 |........|Although|
|00002950| 20 74 68 69 73 20 69 73 | 20 73 6f 6d 65 74 69 6d | this is| sometim|
|00002960| 65 73 20 64 6f 6e 65 2c | 20 69 74 20 61 6c 73 6f |es done,| it also|
|00002970| 20 62 72 69 6e 67 73 20 | 69 6e 74 6f 20 70 6c 61 | brings |into pla|
|00002980| 79 20 71 75 65 73 74 69 | 6f 6e 73 20 61 73 20 2d |y questi|ons as -|
|00002990| 20 77 68 61 74 20 69 73 | 20 74 68 65 20 73 63 6f | what is| the sco|
|000029a0| 70 65 20 6f 66 20 74 68 | 65 20 76 61 72 69 61 62 |pe of th|e variab|
|000029b0| 6c 65 20 6d 79 54 65 78 | 74 3f 20 20 48 6f 77 20 |le myTex|t? How |
|000029c0| 77 69 6c 6c 20 61 6c 6c | 20 74 68 65 20 6f 62 6a |will all| the obj|
|000029d0| 65 63 74 73 20 74 68 61 | 74 20 75 73 65 20 74 68 |ects tha|t use th|
|000029e0| 69 73 20 6e 61 6d 65 20 | 62 65 20 69 6e 66 6f 72 |is name |be infor|
|000029f0| 6d 65 64 20 69 66 20 74 | 68 65 20 6e 61 6d 65 20 |med if t|he name |
|00002a00| 6f 66 20 74 68 65 20 6f | 62 6a 65 63 74 20 63 68 |of the o|bject ch|
|00002a10| 61 6e 67 65 73 3f 20 20 | 4e 65 58 54 73 74 65 70 |anges? |NeXTstep|
|00002a20| 20 68 61 73 20 61 20 6d | 65 74 68 6f 64 20 74 68 | has a m|ethod th|
|00002a30| 61 74 20 61 64 64 72 65 | 73 73 65 73 20 73 6f 6d |at addre|sses som|
|00002a40| 65 20 6f 66 20 74 68 65 | 73 65 20 71 75 65 73 74 |e of the|se quest|
|00002a50| 69 6f 6e 73 3a 20 6f 75 | 74 6c 65 74 73 2e 20 20 |ions: ou|tlets. |
|00002a60| ff 00 15 0a 01 f7 41 6e | 20 6f 75 74 6c 65 74 73 |......An| outlets|
|00002a70| 20 66 75 6e 63 74 69 6f | 6e 20 69 73 20 76 65 72 | functio|n is ver|
|00002a80| 79 20 73 69 6d 70 6c 65 | 3a 20 69 74 20 61 73 73 |y simple|: it ass|
|00002a90| 69 67 6e 73 20 61 6e 20 | 6e 61 6d 65 20 74 6f 20 |igns an |name to |
|00002aa0| 61 20 73 70 65 63 69 66 | 69 63 20 6f 62 6a 65 63 |a specif|ic objec|
|00002ab0| 74 20 69 6e 20 22 6f 62 | 6a 65 63 74 20 73 70 61 |t in "ob|ject spa|
|00002ac0| 63 65 22 20 74 68 61 74 | 20 69 73 20 74 68 65 6e |ce" that| is then|
|00002ad0| 20 75 73 65 64 20 77 68 | 65 6e 20 77 65 20 77 61 | used wh|en we wa|
|00002ae0| 6e 74 20 74 6f 20 74 61 | 6c 6b 20 74 6f 20 74 68 |nt to ta|lk to th|
|00002af0| 61 74 20 20 6f 62 6a 65 | 63 74 20 66 72 6f 6d 20 |at obje|ct from |
|00002b00| 77 69 74 68 69 6e 20 6f | 75 72 20 63 6f 64 65 2e |within o|ur code.|
|00002b10| ff 00 15 0a 00 f7 20 20 | 46 6f 72 20 65 78 61 6d |...... |For exam|
|00002b20| 70 6c 65 20 69 6e 20 74 | 68 65 20 61 62 6f 76 65 |ple in t|he above|
|00002b30| 20 65 78 61 6d 70 6c 65 | 20 77 65 20 77 6f 75 6c | example| we woul|
|00002b40| 64 20 75 73 65 20 74 68 | 65 20 66 6f 6c 6c 6f 77 |d use th|e follow|
|00002b50| 69 6e 67 20 73 74 65 70 | 73 20 74 6f 20 61 64 64 |ing step|s to add|
|00002b60| 20 61 20 74 65 78 74 20 | 6f 62 6a 65 63 74 20 74 | a text |object t|
|00002b70| 6f 20 74 68 65 20 73 63 | 72 65 65 6e 20 74 6f 20 |o the sc|reen to |
|00002b80| 64 69 73 70 6c 61 79 20 | 74 68 65 20 76 61 6c 75 |display |the valu|
|00002b90| 65 20 6f 66 20 74 68 65 | 20 69 6e 74 65 67 65 72 |e of the| integer|
|00002ba0| 3a 0d fc 00 5a 02 0a 00 | 5a 00 0e 01 f0 08 06 30 |:...Z...|Z......0|
|00002bb0| f7 0d 0d fc 00 48 02 0a | 00 48 00 0e 01 f0 08 06 |.....H..|.H......|
|00002bc0| 30 f7 ff 00 15 10 01 f7 | 45 78 61 6d 70 6c 65 3a |0.......|Example:|
|00002bd0| 20 55 73 69 6e 67 20 61 | 20 46 6f 72 6d 0d fc 00 | Using a| Form...|
|00002be0| 5a 02 0a 00 5a 00 0e 01 | f0 08 06 30 f7 ff 00 15 |Z...Z...|...0....|
|00002bf0| 0a 00 f7 0d 4c 65 74 20 | 75 73 20 74 61 6b 65 20 |....Let |us take |
|00002c00| 74 68 65 20 70 72 65 76 | 69 6f 75 73 20 65 78 61 |the prev|ious exa|
|00002c10| 6d 70 6c 65 2c 20 74 68 | 65 20 74 61 73 6b 20 6f |mple, th|e task o|
|00002c20| 66 20 68 61 76 69 6e 67 | 20 74 77 6f 20 65 76 65 |f having| two eve|
|00002c30| 6e 74 73 20 63 68 61 6e | 67 65 20 74 68 65 20 73 |nts chan|ge the s|
|00002c40| 74 61 74 65 20 6f 66 20 | 61 6e 20 69 6e 73 74 61 |tate of |an insta|
|00002c50| 6e 63 65 20 76 61 72 69 | 61 62 6c 65 2e 20 20 54 |nce vari|able. T|
|00002c60| 68 65 20 73 74 61 74 65 | 20 6f 66 20 74 68 65 20 |he state| of the |
|00002c70| 6f 62 6a 65 63 74 20 77 | 61 73 20 70 72 69 6e 74 |object w|as print|
|00002c80| 65 64 20 6f 75 74 20 74 | 6f 20 74 68 65 20 73 74 |ed out t|o the st|
|00002c90| 61 6e 64 61 72 64 20 6f | 75 74 70 75 74 2c 20 69 |andard o|utput, i|
|00002ca0| 6e 20 74 68 69 73 20 63 | 61 73 65 20 74 68 65 20 |n this c|ase the |
|00002cb0| 74 65 72 6d 69 6e 61 6c | 2e 20 20 42 75 74 20 74 |terminal|. But t|
|00002cc0| 68 61 74 20 68 61 73 20 | 74 68 65 20 64 69 73 61 |hat has |the disa|
|00002cd0| 64 76 61 6e 74 61 67 65 | 20 74 68 61 74 20 69 66 |dvantage| that if|
|00002ce0| 20 79 6f 75 20 73 74 61 | 72 74 20 74 68 65 20 70 | you sta|rt the p|
|00002cf0| 72 6f 67 72 61 6d 20 66 | 72 6f 6d 20 74 68 65 20 |rogram f|rom the |
|00002d00| 62 72 6f 77 73 65 72 20 | 79 6f 75 20 77 69 6c 6c |browser |you will|
|00002d10| 20 6e 6f 74 20 73 65 65 | 20 61 6e 79 20 6f 75 74 | not see| any out|
|00002d20| 70 75 74 2e 20 20 41 20 | 62 65 74 74 65 72 20 73 |put. A |better s|
|00002d30| 6f 6c 75 74 69 6f 6e 20 | 69 73 20 74 6f 20 64 69 |olution |is to di|
|00002d40| 73 70 6c 61 79 20 74 68 | 65 20 76 61 6c 75 65 20 |splay th|e value |
|00002d50| 74 6f 20 61 20 46 6f 72 | 6d 20 6f 62 6a 65 63 74 |to a For|m object|
|00002d60| 20 69 6e 20 74 68 65 20 | 6d 61 69 6e 20 77 69 6e | in the |main win|
|00002d70| 64 6f 77 20 6f 66 20 74 | 68 65 20 61 70 70 6c 69 |dow of t|he appli|
|00002d80| 63 61 74 69 6f 6e 2e 20 | 20 48 65 72 65 20 61 72 |cation. | Here ar|
|00002d90| 65 20 74 68 65 20 73 74 | 65 70 73 2e 0d 00 94 0d |e the st|eps.....|
|00002da0| fc 00 6c 02 0a 00 62 00 | 0e 01 f0 08 06 30 f7 31 |..l...b.|.....0.1|
|00002db0| 29 20 55 73 65 20 49 6e | 74 65 72 66 61 63 65 20 |) Use In|terface |
|00002dc0| 42 75 69 6c 64 65 72 20 | 74 6f 20 61 64 64 20 61 |Builder |to add a|
|00002dd0| 20 46 6f 72 6d 20 6f 62 | 6a 65 63 74 20 74 6f 20 | Form ob|ject to |
|00002de0| 74 68 65 20 6d 61 69 6e | 20 77 69 6e 64 6f 77 2e |the main| window.|
|00002df0| 20 20 43 68 61 6e 67 65 | 20 74 68 65 20 74 65 78 | Change| the tex|
|00002e00| 74 20 69 6e 20 74 68 65 | 20 66 6f 72 6d 20 74 6f |t in the| form to|
|00002e10| 20 62 65 20 74 6f 20 62 | 65 20 22 4d 79 49 6e 74 | be to b|e "MyInt|
|00002e20| 3a 22 0d fc 00 6c 02 0a | 00 62 02 0e 01 f0 08 06 |:"...l..|.b......|
|00002e30| 30 f7 0d 01 ba 0d fc 00 | 6c 02 0a 00 62 00 0e 01 |0.......|l...b...|
|00002e40| f0 08 06 30 f7 0d 32 29 | 20 41 64 64 20 74 68 65 |...0..2)| Add the|
|00002e50| 20 66 6f 6c 6c 6f 77 69 | 6e 67 20 6c 69 6e 65 20 | followi|ng line |
|00002e60| 74 6f 20 74 68 65 20 4d | 79 4f 62 6a 65 63 74 2e |to the M|yObject.|
|00002e70| 68 20 66 69 6c 65 0d 0d | 2d 6d 79 54 65 78 74 3a |h file..|-myText:|
|00002e80| 61 6e 4f 62 6a 65 63 74 | 3b 0d 0d 33 29 20 50 61 |anObject|;..3) Pa|
|00002e90| 72 73 65 20 69 6e 20 74 | 68 65 20 6e 65 77 20 68 |rse in t|he new h|
|00002ea0| 65 61 64 65 72 20 66 69 | 6c 65 20 62 79 20 73 65 |eader fi|le by se|
|00002eb0| 6c 65 63 74 69 6e 67 20 | 74 68 65 20 4d 79 4f 62 |lecting |the MyOb|
|00002ec0| 6a 65 63 74 20 63 6c 61 | 73 73 20 69 6e 20 74 68 |ject cla|ss in th|
|00002ed0| 65 20 63 6c 61 73 73 20 | 65 64 69 74 6f 72 20 61 |e class |editor a|
|00002ee0| 6e 64 20 74 68 65 6e 20 | 75 73 69 6e 67 20 74 68 |nd then |using th|
|00002ef0| 65 20 22 70 61 72 73 65 | 22 20 73 65 6c 65 63 74 |e "parse|" select|
|00002f00| 69 6f 6e 20 66 72 6f 6d | 20 74 68 65 20 70 6f 70 |ion from| the pop|
|00002f10| 2d 75 70 20 6c 69 73 74 | 2e 20 20 41 6e 73 77 65 |-up list|. Answe|
|00002f20| 72 20 22 52 65 70 6c 61 | 63 65 22 20 74 6f 20 74 |r "Repla|ce" to t|
|00002f30| 68 65 20 61 6c 65 72 74 | 20 71 75 65 73 74 69 6f |he alert| questio|
|00002f40| 6e 20 74 68 61 74 20 69 | 6e 66 6f 72 6d 73 20 79 |n that i|nforms y|
|00002f50| 6f 75 20 74 68 61 74 20 | 79 6f 75 20 68 61 76 65 |ou that |you have|
|00002f60| 20 64 69 66 66 65 72 65 | 6e 74 20 6d 65 74 68 6f | differe|nt metho|
|00002f70| 64 73 2e 0d 0d 34 29 20 | 4d 61 6b 65 20 61 20 63 |ds...4) |Make a c|
|00002f80| 6f 6e 6e 65 63 74 69 6f | 6e 20 66 72 6f 6d 20 74 |onnectio|n from t|
|00002f90| 68 65 20 6f 62 6a 65 63 | 74 20 69 6e 73 74 61 6e |he objec|t instan|
|00002fa0| 63 65 20 74 6f 20 74 68 | 65 20 46 6f 72 6d 20 28 |ce to th|e Form (|
|00002fb0| 75 73 65 20 74 68 65 20 | 67 72 61 79 20 6e 6f 74 |use the |gray not|
|00002fc0| 20 74 68 65 20 62 6c 61 | 63 6b 20 62 6f 78 29 0d | the bla|ck box).|
|00002fd0| 0d 35 29 20 53 61 76 65 | 20 49 42 2c 20 63 6f 6d |.5) Save| IB, com|
|00002fe0| 70 69 6c 65 20 61 6e 64 | 20 72 75 6e 2e 0d 0d 03 |pile and| run....|
|00002ff0| e5 fc 00 48 02 0a 00 48 | 00 0e 01 b0 06 30 f7 ff |...H...H|.....0..|
|00003000| 00 15 12 01 f7 45 78 61 | 6d 70 6c 65 3a 20 48 69 |.....Exa|mple: Hi|
|00003010| 4c 6f ff 00 15 0a 00 f7 | 0d fc 00 5a 02 0a 00 5a |Lo......|...Z...Z|
|00003020| 00 0e 01 b0 06 30 f7 0d | 53 75 70 70 6f 73 65 20 |.....0..|Suppose |
|00003030| 77 65 20 77 61 6e 74 65 | 64 20 74 6f 20 77 72 69 |we wante|d to wri|
|00003040| 74 65 20 74 68 65 20 61 | 20 73 69 6d 70 6c 65 20 |te the a| simple |
|00003050| 67 61 6d 65 20 63 61 6c | 6c 65 64 20 48 69 4c 6f |game cal|led HiLo|
|00003060| 2e 20 20 54 68 65 20 63 | 6f 6d 70 75 74 65 72 20 |. The c|omputer |
|00003070| 72 61 6e 64 6f 6d 6c 79 | 20 70 69 63 6b 73 20 61 |randomly| picks a|
|00003080| 20 6e 75 6d 62 65 72 20 | 62 65 74 77 65 65 6e 20 | number |between |
|00003090| 31 20 61 6e 64 20 31 30 | 30 2e 20 20 57 65 20 61 |1 and 10|0. We a|
|000030a0| 72 65 20 74 6f 20 67 75 | 65 73 73 20 77 68 61 74 |re to gu|ess what|
|000030b0| 20 74 68 65 20 6e 75 6d | 62 65 72 20 69 73 2e 20 | the num|ber is. |
|000030c0| 20 54 68 65 20 63 6f 6d | 70 75 74 65 72 20 77 69 | The com|puter wi|
|000030d0| 6c 6c 20 74 65 6c 6c 20 | 75 73 20 69 66 20 6f 75 |ll tell |us if ou|
|000030e0| 72 20 67 75 65 73 73 20 | 69 73 20 74 6f 6f 20 68 |r guess |is too h|
|000030f0| 69 67 68 20 6f 72 20 74 | 6f 20 6c 6f 77 2e 20 20 |igh or t|o low. |
|00003100| 54 68 65 20 75 73 65 72 | 20 69 6e 74 65 72 66 61 |The user| interfa|
|00003110| 63 65 20 74 6f 20 74 68 | 69 73 20 70 72 6f 67 72 |ce to th|is progr|
|00003120| 61 6d 20 6d 69 67 68 74 | 20 6c 6f 6f 6b 20 6c 69 |am might| look li|
|00003130| 6b 65 20 74 68 65 20 66 | 6f 6c 6c 6f 77 69 6e 67 |ke the f|ollowing|
|00003140| 20 64 69 61 6c 6f 67 3a | 0d 0d fc 00 90 02 0a 00 | dialog:|........|
|00003150| 90 00 0e 06 30 f7 ff 00 | 16 0a 00 f7 24 20 68 69 |....0...|....$ hi|
|00003160| 6c 6f 0d 47 75 65 73 73 | 20 61 20 6e 75 6d 62 65 |lo.Guess| a numbe|
|00003170| 72 20 66 72 6f 6d 20 31 | 20 74 6f 20 31 30 30 3a |r from 1| to 100:|
|00003180| 20 35 30 0d 47 75 65 73 | 73 20 31 20 69 73 20 74 | 50.Gues|s 1 is t|
|00003190| 6f 6f 20 68 69 67 68 0d | 47 75 65 73 73 20 61 20 |oo high.|Guess a |
|000031a0| 6e 75 6d 62 65 72 20 66 | 72 6f 6d 20 31 20 74 6f |number f|rom 1 to|
|000031b0| 20 31 30 30 3a 20 32 35 | 0d 47 75 65 73 73 20 32 | 100: 25|.Guess 2|
|000031c0| 20 69 73 20 74 6f 6f 20 | 6c 6f 77 0d 47 75 65 73 | is too |low.Gues|
|000031d0| 73 20 61 20 6e 75 6d 62 | 65 72 20 66 72 6f 6d 20 |s a numb|er from |
|000031e0| 31 20 74 6f 20 31 30 30 | 3a 20 34 30 0d 47 75 65 |1 to 100|: 40.Gue|
|000031f0| 73 73 20 33 20 69 73 20 | 74 6f 6f 20 68 69 67 68 |ss 3 is |too high|
|00003200| 0d 47 75 65 73 73 20 61 | 20 6e 75 6d 62 65 72 20 |.Guess a| number |
|00003210| 66 72 6f 6d 20 31 20 74 | 6f 20 31 30 30 3a 20 33 |from 1 t|o 100: 3|
|00003220| 35 0d 47 75 65 73 73 20 | 34 20 69 73 20 74 6f 6f |5.Guess |4 is too|
|00003230| 20 6c 6f 77 0d 47 75 65 | 73 73 20 61 20 6e 75 6d | low.Gue|ss a num|
|00003240| 62 65 72 20 66 72 6f 6d | 20 31 20 74 6f 20 31 30 |ber from| 1 to 10|
|00003250| 30 3a 20 33 37 0d 47 75 | 65 73 73 20 35 20 69 73 |0: 37.Gu|ess 5 is|
|00003260| 20 74 6f 6f 20 6c 6f 77 | 0d 47 75 65 73 73 20 61 | too low|.Guess a|
|00003270| 20 6e 75 6d 62 65 72 20 | 66 72 6f 6d 20 31 20 74 | number |from 1 t|
|00003280| 6f 20 31 30 30 3a 20 33 | 38 0d 43 6f 72 72 65 63 |o 100: 3|8.Correc|
|00003290| 74 20 69 6e 20 36 20 67 | 75 65 73 73 65 73 21 0d |t in 6 g|uesses!.|
|000032a0| 44 6f 20 79 6f 75 20 77 | 61 6e 74 20 74 6f 20 70 |Do you w|ant to p|
|000032b0| 6c 61 79 20 61 67 61 69 | 6e 20 28 79 2f 6e 29 3f |lay agai|n (y/n)?|
|000032c0| 20 6e 0d 24 0d ff 00 15 | 0a 00 f7 fc 00 5a 02 0a | n.$....|.....Z..|
|000032d0| 00 5a 00 0e 01 b0 06 30 | f7 0d 49 66 20 77 65 20 |.Z.....0|..If we |
|000032e0| 75 73 65 20 74 68 65 20 | 74 72 61 64 69 74 69 6f |use the |traditio|
|000032f0| 6e 61 6c 20 43 20 61 70 | 70 72 6f 61 63 68 2c 20 |nal C ap|proach, |
|00003300| 77 65 20 77 6f 75 6c 64 | 20 61 6c 77 61 79 73 20 |we would| always |
|00003310| 74 68 69 6e 6b 20 6f 66 | 20 73 74 61 72 74 69 6e |think of| startin|
|00003320| 67 20 61 74 20 61 20 6d | 61 69 6e 2e 20 20 57 65 |g at a m|ain. We|
|00003330| 20 77 6f 75 6c 64 20 68 | 61 76 65 20 74 68 65 20 | would h|ave the |
|00003340| 63 6f 6d 70 75 74 65 72 | 20 70 69 63 6b 20 61 20 |computer| pick a |
|00003350| 72 61 6e 64 6f 6d 20 6e | 75 6d 62 65 72 20 61 6e |random n|umber an|
|00003360| 64 20 74 68 65 6e 20 77 | 65 20 77 6f 75 6c 64 20 |d then w|e would |
|00003370| 75 73 65 20 22 6c 6f 6f | 70 73 22 20 75 73 69 6e |use "loo|ps" usin|
|00003380| 67 20 63 6f 6d 6d 61 6e | 64 73 20 73 75 63 68 20 |g comman|ds such |
|00003390| 61 73 20 22 66 6f 72 22 | 2c 20 22 77 68 69 6c 65 |as "for"|, "while|
|000033a0| 22 20 6f 72 20 22 72 65 | 70 65 61 74 22 20 75 6e |" or "re|peat" un|
|000033b0| 74 69 6c 20 74 68 65 20 | 75 73 65 72 20 67 65 74 |til the |user get|
|000033c0| 73 20 74 68 65 20 63 6f | 72 72 65 63 74 20 61 6e |s the co|rrect an|
|000033d0| 73 77 65 72 2e 0d 03 f9 | 0d fc 00 6c 02 0a 00 6c |swer....|...l...l|
|000033e0| 00 0e 02 1c 06 30 f7 57 | 49 74 68 20 65 76 65 6e |.....0.W|Ith even|
|000033f0| 74 20 62 61 73 65 64 20 | 70 72 6f 67 72 61 6d 6d |t based |programm|
|00003400| 69 6e 67 2c 20 77 65 20 | 73 69 6d 70 6c 79 20 22 |ing, we |simply "|
|00003410| 64 72 61 77 22 20 74 68 | 65 20 75 73 65 72 20 69 |draw" th|e user i|
|00003420| 6e 74 65 72 66 61 63 65 | 20 61 6e 64 20 74 68 65 |nterface| and the|
|00003430| 6e 20 70 75 74 20 63 6f | 64 65 20 62 65 68 69 6e |n put co|de behin|
|00003440| 64 20 61 6c 6c 20 6f 66 | 20 74 68 65 20 65 76 65 |d all of| the eve|
|00003450| 6e 74 73 20 74 68 61 74 | 20 63 6f 75 6c 64 20 6f |nts that| could o|
|00003460| 63 63 75 72 2e 20 28 53 | 65 65 20 66 69 67 75 72 |ccur. (S|ee figur|
|00003470| 65 20 32 29 2e 20 20 49 | 6e 20 74 68 69 73 20 63 |e 2). I|n this c|
|00003480| 61 73 65 2c 20 69 66 20 | 74 68 65 20 75 73 65 72 |ase, if |the user|
|00003490| 20 65 6e 74 65 72 65 64 | 20 61 20 6e 75 6d 62 65 | entered| a numbe|
|000034a0| 72 20 77 65 20 77 6f 75 | 6c 64 20 77 61 6e 74 20 |r we wou|ld want |
|000034b0| 74 6f 20 63 68 65 63 6b | 20 66 6f 72 20 61 20 6d |to check| for a m|
|000034c0| 61 74 63 68 2c 20 63 68 | 65 63 6b 20 74 6f 20 73 |atch, ch|eck to s|
|000034d0| 65 65 20 69 66 20 74 68 | 65 20 75 73 65 72 20 77 |ee if th|e user w|
|000034e0| 61 73 20 74 6f 6f 20 68 | 69 67 68 20 6f 72 20 74 |as too h|igh or t|
|000034f0| 6f 6f 20 6c 6f 77 2c 20 | 61 6e 64 20 74 68 65 6e |oo low, |and then|
|00003500| 20 75 70 64 61 74 65 20 | 74 68 65 20 63 6f 72 72 | update |the corr|
|00003510| 65 63 74 20 61 72 65 61 | 73 20 6f 66 20 74 68 65 |ect area|s of the|
|00003520| 20 73 63 72 65 65 6e 2e | 20 20 4e 6f 74 69 63 65 | screen.| Notice|
|00003530| 20 74 68 61 74 20 77 65 | 20 77 6f 75 6c 64 20 6e | that we| would n|
|00003540| 6f 74 20 6e 65 65 64 20 | 74 6f 20 63 68 65 63 6b |ot need |to check|
|00003550| 20 74 6f 20 73 65 65 20 | 69 66 20 74 68 65 20 75 | to see |if the u|
|00003560| 73 65 72 20 77 61 6e 74 | 73 20 74 6f 20 73 74 61 |ser want|s to sta|
|00003570| 72 74 20 61 20 6e 65 77 | 20 67 61 6d 65 20 69 6e |rt a new| game in|
|00003580| 20 74 68 65 20 65 76 65 | 6e 74 20 68 61 6e 64 6c | the eve|nt handl|
|00003590| 65 72 20 66 6f 72 20 74 | 68 65 20 69 6e 70 75 74 |er for t|he input|
|000035a0| 20 74 65 78 74 20 66 6f | 72 6d 2e 20 20 20 41 6c | text fo|rm. Al|
|000035b0| 6c 20 6f 66 20 74 68 61 | 74 20 63 6f 64 65 20 69 |l of tha|t code i|
|000035c0| 73 20 6e 65 61 74 6c 79 | 20 73 65 70 65 72 61 74 |s neatly| seperat|
|000035d0| 65 64 20 6f 75 74 20 61 | 6e 64 20 70 75 74 20 69 |ed out a|nd put i|
|000035e0| 6e 20 74 68 65 20 65 76 | 65 6e 74 20 68 61 6e 64 |n the ev|ent hand|
|000035f0| 6c 65 72 20 66 6f 72 20 | 74 68 65 20 4e 65 77 20 |ler for |the New |
|00003600| 47 61 6d 65 20 62 75 74 | 74 6f 6e 2e 20 20 54 68 |Game but|ton. Th|
|00003610| 65 20 63 6f 64 65 20 74 | 6f 20 68 61 6e 64 6c 65 |e code t|o handle|
|00003620| 20 65 61 63 68 20 65 76 | 65 6e 74 20 69 73 20 70 | each ev|ent is p|
|00003630| 75 74 20 69 6e 20 61 20 | 63 6c 65 61 72 20 70 6c |ut in a |clear pl|
|00003640| 61 63 65 20 74 68 61 74 | 20 63 6f 72 72 69 73 70 |ace that| corrisp|
|00003650| 6f 6e 64 73 20 74 6f 20 | 74 68 65 20 65 76 65 6e |onds to |the even|
|00003660| 74 20 74 68 61 74 20 69 | 74 20 73 68 6f 75 6c 64 |t that i|t should|
|00003670| 20 68 61 6e 64 6c 65 2e | 20 20 57 65 20 64 6f 6e | handle.| We don|
|00003680| 27 74 20 6e 65 65 64 20 | 74 6f 20 62 65 20 63 6f |'t need |to be co|
|00003690| 6e 63 65 72 6e 65 64 20 | 61 62 6f 75 74 20 74 68 |ncerned |about th|
|000036a0| 65 20 6d 61 69 6e 20 6c | 6f 6f 70 20 66 6f 72 20 |e main l|oop for |
|000036b0| 74 68 65 20 67 61 6d 65 | 20 61 6e 64 20 74 68 65 |the game| and the|
|000036c0| 20 6c 6f 6f 70 20 74 68 | 61 74 20 63 6f 6e 73 74 | loop th|at const|
|000036d0| 61 6e 74 6c 79 20 63 68 | 65 63 6b 73 20 66 6f 72 |antly ch|ecks for|
|000036e0| 20 74 68 65 20 63 6f 72 | 72 65 63 74 20 61 6e 73 | the cor|rect ans|
|000036f0| 77 65 72 2e 20 20 4f 6e | 65 20 6f 66 20 74 68 65 |wer. On|e of the|
|00003700| 20 61 64 64 65 64 20 62 | 65 6e 65 66 69 74 73 20 | added b|enefits |
|00003710| 74 68 65 20 75 73 65 72 | 20 63 61 6e 20 73 74 61 |the user| can sta|
|00003720| 72 74 20 61 20 6e 65 77 | 20 67 61 6d 65 20 77 68 |rt a new| game wh|
|00003730| 65 6e 65 76 65 72 20 74 | 68 65 79 20 77 61 6e 74 |enever t|hey want|
|00003740| 2e 20 20 54 68 69 73 20 | 69 73 20 6a 75 73 74 20 |. This |is just |
|00003750| 6f 6e 65 20 65 78 61 6d | 70 6c 65 20 6f 66 20 22 |one exam|ple of "|
|00003760| 75 73 65 72 20 66 72 65 | 69 6e 64 6c 79 6e 65 73 |user fre|indlynes|
|00003770| 73 22 20 63 68 61 72 61 | 63 74 65 72 69 73 74 69 |s" chara|cteristi|
|00003780| 63 20 6f 66 20 65 76 65 | 6e 74 20 62 61 73 65 64 |c of eve|nt based|
|00003790| 20 70 72 6f 67 72 61 6d | 73 2e 20 20 54 68 65 20 | program|s. The |
|000037a0| 75 73 65 72 20 69 6e 74 | 65 61 63 74 73 20 69 6e |user int|eacts in|
|000037b0| 20 74 77 6f 20 64 69 6d | 65 6e 73 69 6f 6e 73 20 | two dim|ensions |
|000037c0| 72 61 74 68 65 72 20 74 | 68 65 6e 20 6f 6e 65 2e |rather t|hen one.|
|000037d0| 0d 00 10 0d fc 00 5a 02 | 0a 00 5a 00 0e 01 b0 06 |......Z.|..Z.....|
|000037e0| 30 f7 0d 02 90 46 69 67 | 75 72 65 20 32 20 2d 20 |0....Fig|ure 2 - |
|000037f0| 47 72 61 70 68 69 63 61 | 6c 20 49 6e 74 65 72 66 |Graphica|l Interf|
|00003800| 61 63 65 20 66 6f 72 20 | 48 69 4c 6f 0d fc 00 5a |ace for |HiLo...Z|
|00003810| 02 0a 00 5a 00 0e 01 b0 | 06 30 f7 0d fc 00 6c 02 |...Z....|.0....l.|
|00003820| 0a 00 6c 00 0e 02 18 06 | 30 f7 49 6e 20 74 68 69 |..l.....|0.In thi|
|00003830| 73 20 65 78 61 6d 70 6c | 65 20 6f 75 72 20 6f 62 |s exampl|e our ob|
|00003840| 6a 65 63 74 20 63 6f 6e | 74 61 69 6e 73 20 74 77 |ject con|tains tw|
|00003850| 6f 20 65 76 65 6e 74 73 | 2e 20 20 4f 6e 65 20 65 |o events|. One e|
|00003860| 76 65 6e 74 20 77 69 6c | 6c 20 62 65 20 74 68 65 |vent wil|l be the|
|00003870| 20 75 73 65 72 20 65 6e | 74 65 72 69 6e 67 20 61 | user en|tering a|
|00003880| 20 6e 65 77 20 67 75 65 | 73 73 2e 20 20 54 68 65 | new gue|ss. The|
|00003890| 20 6f 74 68 65 72 20 77 | 69 6c 6c 20 62 65 20 74 | other w|ill be t|
|000038a0| 68 65 20 65 76 65 6e 74 | 20 63 61 75 73 65 64 20 |he event| caused |
|000038b0| 77 68 65 6e 20 74 68 65 | 20 4e 65 77 20 47 61 6d |when the| New Gam|
|000038c0| 65 20 62 75 74 74 6f 6e | 20 69 73 20 73 65 6c 65 |e button| is sele|
|000038d0| 63 74 65 64 2e 20 20 54 | 68 65 73 65 20 65 76 65 |cted. T|hese eve|
|000038e0| 6e 74 73 20 63 61 6e 20 | 68 61 70 70 65 6e 20 61 |nts can |happen a|
|000038f0| 74 20 61 6e 79 20 74 69 | 6d 65 2e 20 20 57 65 20 |t any ti|me. We |
|00003900| 77 69 6c 6c 20 61 6c 73 | 6f 20 68 61 76 65 20 74 |will als|o have t|
|00003910| 77 6f 20 6f 75 74 6c 65 | 74 73 20 2d 20 6f 6e 65 |wo outle|ts - one|
|00003920| 20 66 6f 72 20 73 65 6e | 64 69 6e 67 20 61 20 68 | for sen|ding a h|
|00003930| 69 6e 74 20 6d 65 73 73 | 61 67 65 20 74 6f 20 61 |int mess|age to a|
|00003940| 6e 64 20 6f 6e 65 20 66 | 6f 72 20 75 70 64 61 74 |nd one f|or updat|
|00003950| 65 69 6e 67 20 74 68 65 | 20 6e 75 6d 62 65 72 20 |eing the| number |
|00003960| 6f 66 20 74 72 79 73 2e | 20 20 54 68 65 20 68 65 |of trys.| The he|
|00003970| 61 64 65 72 20 66 69 6c | 65 20 66 6f 72 20 61 20 |ader fil|e for a |
|00003980| 48 69 4c 6f 20 6f 62 6a | 65 63 74 20 22 48 69 4c |HiLo obj|ect "HiL|
|00003990| 6f 2e 68 22 20 77 69 6c | 6c 20 62 65 20 74 68 65 |o.h" wil|l be the|
|000039a0| 20 66 6f 6c 6c 6f 77 69 | 6e 67 3a 0d fc 00 5a 02 | followi|ng:...Z.|
|000039b0| 0a 00 5a 00 0e 01 b0 06 | 30 f7 0d fc 00 90 02 0a |..Z.....|0.......|
|000039c0| 00 90 00 0e 02 ac 03 18 | 06 30 f7 ff 00 16 0a 00 |........|.0......|
|000039d0| f7 23 69 6d 70 6f 72 74 | 20 3c 6f 62 6a 63 2f 4f |.#import| <objc/O|
|000039e0| 62 6a 65 63 74 2e 68 3e | 0d 40 69 6e 74 65 72 66 |bject.h>|.@interf|
|000039f0| 61 63 65 20 48 69 4c 6f | 3a 4f 62 6a 65 63 74 0d |ace HiLo|:Object.|
|00003a00| 7b 0d 20 20 20 20 69 64 | 20 68 69 6e 74 3b 0d 20 |{. id| hint;. |
|00003a10| 20 20 20 69 64 20 6e 75 | 6d 62 65 72 47 75 65 73 | id nu|mberGues|
|00003a20| 73 65 73 3b 0d 20 20 20 | 20 69 6e 74 20 6e 75 6d |ses;. | int num|
|00003a30| 62 65 72 3b 0d 20 20 20 | 20 69 6e 74 20 6e 75 6d |ber;. | int num|
|00003a40| 62 65 72 4f 66 47 75 65 | 73 73 65 73 3b 0d 20 20 |berOfGue|sses;. |
|00003a50| 20 20 69 6e 74 20 61 6e | 73 77 65 72 3b 0d 7d 0d | int an|swer;.}.|
|00003a60| 0d 2d 20 73 65 74 48 69 | 6e 74 3a 61 6e 4f 62 6a |.- setHi|nt:anObj|
|00003a70| 65 63 74 3b 0d 03 cc 2d | 20 73 65 74 4e 75 6d 62 |ect;...-| setNumb|
|00003a80| 65 72 47 75 65 73 73 65 | 73 3a 61 6e 4f 62 6a 65 |erGuesse|s:anObje|
|00003a90| 63 74 3b 0d 2d 20 6e 65 | 77 47 61 6d 65 3a 73 65 |ct;.- ne|wGame:se|
|00003aa0| 6e 64 65 72 3b 0d 2d 20 | 67 75 65 73 73 3a 73 65 |nder;.- |guess:se|
|00003ab0| 6e 64 65 72 3b 0d 0d 40 | 65 6e 64 ff 00 15 0a 00 |nder;..@|end.....|
|00003ac0| f7 0d fc 00 5a 02 0a 00 | 5a 00 0e 01 b0 06 30 f7 |....Z...|Z.....0.|
|00003ad0| 0d 54 68 65 20 6d 61 69 | 6e 20 70 72 6f 67 72 61 |.The mai|n progra|
|00003ae0| 6d 20 69 73 20 6c 69 73 | 74 65 64 20 62 65 6c 6f |m is lis|ted belo|
|00003af0| 77 3a 0d 0d fc 00 8f 02 | 0a 00 8f 00 0e 02 ac 03 |w:......|........|
|00003b00| 18 06 30 f7 ff 00 16 08 | 00 f7 23 69 6d 70 6f 72 |..0.....|..#impor|
|00003b10| 74 20 22 48 69 4c 6f 2e | 68 22 0d 23 69 6d 70 6f |t "HiLo.|h".#impo|
|00003b20| 72 74 20 3c 73 74 64 69 | 6f 2e 68 3e 0d 23 69 6d |rt <stdi|o.h>.#im|
|00003b30| 70 6f 72 74 20 3c 61 70 | 70 6b 69 74 2f 46 6f 72 |port <ap|pkit/For|
|00003b40| 6d 2e 68 3e 0d 0d 40 69 | 6d 70 6c 65 6d 65 6e 74 |m.h>..@i|mplement|
|00003b50| 61 74 69 6f 6e 20 48 69 | 4c 6f 0d 0d 2f 2f 20 54 |ation Hi|Lo..// T|
|00003b60| 68 69 73 20 77 69 6c 6c | 20 72 75 6e 20 77 68 65 |his will| run whe|
|00003b70| 6e 20 77 65 20 73 74 61 | 72 74 20 74 68 65 20 70 |n we sta|rt the p|
|00003b80| 72 6f 67 72 61 6d 20 2d | 20 73 65 65 20 6e 65 78 |rogram -| see nex|
|00003b90| 74 20 63 68 61 70 74 65 | 72 0d 2b 20 6e 65 77 0d |t chapte|r.+ new.|
|00003ba0| 7b 0d 09 73 65 6c 66 20 | 3d 20 5b 73 75 70 65 72 |{..self |= [super|
|00003bb0| 20 6e 65 77 5d 3b 0d 09 | 73 72 61 6e 64 6f 6d 28 | new];..|srandom(|
|00003bc0| 74 69 6d 65 28 30 29 29 | 3b 0d 09 6e 75 6d 62 65 |time(0))|;..numbe|
|00003bd0| 72 20 3d 20 28 72 61 6e | 64 6f 6d 28 29 20 25 20 |r = (ran|dom() % |
|00003be0| 31 30 30 29 20 2b 20 31 | 3b 0d 09 72 65 74 75 72 |100) + 1|;..retur|
|00003bf0| 6e 20 73 65 6c 66 3b 0d | 7d 0d 0d 2f 2f 20 74 68 |n self;.|}..// th|
|00003c00| 69 73 20 77 69 6c 6c 20 | 72 75 6e 20 77 68 65 6e |is will |run when|
|00003c10| 20 74 68 65 20 22 4e 65 | 77 20 47 61 6d 65 22 20 | the "Ne|w Game" |
|00003c20| 62 75 74 74 6f 6e 20 69 | 73 20 70 72 65 73 73 65 |button i|s presse|
|00003c30| 64 0d 2d 20 6e 65 77 47 | 61 6d 65 3a 73 65 6e 64 |d.- newG|ame:send|
|00003c40| 65 72 0d 7b 0d 09 6e 75 | 6d 62 65 72 20 3d 20 28 |er.{..nu|mber = (|
|00003c50| 72 61 6e 64 6f 6d 28 29 | 20 25 20 31 30 30 29 20 |random()| % 100) |
|00003c60| 2b 20 31 3b 0d 09 6e 75 | 6d 62 65 72 4f 66 47 75 |+ 1;..nu|mberOfGu|
|00003c70| 65 73 73 65 73 20 3d 20 | 30 3b 0d 09 5b 6e 75 6d |esses = |0;..[num|
|00003c80| 62 65 72 47 75 65 73 73 | 65 73 20 73 65 74 49 6e |berGuess|es setIn|
|00003c90| 74 56 61 6c 75 65 3a 30 | 5d 3b 0d 09 72 65 74 75 |tValue:0|];..retu|
|00003ca0| 72 6e 20 73 65 6c 66 3b | 0d 7d 0d 0d 2f 2f 20 74 |rn self;|.}..// t|
|00003cb0| 68 69 73 20 77 69 6c 6c | 20 72 75 6e 20 77 68 65 |his will| run whe|
|00003cc0| 6e 20 74 68 65 20 61 20 | 67 75 65 73 73 20 69 73 |n the a |guess is|
|00003cd0| 20 65 6e 74 65 72 65 64 | 0d 2d 20 67 75 65 73 73 | entered|.- guess|
|00003ce0| 3a 73 65 6e 64 65 72 0d | 7b 0d 09 61 6e 73 77 65 |:sender.|{..answe|
|00003cf0| 72 20 3d 20 5b 73 65 6e | 64 65 72 20 69 6e 74 56 |r = [sen|der intV|
|00003d00| 61 6c 75 65 5d 3b 0d 09 | 69 66 20 28 61 6e 73 77 |alue];..|if (answ|
|00003d10| 65 72 20 3e 20 6e 75 6d | 62 65 72 29 20 7b 0d 09 |er > num|ber) {..|
|00003d20| 09 5b 68 69 6e 74 20 73 | 65 74 53 74 72 69 6e 67 |.[hint s|etString|
|00003d30| 56 61 6c 75 65 3a 22 54 | 6f 6f 20 48 69 67 68 22 |Value:"T|oo High"|
|00003d40| 5d 3b 0d 09 7d 0d 09 65 | 6c 73 65 20 69 66 20 28 |];..}..e|lse if (|
|00003d50| 61 6e 73 77 65 72 20 3c | 20 6e 75 6d 62 65 72 29 |answer <| number)|
|00003d60| 20 7b 0d 20 20 20 20 09 | 5b 68 69 6e 74 20 73 65 | {. .|[hint se|
|00003d70| 74 53 74 72 69 6e 67 56 | 61 6c 75 65 3a 22 54 6f |tStringV|alue:"To|
|00003d80| 6f 20 4c 6f 77 22 5d 3b | 0d 09 7d 0d 09 65 6c 73 |o Low"];|..}..els|
|00003d90| 65 20 69 66 20 28 61 6e | 73 77 65 72 20 3d 3d 20 |e if (an|swer == |
|00003da0| 6e 75 6d 62 65 72 29 20 | 7b 0d 09 20 09 5b 68 69 |number) |{.. .[hi|
|00003db0| 6e 74 20 73 65 74 53 74 | 72 69 6e 67 56 61 6c 75 |nt setSt|ringValu|
|00003dc0| 65 3a 22 54 68 61 74 20 | 69 73 20 43 6f 72 72 65 |e:"That |is Corre|
|00003dd0| 63 74 21 22 5d 3b 0d 09 | 7d 0d 09 6e 75 6d 62 65 |ct!"];..|}..numbe|
|00003de0| 72 4f 66 47 75 65 73 73 | 65 73 2b 2b 3b 0d 09 5b |rOfGuess|es++;..[|
|00003df0| 6e 75 6d 62 65 72 47 75 | 65 73 73 65 73 20 73 65 |numberGu|esses se|
|00003e00| 74 49 6e 74 56 61 6c 75 | 65 3a 6e 75 6d 62 65 72 |tIntValu|e:number|
|00003e10| 4f 66 47 75 65 73 73 65 | 73 5d 3b 0d 09 5b 73 65 |OfGuesse|s];..[se|
|00003e20| 6e 64 65 72 20 73 65 6c | 65 63 74 54 65 78 74 41 |nder sel|ectTextA|
|00003e30| 74 3a 30 5d 3b 0d 72 65 | 74 75 72 6e 20 73 65 6c |t:0];.re|turn sel|
|00003e40| 66 3b 0d 03 50 7d 0d 40 | 65 6e 64 ff 00 15 0a 00 |f;..P}.@|end.....|
|00003e50| f7 0d fc 00 5a 02 0a 00 | 5a 00 0e 01 b0 06 30 f7 |....Z...|Z.....0.|
|00003e60| 0d fc 00 48 02 0a 00 48 | 00 0e 01 b0 06 30 f7 ff |...H...H|.....0..|
|00003e70| 00 15 12 01 f7 45 78 61 | 6d 70 6c 65 3a 20 55 73 |.....Exa|mple: Us|
|00003e80| 69 6e 67 20 61 20 54 65 | 78 74 20 6f 62 6a 65 63 |ing a Te|xt objec|
|00003e90| 74 ff 00 15 0a 00 f7 0d | fc 00 5a 02 0a 00 5a 00 |t.......|..Z...Z.|
|00003ea0| 0e 01 b0 06 30 f7 0d fc | 00 6c 02 0a 00 6c 00 0e |....0...|.l...l..|
|00003eb0| 02 1c 06 30 f7 4f 6e 65 | 20 6f 66 20 74 68 65 20 |...0.One| of the |
|00003ec0| 70 72 6f 62 6c 65 6d 73 | 20 77 69 74 68 20 74 68 |problems| with th|
|00003ed0| 65 20 22 68 65 6c 6c 6f | 2c 20 77 6f 72 6c 64 22 |e "hello|, world"|
|00003ee0| 20 70 72 6f 67 72 61 6d | 20 69 6e 20 63 68 61 70 | program| in chap|
|00003ef0| 74 65 72 20 33 20 69 73 | 20 74 68 61 74 20 79 6f |ter 3 is| that yo|
|00003f00| 75 20 68 61 76 65 20 74 | 6f 20 73 74 61 72 74 20 |u have t|o start |
|00003f10| 74 68 65 6d 20 66 72 6f | 6d 20 74 68 65 20 55 4e |them fro|m the UN|
|00003f20| 49 58 20 63 6f 6d 6d 61 | 6e 64 20 6c 69 6e 65 20 |IX comma|nd line |
|00003f30| 74 6f 20 73 65 65 20 74 | 68 65 69 72 20 6f 75 74 |to see t|heir out|
|00003f40| 70 75 74 2e 20 20 49 66 | 20 79 6f 75 20 73 74 61 |put. If| you sta|
|00003f50| 72 74 20 74 68 65 20 70 | 72 6f 67 72 61 6d 20 62 |rt the p|rogram b|
|00003f60| 79 20 64 6f 75 62 6c 65 | 20 63 6c 69 63 6b 69 6e |y double| clickin|
|00003f70| 67 20 74 68 65 20 69 63 | 6f 6e 20 66 72 6f 6d 20 |g the ic|on from |
|00003f80| 74 68 65 20 57 69 6e 64 | 6f 77 20 4d 61 6e 61 67 |the Wind|ow Manag|
|00003f90| 65 72 27 73 20 42 72 6f | 77 73 65 72 2c 20 79 6f |er's Bro|wser, yo|
|00003fa0| 75 20 77 69 6c 6c 20 6e | 6f 74 20 73 65 65 20 61 |u will n|ot see a|
|00003fb0| 6e 79 20 6f 75 74 70 75 | 74 2e 20 20 49 64 65 61 |ny outpu|t. Idea|
|00003fc0| 6c 6c 79 20 77 65 20 77 | 6f 75 6c 64 20 6c 69 6b |lly we w|ould lik|
|00003fd0| 65 20 74 6f 20 64 6f 75 | 62 6c 65 20 63 6c 69 63 |e to dou|ble clic|
|00003fe0| 6b 20 74 68 65 20 69 63 | 6f 6e 20 61 6e 64 20 73 |k the ic|on and s|
|00003ff0| 65 65 20 74 68 65 20 73 | 74 61 74 65 20 6f 66 20 |ee the s|tate of |
|00004000| 61 6e 20 6f 62 6a 65 63 | 74 20 72 65 66 6c 65 63 |an objec|t reflec|
|00004010| 74 65 64 20 69 6e 20 61 | 6e 20 6f 6e 20 73 63 72 |ted in a|n on scr|
|00004020| 65 65 6e 20 6f 62 6a 65 | 63 74 2e 20 20 54 6f 20 |een obje|ct. To |
|00004030| 64 6f 20 74 68 61 74 20 | 77 65 20 6e 65 65 64 20 |do that |we need |
|00004040| 74 6f 20 75 73 65 20 61 | 6e 20 6f 75 74 6c 65 74 |to use a|n outlet|
|00004050| 2e 20 20 54 6f 20 63 72 | 65 61 74 65 20 74 68 65 |. To cr|eate the|
|00004060| 20 70 72 6f 67 72 61 6d | 2c 20 77 65 20 64 6f 20 | program|, we do |
|00004070| 74 68 65 20 66 6f 6c 6c | 6f 77 69 6e 67 3a 0d 0d |the foll|owing:..|
|00004080| fc 00 90 02 0a 00 90 00 | 0e 02 1c 06 30 f7 ff 00 |........|....0...|
|00004090| 15 0a 01 f7 53 74 65 70 | 20 31 3a ff 00 15 0a 00 |....Step| 1:.....|
|000040a0| f7 20 57 69 74 68 69 6e | 20 49 6e 74 65 72 66 61 |. Within| Interfa|
|000040b0| 63 65 20 42 75 69 6c 64 | 65 72 2c 20 64 72 61 67 |ce Build|er, drag|
|000040c0| 20 61 6e 6f 74 68 65 72 | 20 6f 62 6a 65 63 74 20 | another| object |
|000040d0| 69 6e 20 74 68 65 20 6d | 61 69 6e 20 73 63 72 65 |in the m|ain scre|
|000040e0| 65 6e 2e 20 20 20 46 6f | 72 20 73 74 61 72 74 65 |en. Fo|r starte|
|000040f0| 72 73 20 49 20 77 6f 75 | 6c 64 20 73 75 67 67 65 |rs I wou|ld sugge|
|00004100| 73 74 20 61 20 54 65 78 | 74 20 6f 62 6a 65 63 74 |st a Tex|t object|
|00004110| 2c 20 61 6c 74 68 6f 75 | 67 68 20 73 6c 69 64 65 |, althou|gh slide|
|00004120| 72 73 20 61 6e 64 20 46 | 6f 72 6d 20 6f 62 6a 65 |rs and F|orm obje|
|00004130| 63 74 73 20 63 61 6e 20 | 61 6c 73 6f 20 64 69 73 |cts can |also dis|
|00004140| 70 6c 61 79 20 76 61 6c | 75 65 73 2e 20 20 59 6f |play val|ues. Yo|
|00004150| 75 72 20 6d 61 69 6e 20 | 77 69 6e 64 6f 77 20 73 |ur main |window s|
|00004160| 68 6f 75 6c 64 20 6c 6f | 6f 6b 20 61 20 62 69 74 |hould lo|ok a bit|
|00004170| 20 6c 69 6b 65 20 74 68 | 65 20 66 6f 6c 6c 6f 77 | like th|e follow|
|00004180| 69 6e 67 3a 0d 0d fc 00 | 90 02 0a 00 90 02 0e 02 |ing:....|........|
|00004190| 1c 06 30 f7 0d 02 06 fc | 00 b4 02 0a 00 b4 00 0e |..0.....|........|
|000041a0| 03 64 06 30 f7 0d fc 00 | 90 02 0a 00 90 00 0e 02 |.d.0....|........|
|000041b0| d0 06 30 f7 ff 00 15 0a | 01 f7 53 74 65 70 20 33 |..0.....|..Step 3|
|000041c0| ff 00 15 0a 00 f7 3a 20 | 53 61 76 65 20 61 6c 6c |......: |Save all|
|000041d0| 20 79 6f 75 72 20 66 69 | 6c 65 73 20 61 6e 64 20 | your fi|les and |
|000041e0| 72 75 6e 20 6d 61 6b 65 | 2e 0d fc 00 5a 02 0a 00 |run make|....Z...|
|000041f0| 5a 00 0e 01 b0 06 30 f7 | 0d 0d fc 00 6b 02 0a 00 |Z.....0.|....k...|
|00004200| 5b 00 0e 06 30 f7 33 2d | 36 20 54 68 65 20 70 72 |[...0.3-|6 The pr|
|00004210| 6f 67 72 61 6d 20 68 61 | 73 20 61 20 6c 69 6d 69 |ogram ha|s a limi|
|00004220| 74 61 74 69 6f 6e 20 6f | 6e 20 74 68 65 20 6e 75 |tation o|n the nu|
|00004230| 6d 62 65 72 20 6f 66 20 | 6c 69 6e 65 73 20 74 68 |mber of |lines th|
|00004240| 61 74 20 63 61 6e 20 62 | 65 20 64 69 73 70 6c 61 |at can b|e displa|
|00004250| 79 65 64 20 69 6e 20 61 | 20 74 65 78 74 20 6f 62 |yed in a| text ob|
|00004260| 6a 65 63 74 2e 20 20 41 | 66 74 65 72 20 74 68 65 |ject. A|fter the|
|00004270| 20 74 65 78 74 20 6f 62 | 6a 65 63 74 20 69 73 20 | text ob|ject is |
|00004280| 66 75 6c 6c 20 79 6f 75 | 20 63 61 6e 20 6e 6f 74 |full you| can not|
|00004290| 20 73 65 65 20 61 6e 79 | 20 6e 65 77 20 6c 69 6e | see any| new lin|
|000042a0| 65 73 20 74 68 61 74 20 | 61 72 65 20 61 64 64 65 |es that |are adde|
|000042b0| 64 20 61 74 20 74 68 65 | 20 62 6f 74 74 6f 6d 2e |d at the| bottom.|
|000042c0| 20 20 49 66 20 69 6e 73 | 74 65 61 64 20 6f 66 20 | If ins|tead of |
|000042d0| 75 73 69 6e 67 20 61 6e | 20 6f 72 64 69 6e 61 72 |using an| ordinar|
|000042e0| 79 20 74 65 78 74 20 6f | 62 6a 65 63 74 20 77 65 |y text o|bject we|
|000042f0| 20 75 73 65 64 20 61 20 | 73 63 72 6f 6c 6c 69 6e | used a |scrollin|
|00004300| 67 20 74 65 78 74 20 6f | 62 6a 65 63 74 20 61 20 |g text o|bject a |
|00004310| 73 63 72 6f 6c 6c 69 6e | 67 20 76 69 65 77 20 77 |scrollin|g view w|
|00004320| 6f 75 6c 64 20 61 70 70 | 65 61 72 20 6f 6e 63 65 |ould app|ear once|
|00004330| 20 74 68 65 20 74 65 78 | 74 20 6f 62 6a 65 63 74 | the tex|t object|
|00004340| 20 77 61 73 20 66 75 6c | 6c 2e 20 20 53 65 65 20 | was ful|l. See |
|00004350| 65 78 61 6d 70 6c 65 20 | 70 72 6f 67 72 61 6d 20 |example |program |
|00004360| 30 31 63 2e 68 65 6c 6c | 6f 5f 73 63 72 6f 6c 6c |01c.hell|o_scroll|
|00004370| 20 66 6f 72 20 61 20 64 | 65 6d 6f 6e 73 74 72 61 | for a d|emonstra|
|00004380| 74 69 6f 6e 20 6f 66 20 | 68 6f 77 20 74 68 69 73 |tion of |how this|
|00004390| 20 77 6f 75 6c 64 20 77 | 6f 72 6b 2e 0d 00 ae 64 | would w|ork....d|
|000043a0| 00 0a 5d 00 2a a6 00 09 | b9 00 00 a7 00 02 90 01 |..].*...|........|
|000043b0| 88 64 00 15 90 00 7e 64 | 00 18 1a 01 94 64 00 1f |.d....~d|.....d..|
|000043c0| fb 00 9a 64 00 22 7e 00 | 70 05 00 0c 9e 00 79 64 |...d."~.|p.....yd|
|000043d0| 00 0c c1 00 e4 64 00 0f | e2 01 27 74 00 23 86 01 |.....d..|..'t.#..|
|000043e0| 6c 64 00 26 60 00 7f 64 | 00 29 1f 01 10 44 00 2d |ld.&`..d|.)...D.-|
|000043f0| 9d 00 38 05 00 11 f8 00 | 71 44 00 2e 33 00 c4 64 |..8.....|qD..3..d|
|00004400| 00 2f ef 01 65 64 00 12 | 1f 01 dc 44 00 33 d6 00 |./..ed..|...D.3..|
|00004410| a8 44 00 37 d1 00 1c 45 | 00 0a 2e 01 0a 64 00 37 |.D.7...E|.....d.7|
|00004420| e3 01 0a 64 00 3a 75 02 | af 64 00 3e 43 00 e9 05 |...d.:u.|.d.>C...|
|00004430| 00 02 b3 00 df 44 00 02 | d6 00 62 64 00 04 65 01 |.....D..|..bd..e.|
|00004440| 5e 64 00 07 21 01 44 64 | 00 41 95 00 7e 02 44 fc |^d..!.Dd|.A..~.D.|
|00004450| 00 b4 02 0a 00 b4 00 0e | 03 64 06 30 f7 0d fc 00 |........|.d.0....|
|00004460| 90 02 0a 00 90 00 0e 02 | d0 06 30 f7 ff 00 15 0a |........|..0.....|
|00004470| 01 f7 53 74 65 70 20 33 | ff 00 15 0a 00 f7 3a 20 |..Step 3|......: |
|00004480| 53 61 76 65 20 61 6c 6c | 20 79 6f 75 72 20 66 69 |Save all| your fi|
|00004490| 6c 65 73 20 61 6e 64 20 | 72 75 6e 20 6d 61 6b 65 |les and |run make|
|000044a0| 2e 0d fc 00 5a 02 0a 00 | 5a 00 0e 01 b0 06 30 f7 |....Z...|Z.....0.|
|000044b0| 0d 0d fc 00 48 02 0a 00 | 48 00 0e 01 b0 06 30 f7 |....H...|H.....0.|
|000044c0| ff 00 15 12 01 f7 45 78 | 61 6d 70 6c 65 3a 20 55 |......Ex|ample: U|
|000044d0| 73 69 6e 67 20 61 20 53 | 63 72 6f 6c 6c 69 6e 67 |sing a S|crolling|
|000044e0| 20 54 65 78 74 20 6f 62 | 6a 65 63 74 0d ff 00 15 | Text ob|ject....|
|000044f0| 0a 00 f7 0d fc 00 6c 02 | 0a 00 6c 00 0e 06 30 f7 |......l.|..l...0.|
|00004500| 54 68 65 20 70 72 6f 67 | 72 61 6d 20 68 61 73 20 |The prog|ram has |
|00004510| 61 20 6c 69 6d 69 74 61 | 74 69 6f 6e 20 6f 6e 20 |a limita|tion on |
|00004520| 74 68 65 20 6e 75 6d 62 | 65 72 20 6f 66 20 6c 69 |the numb|er of li|
|00004530| 6e 65 73 20 74 68 61 74 | 20 63 61 6e 20 62 65 20 |nes that| can be |
|00004540| 64 69 73 70 6c 61 79 65 | 64 20 69 6e 20 61 20 74 |displaye|d in a t|
|00004550| 65 78 74 20 6f 62 6a 65 | 63 74 2e 20 20 41 66 74 |ext obje|ct. Aft|
|00004560| 65 72 20 74 68 65 20 74 | 65 78 74 20 6f 62 6a 65 |er the t|ext obje|
|00004570| 63 74 20 69 73 20 66 75 | 6c 6c 20 79 6f 75 20 63 |ct is fu|ll you c|
|00004580| 61 6e 20 6e 6f 74 20 73 | 65 65 20 61 6e 79 20 6e |an not s|ee any n|
|00004590| 65 77 20 6c 69 6e 65 73 | 20 74 68 61 74 20 61 72 |ew lines| that ar|
|000045a0| 65 20 61 64 64 65 64 20 | 61 74 20 74 68 65 20 62 |e added |at the b|
|000045b0| 6f 74 74 6f 6d 2e 20 20 | 49 66 20 69 6e 73 74 65 |ottom. |If inste|
|000045c0| 61 64 20 6f 66 20 75 73 | 69 6e 67 20 61 6e 20 6f |ad of us|ing an o|
|000045d0| 72 64 69 6e 61 72 79 20 | 74 65 78 74 20 6f 62 6a |rdinary |text obj|
|000045e0| 65 63 74 20 77 65 20 75 | 73 65 64 20 61 20 73 63 |ect we u|sed a sc|
|000045f0| 72 6f 6c 6c 69 6e 67 20 | 74 65 78 74 20 6f 62 6a |rolling |text obj|
|00004600| 65 63 74 20 61 20 73 63 | 72 6f 6c 6c 69 6e 67 20 |ect a sc|rolling |
|00004610| 76 69 65 77 20 77 6f 75 | 6c 64 20 61 70 70 65 61 |view wou|ld appea|
|00004620| 72 20 6f 6e 63 65 20 74 | 68 65 20 74 65 78 74 20 |r once t|he text |
|00004630| 6f 62 6a 65 63 74 20 77 | 61 73 20 66 75 6c 6c 2e |object w|as full.|
|00004640| 20 20 53 65 65 20 65 78 | 61 6d 70 6c 65 20 70 72 | See ex|ample pr|
|00004650| 6f 67 72 61 6d 20 30 31 | 63 2e 68 65 6c 6c 6f 5f |ogram 01|c.hello_|
|00004660| 73 63 72 6f 6c 6c 20 66 | 6f 72 20 61 20 64 65 6d |scroll f|or a dem|
|00004670| 6f 6e 73 74 72 61 74 69 | 6f 6e 20 6f 66 20 68 6f |onstrati|on of ho|
|00004680| 77 20 74 68 69 73 20 77 | 6f 75 6c 64 20 77 6f 72 |w this w|ould wor|
|00004690| 6b 2e 0d 00 ae 64 00 0a | 5d 00 2a a6 00 09 b9 00 |k....d..|].*.....|
|000046a0| 00 a7 00 02 90 01 88 64 | 00 15 90 00 7e 64 00 18 |.......d|....~d..|
|000046b0| 1a 01 94 64 00 1f fb 00 | 9a 64 00 22 7e 00 70 05 |...d....|.d."~.p.|
|000046c0| 00 0c 9e 00 79 64 00 0c | c1 00 e4 64 00 0f e2 01 |....yd..|...d....|
|000046d0| 27 74 00 23 86 01 6c 64 | 00 26 60 00 7f 64 00 29 |'t.#..ld|.&`..d.)|
|000046e0| 1f 01 10 44 00 2d 9d 00 | 38 05 00 11 f8 00 71 44 |...D.-..|8.....qD|
|000046f0| 00 2e 33 00 c4 64 00 2f | ef 01 65 64 00 12 1f 01 |..3..d./|..ed....|
|00004700| dc 44 00 33 d6 00 a8 44 | 00 37 d1 00 1c 45 00 0a |.D.3...D|.7...E..|
|00004710| 2e 01 0a 64 00 37 e3 01 | 0a 64 00 3a 75 02 af 64 |...d.7..|.d.:u..d|
|00004720| 00 3e 43 00 e9 05 00 02 | b3 00 df 44 00 02 d6 00 |.>C.....|...D....|
|00004730| 62 64 00 04 65 01 5e 64 | 00 07 21 01 44 64 00 44 |bd..e.^d|..!.Dd.D|
|00004740| 4d 00 a1 03 6f fc 00 90 | 02 0a 00 6c 00 0e 06 30 |M...o...|...l...0|
|00004750| f7 0d fc 00 90 01 ce 00 | 6c 02 0e 06 30 f7 ff 00 |........|l...0...|
|00004760| 15 0a 01 f7 46 69 67 75 | 72 65 20 36 2d 31 3a 20 |....Figu|re 6-1: |
|00004770| 54 77 6f 20 42 75 74 74 | 6f 6e 73 20 74 68 61 74 |Two Butt|ons that|
|00004780| 20 74 72 69 67 67 65 72 | 20 65 76 65 6e 74 73 ff | trigger| events.|
|00004790| 00 15 0a 00 f7 0d fc 00 | 90 02 0a 00 6c 00 0e 06 |........|....l...|
|000047a0| 30 f7 0d 20 20 20 33 29 | 20 43 72 65 61 74 65 20 |0.. 3)| Create |
|000047b0| 61 20 73 75 62 63 6c 61 | 73 73 20 6f 66 20 74 68 |a subcla|ss of th|
|000047c0| 65 20 ff 00 16 0a 01 f7 | 4f 62 6a 65 63 74 ff 00 |e ......|Object..|
|000047d0| 15 0a 00 f7 20 63 6c 61 | 73 73 20 75 73 69 6e 67 |.... cla|ss using|
|000047e0| 20 74 68 65 20 63 6c 61 | 73 73 20 65 64 69 74 6f | the cla|ss edito|
|000047f0| 72 20 61 6e 64 20 74 68 | 65 20 63 72 65 61 74 65 |r and th|e create|
|00004800| 20 61 6e 20 69 6e 73 74 | 61 6e 63 65 20 6f 66 20 | an inst|ance of |
|00004810| 74 68 61 74 20 6f 62 6a | 65 63 74 20 75 73 69 6e |that obj|ect usin|
|00004820| 67 20 74 68 65 20 22 49 | 6e 73 74 61 6e 74 69 61 |g the "I|nstantia|
|00004830| 74 65 22 20 6d 65 6e 75 | 20 73 65 6c 65 63 74 69 |te" menu| selecti|
|00004840| 6f 6e 2e 0d 0d 20 20 34 | 29 20 57 69 74 68 20 74 |on... 4|) With t|
|00004850| 68 65 20 69 6e 73 74 61 | 6e 63 65 20 6f 66 20 6f |he insta|nce of o|
|00004860| 62 6a 65 63 74 20 73 65 | 6c 65 63 74 65 64 20 28 |bject se|lected (|
|00004870| 74 68 65 20 73 70 68 65 | 72 65 20 6c 6f 77 65 72 |the sphe|re lower|
|00004880| 20 6c 65 66 74 20 77 69 | 6e 64 6f 77 20 6d 75 73 | left wi|ndow mus|
|00004890| 74 20 62 65 20 73 65 6c | 65 63 74 65 64 29 20 62 |t be sel|ected) b|
|000048a0| 72 69 6e 67 20 75 70 20 | 74 68 65 20 49 6e 73 70 |ring up |the Insp|
|000048b0| 65 63 74 6f 72 20 28 73 | 65 6c 65 63 74 20 57 69 |ector (s|elect Wi|
|000048c0| 6e 64 6f 77 73 2f 49 6e | 73 70 65 63 74 6f 72 20 |ndows/In|spector |
|000048d0| 66 72 6f 6d 20 74 68 65 | 20 6d 61 69 6e 20 49 42 |from the| main IB|
|000048e0| 20 6d 65 75 6e 29 20 61 | 6e 64 20 61 64 64 20 74 | meun) a|nd add t|
|000048f0| 68 65 20 66 6f 6c 6c 6f | 77 69 6e 67 20 61 63 74 |he follo|wing act|
|00004900| 69 6f 6e 73 20 75 73 69 | 6e 67 20 74 68 65 20 ff |ions usi|ng the .|
|00004910| 00 16 0a 01 f7 63 6c 61 | 73 73 ff 00 15 0a 00 f7 |.....cla|ss......|
|00004920| 20 70 6f 70 2d 75 70 20 | 6c 69 73 74 3a 0d 0d fc | pop-up |list:...|
|00004930| 00 b3 02 0a 00 8f 00 0e | 06 30 f7 09 ff 00 16 0a |........|.0......|
|00004940| 00 f7 69 6e 63 72 65 6d | 65 6e 74 42 75 74 74 6f |..increm|entButto|
|00004950| 6e 0d 09 64 65 63 72 65 | 6d 65 6e 74 42 75 74 74 |n..decre|mentButt|
|00004960| 6f 6e 0d ff 00 15 0a 00 | f7 fc 00 90 02 0a 00 6c |on......|.......l|
|00004970| 00 0e 06 30 f7 0d 20 20 | 20 35 29 20 43 6f 6e 6e |...0.. | 5) Conn|
|00004980| 65 63 74 20 74 68 65 20 | 62 75 74 74 6f 6e 73 20 |ect the |buttons |
|00004990| 74 6f 20 74 68 65 20 69 | 6e 73 74 61 6e 63 65 20 |to the i|nstance |
|000049a0| 6f 66 20 74 68 65 20 6f | 62 6a 65 63 74 20 62 79 |of the o|bject by|
|000049b0| 20 43 4f 4e 54 52 4f 4c | 2f 43 4c 49 43 4b 69 6e | CONTROL|/CLICKin|
|000049c0| 67 20 66 72 6f 6d 20 74 | 68 65 20 62 75 74 74 6f |g from t|he butto|
|000049d0| 6e 73 20 74 6f 20 74 68 | 65 20 67 65 6e 65 72 69 |ns to th|e generi|
|000049e0| 63 20 6f 62 6a 65 63 74 | 20 69 63 6f 6e 20 6c 61 |c object| icon la|
|000049f0| 62 65 6c 65 64 20 ff 00 | 16 0a 01 f7 4d 79 4f 62 |beled ..|....MyOb|
|00004a00| 6a 65 63 74 31 ff 00 15 | 0a 00 f7 20 20 69 6e 20 |ject1...|... in |
|00004a10| 74 68 65 20 6c 6f 77 65 | 72 20 6c 65 66 74 20 68 |the lowe|r left h|
|00004a20| 61 6e 64 20 63 6f 72 6e | 65 72 20 6f 66 20 74 68 |and corn|er of th|
|00004a30| 65 20 73 63 72 65 65 6e | 2e 20 20 43 6f 6e 6e 65 |e screen|. Conne|
|00004a40| 63 74 20 74 68 65 20 22 | 69 6e 63 72 65 6d 65 6e |ct the "|incremen|
|00004a50| 74 22 20 62 75 74 74 6f | 6e 20 74 6f 20 74 68 65 |t" butto|n to the|
|00004a60| 20 69 6e 63 72 65 6d 65 | 6e 74 42 75 74 74 6f 6e | increme|ntButton|
|00004a70| 20 61 63 74 69 6f 6e 20 | 61 6e 64 20 74 68 65 20 | action |and the |
|00004a80| 22 64 65 63 72 65 6d 65 | 6e 74 22 20 62 75 74 74 |"decreme|nt" butt|
|00004a90| 6f 6e 20 74 6f 20 74 68 | 65 20 22 64 65 63 72 65 |on to th|e "decre|
|00004aa0| 6d 65 6e 74 42 75 74 74 | 6f 6e 22 20 61 63 74 69 |mentButt|on" acti|
|00004ab0| 6f 6e 2e 0d 02 81 0d 09 | ff 00 16 0a 01 f7 5b 6d |on......|......[m|
|00004ac0| 79 54 65 78 74 20 69 6e | 74 56 61 6c 75 65 3a 6d |yText in|tValue:m|
|00004ad0| 79 49 6e 74 5d ff 00 15 | 0a 00 f7 0d 0d 41 6c 74 |yInt]...|.....Alt|
|00004ae0| 68 6f 75 67 68 20 74 68 | 69 73 20 69 73 20 73 6f |hough th|is is so|
|00004af0| 6d 65 74 69 6d 65 73 20 | 64 6f 6e 65 2c 20 69 74 |metimes |done, it|
|00004b00| 20 61 6c 73 6f 20 62 72 | 69 6e 67 73 20 69 6e 74 | also br|ings int|
|00004b10| 6f 20 70 6c 61 79 20 71 | 75 65 73 74 69 6f 6e 73 |o play q|uestions|
|00004b20| 20 61 73 20 2d 20 77 68 | 61 74 20 69 73 20 74 68 | as - wh|at is th|
|00004b30| 65 20 73 63 6f 70 65 20 | 6f 66 20 74 68 65 20 76 |e scope |of the v|
|00004b40| 61 72 69 61 62 6c 65 20 | 6d 79 54 65 78 74 3f 20 |ariable |myText? |
|00004b50| 20 48 6f 77 20 77 69 6c | 6c 20 61 6c 6c 20 74 68 | How wil|l all th|
|00004b60| 65 20 6f 62 6a 65 63 74 | 73 20 74 68 61 74 20 75 |e object|s that u|
|00004b70| 73 65 20 74 68 69 73 20 | 6e 61 6d 65 20 62 65 20 |se this |name be |
|00004b80| 69 6e 66 6f 72 6d 65 64 | 20 69 66 20 74 68 65 20 |informed| if the |
|00004b90| 6e 61 6d 65 20 6f 66 20 | 74 68 65 20 6f 62 6a 65 |name of |the obje|
|00004ba0| 63 74 20 63 68 61 6e 67 | 65 73 3f 20 20 4e 65 58 |ct chang|es? NeX|
|00004bb0| 54 73 74 65 70 20 68 61 | 73 20 61 20 6d 65 74 68 |Tstep ha|s a meth|
|00004bc0| 6f 64 20 74 68 61 74 20 | 61 64 64 72 65 73 73 65 |od that |addresse|
|00004bd0| 73 20 73 6f 6d 65 20 6f | 66 20 74 68 65 73 65 20 |s some o|f these |
|00004be0| 71 75 65 73 74 69 6f 6e | 73 3a 20 6f 75 74 6c 65 |question|s: outle|
|00004bf0| 74 73 2e 20 20 ff 00 15 | 0a 01 f7 41 6e 20 6f 75 |ts. ...|...An ou|
|00004c00| 74 6c 65 74 73 20 66 75 | 6e 63 74 69 6f 6e 20 69 |tlets fu|nction i|
|00004c10| 73 20 76 65 72 79 20 73 | 69 6d 70 6c 65 3a 20 69 |s very s|imple: i|
|00004c20| 74 20 61 73 73 69 67 6e | 73 20 61 6e 20 6e 61 6d |t assign|s an nam|
|00004c30| 65 20 74 6f 20 61 20 73 | 70 65 63 69 66 69 63 20 |e to a s|pecific |
|00004c40| 6f 62 6a 65 63 74 20 69 | 6e 20 22 6f 62 6a 65 63 |object i|n "objec|
|00004c50| 74 20 73 70 61 63 65 22 | 20 74 68 61 74 20 69 73 |t space"| that is|
|00004c60| 20 74 68 65 6e 20 75 73 | 65 64 20 77 68 65 6e 20 | then us|ed when |
|00004c70| 77 65 20 77 61 6e 74 20 | 74 6f 20 74 61 6c 6b 20 |we want |to talk |
|00004c80| 74 6f 20 74 68 61 74 20 | 20 6f 62 6a 65 63 74 20 |to that | object |
|00004c90| 66 72 6f 6d 20 77 69 74 | 68 69 6e 20 6f 75 72 20 |from wit|hin our |
|00004ca0| 63 6f 64 65 2e ff 00 15 | 0a 00 f7 20 20 46 6f 72 |code....|... For|
|00004cb0| 20 65 78 61 6d 70 6c 65 | 20 69 6e 20 74 68 65 20 | example| in the |
|00004cc0| 61 62 6f 76 65 20 65 78 | 61 6d 70 6c 65 20 77 65 |above ex|ample we|
|00004cd0| 20 77 6f 75 6c 64 20 75 | 73 65 20 74 68 65 20 66 | would u|se the f|
|00004ce0| 6f 6c 6c 6f 77 69 6e 67 | 20 73 74 65 70 73 20 74 |ollowing| steps t|
|00004cf0| 6f 20 61 64 64 20 61 20 | 74 65 78 74 20 6f 62 6a |o add a |text obj|
|00004d00| 65 63 74 20 74 6f 20 74 | 68 65 20 73 63 72 65 65 |ect to t|he scree|
|00004d10| 6e 20 74 6f 20 64 69 73 | 70 6c 61 79 20 74 68 65 |n to dis|play the|
|00004d20| 20 76 61 6c 75 65 20 6f | 66 20 74 68 65 20 69 6e | value o|f the in|
|00004d30| 74 65 67 65 72 3a 0d 01 | fb fc 00 5a 02 0a 00 5a |teger:..|...Z...Z|
|00004d40| 00 0e 01 f0 08 06 30 f7 | 0d 0d fc 00 48 02 0a 00 |......0.|....H...|
|00004d50| 48 00 0e 01 f0 08 06 30 | f7 ff 00 15 10 01 f7 45 |H......0|.......E|
|00004d60| 78 61 6d 70 6c 65 3a 20 | 55 73 69 6e 67 20 61 20 |xample: |Using a |
|00004d70| 46 6f 72 6d 0d fc 00 5a | 02 0a 00 5a 00 0e 01 f0 |Form...Z|...Z....|
|00004d80| 08 06 30 f7 ff 00 15 0a | 00 f7 0d 4c 65 74 20 75 |..0.....|...Let u|
|00004d90| 73 20 74 61 6b 65 20 74 | 68 65 20 70 72 65 76 69 |s take t|he previ|
|00004da0| 6f 75 73 20 65 78 61 6d | 70 6c 65 2c 20 74 68 65 |ous exam|ple, the|
|00004db0| 20 74 61 73 6b 20 6f 66 | 20 68 61 76 69 6e 67 20 | task of| having |
|00004dc0| 74 77 6f 20 65 76 65 6e | 74 73 20 63 68 61 6e 67 |two even|ts chang|
|00004dd0| 65 20 74 68 65 20 73 74 | 61 74 65 20 6f 66 20 61 |e the st|ate of a|
|00004de0| 6e 20 69 6e 73 74 61 6e | 63 65 20 76 61 72 69 61 |n instan|ce varia|
|00004df0| 62 6c 65 2e 20 20 54 68 | 65 20 73 74 61 74 65 20 |ble. Th|e state |
|00004e00| 6f 66 20 74 68 65 20 6f | 62 6a 65 63 74 20 77 61 |of the o|bject wa|
|00004e10| 73 20 70 72 69 6e 74 65 | 64 20 6f 75 74 20 74 6f |s printe|d out to|
|00004e20| 20 74 68 65 20 73 74 61 | 6e 64 61 72 64 20 6f 75 | the sta|ndard ou|
|00004e30| 74 70 75 74 2c 20 69 6e | 20 74 68 69 73 20 63 61 |tput, in| this ca|
|00004e40| 73 65 20 74 68 65 20 74 | 65 72 6d 69 6e 61 6c 2e |se the t|erminal.|
|00004e50| 20 20 42 75 74 20 74 68 | 61 74 20 68 61 73 20 74 | But th|at has t|
|00004e60| 68 65 20 64 69 73 61 64 | 76 61 6e 74 61 67 65 20 |he disad|vantage |
|00004e70| 74 68 61 74 20 69 66 20 | 79 6f 75 20 73 74 61 72 |that if |you star|
|00004e80| 74 20 74 68 65 20 70 72 | 6f 67 72 61 6d 20 66 72 |t the pr|ogram fr|
|00004e90| 6f 6d 20 74 68 65 20 62 | 72 6f 77 73 65 72 20 79 |om the b|rowser y|
|00004ea0| 6f 75 20 77 69 6c 6c 20 | 6e 6f 74 20 73 65 65 20 |ou will |not see |
|00004eb0| 61 6e 79 20 6f 75 74 70 | 75 74 2e 20 20 41 20 62 |any outp|ut. A b|
|00004ec0| 65 74 74 65 72 20 73 6f | 6c 75 74 69 6f 6e 20 69 |etter so|lution i|
|00004ed0| 73 20 74 6f 20 64 69 73 | 70 6c 61 79 20 74 68 65 |s to dis|play the|
|00004ee0| 20 76 61 6c 75 65 20 74 | 6f 20 61 20 46 6f 72 6d | value t|o a Form|
|00004ef0| 20 6f 62 6a 65 63 74 20 | 69 6e 20 74 68 65 20 6d | object |in the m|
|00004f00| 61 69 6e 20 77 69 6e 64 | 6f 77 20 6f 66 20 74 68 |ain wind|ow of th|
|00004f10| 65 20 61 70 70 6c 69 63 | 61 74 69 6f 6e 2e 20 20 |e applic|ation. |
|00004f20| 48 65 72 65 20 61 72 65 | 20 74 68 65 20 73 74 65 |Here are| the ste|
|00004f30| 70 73 2e 0d 01 fd 0d fc | 00 90 01 ce 00 6c 02 0e |ps......|.....l..|
|00004f40| 06 30 f7 ff 00 15 0a 01 | f7 46 69 67 75 72 65 20 |.0......|.Figure |
|00004f50| 36 2d 31 3a 20 55 73 69 | 6e 67 20 61 20 46 6f 72 |6-1: Usi|ng a For|
|00004f60| 6d 20 74 6f 20 44 69 61 | 70 6c 61 79 20 4d 79 49 |m to Dia|play MyI|
|00004f70| 6e 74 ff 00 15 0a 00 f7 | 0d fc 00 6c 02 0a 00 62 |nt......|...l...b|
|00004f80| 00 0e 01 f0 08 06 30 f7 | 0d 0d 32 29 20 41 64 64 |......0.|..2) Add|
|00004f90| 20 74 68 65 20 66 6f 6c | 6c 6f 77 69 6e 67 20 6c | the fol|lowing l|
|00004fa0| 69 6e 65 20 74 6f 20 74 | 68 65 20 4d 79 4f 62 6a |ine to t|he MyObj|
|00004fb0| 65 63 74 2e 68 20 66 69 | 6c 65 0d 0d 2d 6d 79 54 |ect.h fi|le..-myT|
|00004fc0| 65 78 74 3a 61 6e 4f 62 | 6a 65 63 74 3b 0d 0d 33 |ext:anOb|ject;..3|
|00004fd0| 29 20 50 61 72 73 65 20 | 69 6e 20 74 68 65 20 6e |) Parse |in the n|
|00004fe0| 65 77 20 68 65 61 64 65 | 72 20 66 69 6c 65 20 62 |ew heade|r file b|
|00004ff0| 79 20 73 65 6c 65 63 74 | 69 6e 67 20 74 68 65 20 |y select|ing the |
|00005000| 4d 79 4f 62 6a 65 63 74 | 20 63 6c 61 73 73 20 69 |MyObject| class i|
|00005010| 6e 20 74 68 65 20 63 6c | 61 73 73 20 65 64 69 74 |n the cl|ass edit|
|00005020| 6f 72 20 61 6e 64 20 74 | 68 65 6e 20 75 73 69 6e |or and t|hen usin|
|00005030| 67 20 74 68 65 20 22 70 | 61 72 73 65 22 20 73 65 |g the "p|arse" se|
|00005040| 6c 65 63 74 69 6f 6e 20 | 66 72 6f 6d 20 74 68 65 |lection |from the|
|00005050| 20 70 6f 70 2d 75 70 20 | 6c 69 73 74 2e 20 20 41 | pop-up |list. A|
|00005060| 6e 73 77 65 72 20 22 52 | 65 70 6c 61 63 65 22 20 |nswer "R|eplace" |
|00005070| 74 6f 20 74 68 65 20 61 | 6c 65 72 74 20 71 75 65 |to the a|lert que|
|00005080| 73 74 69 6f 6e 20 74 68 | 61 74 20 69 6e 66 6f 72 |stion th|at infor|
|00005090| 6d 73 20 79 6f 75 20 74 | 68 61 74 20 79 6f 75 20 |ms you t|hat you |
|000050a0| 68 61 76 65 20 64 69 66 | 66 65 72 65 6e 74 20 6d |have dif|ferent m|
|000050b0| 65 74 68 6f 64 73 2e 0d | 0d 34 29 20 4d 61 6b 65 |ethods..|.4) Make|
|000050c0| 20 61 20 63 6f 6e 6e 65 | 63 74 69 6f 6e 20 66 72 | a conne|ction fr|
|000050d0| 6f 6d 20 74 68 65 20 6f | 62 6a 65 63 74 20 69 6e |om the o|bject in|
|000050e0| 73 74 61 6e 63 65 20 74 | 6f 20 74 68 65 20 46 6f |stance t|o the Fo|
|000050f0| 72 6d 20 28 75 73 65 20 | 74 68 65 20 67 72 61 79 |rm (use |the gray|
|00005100| 20 6e 6f 74 20 74 68 65 | 20 62 6c 61 63 6b 20 62 | not the| black b|
|00005110| 6f 78 29 0d 0d 35 29 20 | 53 61 76 65 20 49 42 2c |ox)..5) |Save IB,|
|00005120| 20 63 6f 6d 70 69 6c 65 | 20 61 6e 64 20 72 75 6e | compile| and run|
|00005130| 2e 0d 0d 02 a0 fc 00 90 | 01 ce 00 6c 02 0e 06 30 |........|...l...0|
|00005140| f7 ff 00 15 0a 01 f7 0d | 46 69 67 75 72 65 20 36 |........|Figure 6|
|00005150| 2d 33 3a 20 55 73 65 72 | 20 49 6e 74 65 72 66 61 |-3: User| Interfa|
|00005160| 63 65 20 46 6f 72 20 47 | 61 6d 65 20 6f 66 20 48 |ce For G|ame of H|
|00005170| 69 2d 4c 6f 0d ff 00 15 | 0a 00 f7 0d fc 00 6c 02 |i-Lo....|......l.|
|00005180| 0a 00 6c 00 0e 02 18 06 | 30 f7 49 6e 20 74 68 69 |..l.....|0.In thi|
|00005190| 73 20 65 78 61 6d 70 6c | 65 20 6f 75 72 20 6f 62 |s exampl|e our ob|
|000051a0| 6a 65 63 74 20 63 6f 6e | 74 61 69 6e 73 20 74 77 |ject con|tains tw|
|000051b0| 6f 20 65 76 65 6e 74 73 | 2e 20 20 4f 6e 65 20 65 |o events|. One e|
|000051c0| 76 65 6e 74 20 77 69 6c | 6c 20 62 65 20 74 68 65 |vent wil|l be the|
|000051d0| 20 75 73 65 72 20 65 6e | 74 65 72 69 6e 67 20 61 | user en|tering a|
|000051e0| 20 6e 65 77 20 67 75 65 | 73 73 2e 20 20 54 68 65 | new gue|ss. The|
|000051f0| 20 6f 74 68 65 72 20 77 | 69 6c 6c 20 62 65 20 74 | other w|ill be t|
|00005200| 68 65 20 65 76 65 6e 74 | 20 63 61 75 73 65 64 20 |he event| caused |
|00005210| 77 68 65 6e 20 74 68 65 | 20 4e 65 77 20 47 61 6d |when the| New Gam|
|00005220| 65 20 62 75 74 74 6f 6e | 20 69 73 20 73 65 6c 65 |e button| is sele|
|00005230| 63 74 65 64 2e 20 20 54 | 68 65 73 65 20 65 76 65 |cted. T|hese eve|
|00005240| 6e 74 73 20 63 61 6e 20 | 68 61 70 70 65 6e 20 61 |nts can |happen a|
|00005250| 74 20 61 6e 79 20 74 69 | 6d 65 2e 20 20 57 65 20 |t any ti|me. We |
|00005260| 77 69 6c 6c 20 61 6c 73 | 6f 20 68 61 76 65 20 74 |will als|o have t|
|00005270| 77 6f 20 6f 75 74 6c 65 | 74 73 20 2d 20 6f 6e 65 |wo outle|ts - one|
|00005280| 20 66 6f 72 20 73 65 6e | 64 69 6e 67 20 61 20 68 | for sen|ding a h|
|00005290| 69 6e 74 20 6d 65 73 73 | 61 67 65 20 74 6f 20 61 |int mess|age to a|
|000052a0| 6e 64 20 6f 6e 65 20 66 | 6f 72 20 75 70 64 61 74 |nd one f|or updat|
|000052b0| 65 69 6e 67 20 74 68 65 | 20 6e 75 6d 62 65 72 20 |eing the| number |
|000052c0| 6f 66 20 74 72 79 73 2e | 20 20 54 68 65 20 68 65 |of trys.| The he|
|000052d0| 61 64 65 72 20 66 69 6c | 65 20 66 6f 72 20 61 20 |ader fil|e for a |
|000052e0| 48 69 4c 6f 20 6f 62 6a | 65 63 74 20 22 48 69 4c |HiLo obj|ect "HiL|
|000052f0| 6f 2e 68 22 20 77 69 6c | 6c 20 62 65 20 74 68 65 |o.h" wil|l be the|
|00005300| 20 66 6f 6c 6c 6f 77 69 | 6e 67 3a 0d fc 00 5a 02 | followi|ng:...Z.|
|00005310| 0a 00 5a 00 0e 01 b0 06 | 30 f7 0d fc 00 90 02 0a |..Z.....|0.......|
|00005320| 00 90 00 0e 02 ac 03 18 | 06 30 f7 ff 00 16 0a 00 |........|.0......|
|00005330| f7 23 69 6d 70 6f 72 74 | 20 3c 6f 62 6a 63 2f 4f |.#import| <objc/O|
|00005340| 62 6a 65 63 74 2e 68 3e | 0d 40 69 6e 74 65 72 66 |bject.h>|.@interf|
|00005350| 61 63 65 20 48 69 4c 6f | 3a 4f 62 6a 65 63 74 0d |ace HiLo|:Object.|
|00005360| 7b 0d 20 20 20 20 69 64 | 20 68 69 6e 74 3b 0d 20 |{. id| hint;. |
|00005370| 20 20 20 69 64 20 6e 75 | 6d 62 65 72 47 75 65 73 | id nu|mberGues|
|00005380| 73 65 73 3b 0d 20 20 20 | 20 69 6e 74 20 6e 75 6d |ses;. | int num|
|00005390| 62 65 72 3b 0d 20 20 20 | 20 69 6e 74 20 6e 75 6d |ber;. | int num|
|000053a0| 62 65 72 4f 66 47 75 65 | 73 73 65 73 3b 0d 20 20 |berOfGue|sses;. |
|000053b0| 20 20 69 6e 74 20 61 6e | 73 77 65 72 3b 0d 7d 0d | int an|swer;.}.|
|000053c0| 0d 2d 20 73 65 74 48 69 | 6e 74 3a 61 6e 4f 62 6a |.- setHi|nt:anObj|
|000053d0| 65 63 74 3b 0d 01 d5 0d | fc 00 90 01 f0 04 00 6c |ect;....|.......l|
|000053e0| 02 0e 06 30 f7 ff 00 15 | 0a 01 f7 46 69 67 75 72 |...0....|...Figur|
|000053f0| 65 20 36 2d 34 3a 20 55 | 73 69 6e 67 20 61 20 54 |e 6-4: U|sing a T|
|00005400| 65 78 74 20 4f 62 6a 65 | 63 74 0d ff 00 15 0a 00 |ext Obje|ct......|
|00005410| f7 fc 00 90 02 0a 00 90 | 02 0e 02 1c 06 30 f7 0d |........|.....0..|
|00005420| fc 00 90 02 0a 00 90 00 | 0e 02 1c 06 30 f7 0d 43 |........|....0..C|
|00005430| 72 65 61 74 65 20 61 6e | 20 6f 75 74 6c 65 74 20 |reate an| outlet |
|00005440| 66 6f 72 20 4d 79 48 65 | 6c 6c 6f 43 6c 61 73 73 |for MyHe|lloClass|
|00005450| 20 75 73 69 6e 67 20 74 | 68 65 20 69 6e 73 70 65 | using t|he inspe|
|00005460| 63 74 6f 72 20 70 61 6e | 65 6c 2e 20 20 43 61 6c |ctor pan|el. Cal|
|00005470| 6c 20 69 74 20 74 65 78 | 74 4f 75 74 6c 65 74 2e |l it tex|tOutlet.|
|00005480| 20 20 54 68 69 73 20 69 | 73 20 69 64 65 6e 74 69 | This i|s identi|
|00005490| 61 6c 20 74 6f 20 63 72 | 65 61 74 69 6e 67 20 61 |al to cr|eating a|
|000054a0| 6e 20 61 63 74 69 6f 6e | 20 77 69 74 68 20 74 68 |n action| with th|
|000054b0| 65 20 65 78 63 65 70 74 | 69 6f 6e 20 74 68 61 74 |e except|ion that|
|000054c0| 20 74 68 65 20 6f 75 74 | 6c 65 74 20 69 73 20 73 | the out|let is s|
|000054d0| 65 6c 65 63 74 65 64 20 | 69 6e 73 74 65 61 64 20 |elected |instead |
|000054e0| 6f 66 20 61 6e 20 61 63 | 74 69 6f 6e 2e 20 20 4d |of an ac|tion. M|
|000054f0| 61 6b 65 20 61 20 63 6f | 6e 6e 65 63 74 69 6f 6e |ake a co|nnection|
|00005500| 20 66 72 6f 6d 20 74 68 | 65 20 69 6e 73 74 61 6e | from th|e instan|
|00005510| 63 65 20 6f 66 20 74 68 | 65 20 6f 62 6a 65 63 74 |ce of th|e object|
|00005520| 20 74 6f 20 74 68 65 20 | 46 6f 72 6d 20 28 6e 6f | to the |Form (no|
|00005530| 74 65 20 74 68 61 74 20 | 74 68 69 73 20 69 73 20 |te that |this is |
|00005540| 74 68 65 20 6f 70 70 6f | 73 69 74 65 20 64 69 72 |the oppo|site dir|
|00005550| 65 63 74 69 6f 6e 20 74 | 68 61 74 20 77 65 20 75 |ection t|hat we u|
|00005560| 73 65 64 20 77 68 65 6e | 20 77 65 20 6d 61 64 65 |sed when| we made|
|00005570| 20 61 20 63 6f 6e 6e 65 | 63 74 69 6f 6e 20 66 72 | a conne|ction fr|
|00005580| 6f 6d 20 74 68 65 20 62 | 75 74 74 6f 6e 20 74 6f |om the b|utton to|
|00005590| 20 49 6e 73 74 61 6e 63 | 65 20 6f 66 20 4d 79 48 | Instanc|e of MyH|
|000055a0| 65 6c 6c 6f 43 6c 61 73 | 73 29 2e 0d 03 a4 fc 00 |elloClas|s)......|
|000055b0| b4 02 0a 00 b4 00 0e 03 | 64 06 30 f7 0d fc 00 90 |........|d.0.....|
|000055c0| 02 0a 00 90 00 0e 02 d0 | 06 30 f7 ff 00 15 0a 01 |........|.0......|
|000055d0| f7 53 74 65 70 20 33 ff | 00 15 0a 00 f7 3a 20 53 |.Step 3.|.....: S|
|000055e0| 61 76 65 20 61 6c 6c 20 | 79 6f 75 72 20 66 69 6c |ave all |your fil|
|000055f0| 65 73 20 61 6e 64 20 72 | 75 6e 20 6d 61 6b 65 2e |es and r|un make.|
|00005600| 0d fc 00 5a 02 0a 00 5a | 00 0e 01 b0 06 30 f7 0d |...Z...Z|.....0..|
|00005610| 0d fc 00 48 02 0a 00 48 | 00 0e 01 b0 06 30 f7 ff |...H...H|.....0..|
|00005620| 00 15 12 01 f7 45 78 61 | 6d 70 6c 65 3a 20 55 73 |.....Exa|mple: Us|
|00005630| 69 6e 67 20 61 20 53 63 | 72 6f 6c 6c 69 6e 67 20 |ing a Sc|rolling |
|00005640| 54 65 78 74 20 6f 62 6a | 65 63 74 0d ff 00 15 0a |Text obj|ect.....|
|00005650| 00 f7 0d fc 00 6c 02 0a | 00 6c 00 0e 06 30 f7 54 |.....l..|.l...0.T|
|00005660| 68 65 20 70 72 6f 67 72 | 61 6d 20 68 61 73 20 61 |he progr|am has a|
|00005670| 20 6c 69 6d 69 74 61 74 | 69 6f 6e 20 6f 6e 20 74 | limitat|ion on t|
|00005680| 68 65 20 6e 75 6d 62 65 | 72 20 6f 66 20 6c 69 6e |he numbe|r of lin|
|00005690| 65 73 20 74 68 61 74 20 | 63 61 6e 20 62 65 20 64 |es that |can be d|
|000056a0| 69 73 70 6c 61 79 65 64 | 20 69 6e 20 61 20 74 65 |isplayed| in a te|
|000056b0| 78 74 20 6f 62 6a 65 63 | 74 2e 20 20 41 66 74 65 |xt objec|t. Afte|
|000056c0| 72 20 74 68 65 20 74 65 | 78 74 20 6f 62 6a 65 63 |r the te|xt objec|
|000056d0| 74 20 69 73 20 66 75 6c | 6c 20 79 6f 75 20 63 61 |t is ful|l you ca|
|000056e0| 6e 20 6e 6f 74 20 73 65 | 65 20 61 6e 79 20 6e 65 |n not se|e any ne|
|000056f0| 77 20 6c 69 6e 65 73 20 | 74 68 61 74 20 61 72 65 |w lines |that are|
|00005700| 20 61 64 64 65 64 20 61 | 74 20 74 68 65 20 62 6f | added a|t the bo|
|00005710| 74 74 6f 6d 2e 20 20 49 | 66 20 69 6e 73 74 65 61 |ttom. I|f instea|
|00005720| 64 20 6f 66 20 75 73 69 | 6e 67 20 61 6e 20 6f 72 |d of usi|ng an or|
|00005730| 64 69 6e 61 72 79 20 74 | 65 78 74 20 6f 62 6a 65 |dinary t|ext obje|
|00005740| 63 74 20 77 65 20 75 73 | 65 64 20 61 20 73 63 72 |ct we us|ed a scr|
|00005750| 6f 6c 6c 69 6e 67 20 74 | 65 78 74 20 6f 62 6a 65 |olling t|ext obje|
|00005760| 63 74 20 61 20 73 63 72 | 6f 6c 6c 69 6e 67 20 76 |ct a scr|olling v|
|00005770| 69 65 77 20 77 6f 75 6c | 64 20 61 70 70 65 61 72 |iew woul|d appear|
|00005780| 20 6f 6e 63 65 20 74 68 | 65 20 74 65 78 74 20 6f | once th|e text o|
|00005790| 62 6a 65 63 74 20 77 61 | 73 20 66 75 6c 6c 2e 20 |bject wa|s full. |
|000057a0| 20 49 6e 73 74 65 61 64 | 20 6f 66 20 75 73 69 6e | Instead| of usin|
|000057b0| 67 20 61 20 74 65 78 74 | 20 6f 62 6a 65 63 74 20 |g a text| object |
|000057c0| 77 65 20 77 69 6c 6c 20 | 6e 65 65 64 20 74 6f 20 |we will |need to |
|000057d0| 64 72 61 67 20 61 20 73 | 63 72 6f 6c 6c 69 6e 67 |drag a s|crolling|
|000057e0| 20 74 65 78 74 20 6f 62 | 6a 65 63 74 20 66 6f 72 | text ob|ject for|
|000057f0| 6d 20 74 68 65 20 70 61 | 6c 6c 65 74 65 2e 20 20 |m the pa|llete. |
|00005800| 42 65 66 6f 72 65 20 77 | 65 20 73 65 6e 64 20 61 |Before w|e send a|
|00005810| 20 6d 65 73 73 61 67 65 | 20 74 6f 20 74 68 65 20 | message| to the |
|00005820| 73 63 72 6f 6c 6c 54 65 | 78 74 20 6f 62 6a 65 63 |scrollTe|xt objec|
|00005830| 74 2c 20 77 65 20 68 61 | 76 65 20 74 6f 20 66 69 |t, we ha|ve to fi|
|00005840| 6e 64 20 6f 75 74 20 77 | 68 65 72 65 20 74 68 65 |nd out w|here the|
|00005850| 20 74 65 78 74 20 6f 62 | 6a 65 63 74 20 69 73 20 | text ob|ject is |
|00005860| 69 6e 73 69 64 65 20 74 | 68 65 20 73 63 72 6f 6c |inside t|he scrol|
|00005870| 6c 54 65 78 74 20 6f 62 | 6a 65 63 74 2e 20 20 49 |lText ob|ject. I|
|00005880| 6e 20 74 68 69 73 20 63 | 61 73 65 2c 20 74 68 65 |n this c|ase, the|
|00005890| 20 6f 62 6a 65 63 74 20 | 74 68 61 74 20 77 65 20 | object |that we |
|000058a0| 77 61 6e 74 20 69 73 20 | 74 68 65 20 22 64 6f 63 |want is |the "doc|
|000058b0| 75 6d 65 6e 74 20 76 69 | 65 77 22 20 77 68 69 63 |ument vi|ew" whic|
|000058c0| 68 20 69 73 20 74 68 65 | 20 64 6f 63 75 6d 65 6e |h is the| documen|
|000058d0| 74 20 74 68 61 74 20 77 | 65 20 61 72 65 20 73 63 |t that w|e are sc|
|000058e0| 72 6f 6c 6c 69 6e 67 20 | 61 72 6f 75 6e 64 20 69 |rolling |around i|
|000058f0| 6e 2e 20 20 57 65 20 74 | 68 65 6e 20 61 64 64 20 |n. We t|hen add |
|00005900| 74 68 65 20 66 6f 6c 6c | 6f 77 69 6e 67 20 6c 69 |the foll|owing li|
|00005910| 6e 65 3a 0d 0d fc 00 90 | 02 0a 00 90 00 0e 06 30 |ne:.....|.......0|
|00005920| f7 ff 00 16 0a 00 f7 73 | 63 72 6f 6c 6c 54 65 78 |.......s|crollTex|
|00005930| 74 20 3d 20 5b 74 65 78 | 74 4f 75 74 6c 65 74 20 |t = [tex|tOutlet |
|00005940| 64 6f 63 56 69 65 77 5d | 3b ff 00 15 0a 00 f7 20 |docView]|;...... |
|00005950| 0d 0d 02 5f fc 00 6c 02 | 0a 00 6c 00 0e 06 30 f7 |..._..l.|..l...0.|
|00005960| 49 6e 73 74 65 61 64 20 | 6f 66 20 73 65 6e 64 69 |Instead |of sendi|
|00005970| 6e 67 20 74 68 65 20 ff | 00 16 0a 01 f7 73 65 74 |ng the .|.....set|
|00005980| 53 74 72 69 6e 67 56 61 | 6c 75 65 ff 00 15 0a 00 |StringVa|lue.....|
|00005990| f7 20 6d 65 73 73 61 67 | 65 20 77 65 20 77 69 6c |. messag|e we wil|
|000059a0| 6c 20 6e 65 65 64 20 74 | 6f 20 73 65 6e 64 20 74 |l need t|o send t|
|000059b0| 68 65 20 ff 00 16 0a 01 | f7 73 65 74 54 65 78 74 |he .....|.setText|
|000059c0| ff 00 15 0a 00 f7 20 6d | 65 73 73 61 67 65 2e 20 |...... m|essage. |
|000059d0| 20 54 68 65 20 61 63 74 | 69 6f 6e 20 6d 65 74 68 | The act|ion meth|
|000059e0| 6f 64 20 66 6f 72 20 74 | 68 65 20 62 75 74 74 6f |od for t|he butto|
|000059f0| 6e 20 74 68 65 6e 20 62 | 65 63 6f 6d 65 73 3a 0d |n then b|ecomes:.|
|00005a00| 0d fc 00 90 02 0a 00 90 | 00 0e 02 ac 06 30 f7 ff |........|.....0..|
|00005a10| 00 16 0a 00 f7 2d 20 62 | 75 74 74 6f 6e 41 63 74 |.....- b|uttonAct|
|00005a20| 69 6f 6e 3a 73 65 6e 64 | 65 72 0d 7b 0d 09 73 74 |ion:send|er.{..st|
|00005a30| 72 63 61 74 28 6d 79 53 | 74 72 69 6e 67 2c 20 22 |rcat(myS|tring, "|
|00005a40| 68 65 6c 6c 6f 2c 20 77 | 6f 72 6c 64 5c 6e 22 29 |hello, w|orld\n")|
|00005a50| 3b 0d 09 73 63 72 6f 6c | 6c 54 65 78 74 20 3d 20 |;..scrol|lText = |
|00005a60| 5b 74 65 78 74 4f 75 74 | 6c 65 74 20 64 6f 63 56 |[textOut|let docV|
|00005a70| 69 65 77 5d 3b 0d 20 20 | 20 20 5b 73 63 72 6f 6c |iew];. | [scrol|
|00005a80| 6c 54 65 78 74 20 73 65 | 74 54 65 78 74 3a 6d 79 |lText se|tText:my|
|00005a90| 53 74 72 69 6e 67 5d 3b | 0d 20 20 20 20 72 65 74 |String];|. ret|
|00005aa0| 75 72 6e 20 73 65 6c 66 | 3b 0d 7d 0d 0d fc 00 6c |urn self|;.}....l|
|00005ab0| 02 0a 00 6c 00 0e 06 30 | f7 ff 00 15 0a 00 f7 54 |...l...0|.......T|
|00005ac0| 68 65 20 61 66 74 65 72 | 20 74 68 65 73 65 20 63 |he after| these c|
|00005ad0| 68 61 6e 67 65 73 20 61 | 72 65 20 6d 61 64 65 2c |hanges a|re made,|
|00005ae0| 20 61 66 74 65 72 20 74 | 68 65 20 74 65 78 74 20 | after t|he text |
|00005af0| 6f 62 6a 65 63 74 20 67 | 65 74 73 20 66 75 6c 6c |object g|ets full|
|00005b00| 2c 20 69 74 20 61 75 74 | 6f 6d 61 74 69 63 61 6c |, it aut|omatical|
|00005b10| 6c 79 20 61 64 64 20 61 | 20 73 63 72 6f 6c 6c 20 |ly add a| scroll |
|00005b20| 62 61 72 20 74 6f 20 74 | 68 65 20 6c 65 66 74 20 |bar to t|he left |
|00005b30| 68 61 6e 64 20 73 69 64 | 65 2e 20 20 54 68 65 20 |hand sid|e. The |
|00005b40| 69 6e 74 65 72 66 61 63 | 65 20 77 69 6c 6c 20 6c |interfac|e will l|
|00005b50| 6f 6f 6b 20 6c 69 6b 65 | 20 74 68 65 20 66 6f 6c |ook like| the fol|
|00005b60| 6c 6f 77 69 6e 67 20 61 | 66 74 65 72 20 74 68 65 |lowing a|fter the|
|00005b70| 20 62 75 74 74 6f 6e 20 | 68 61 73 20 62 65 65 6e | button |has been|
|00005b80| 20 70 72 65 73 73 65 64 | 20 73 65 76 65 72 61 6c | pressed| several|
|00005b90| 20 74 69 6d 65 73 3a ff | 00 15 0a 00 f7 0d fc 00 | times:.|........|
|00005ba0| 90 02 0a 00 90 02 0e 02 | ac 06 30 f7 ff 00 16 0a |........|..0.....|
|00005bb0| 00 f7 0d 00 25 fb 00 00 | 00 01 00 d9 00 f0 0f 36 |....%...|.......6|
|00005bc0| 2d 34 5f 53 63 72 6f 6c | 6c 54 65 78 74 2e 33 39 |-4_Scrol|lText.39|
|00005bd0| 37 32 31 31 2e 65 70 73 | f7 0d 00 4e 0d fc 00 90 |7211.eps|...N....|
|00005be0| 02 0a 00 90 00 0e 02 ac | 06 30 f7 0d fc 00 90 01 |........|.0......|
|00005bf0| f0 04 00 6c 02 0e 06 30 | f7 ff 00 15 0a 01 f7 46 |...l...0|.......F|
|00005c00| 69 67 75 72 65 20 36 2d | 35 3a 20 55 73 69 6e 67 |igure 6-|5: Using|
|00005c10| 20 61 20 53 63 72 6f 6c | 6c 69 6e 67 20 54 65 78 | a Scrol|ling Tex|
|00005c20| 74 20 4f 62 6a 65 63 74 | 0d 0d 00 c6 64 00 0a 5d |t Object|....d..]|
|00005c30| 00 2a a6 00 09 b9 00 00 | a7 00 02 90 01 88 64 00 |.*......|......d.|
|00005c40| 15 90 00 7e 64 00 18 1a | 01 94 64 00 1f fb 00 9a |...~d...|..d.....|
|00005c50| 64 00 22 7e 00 70 05 00 | 0c 9e 00 79 64 00 47 43 |d."~.p..|...yd.GC|
|00005c60| 00 f2 64 00 0f e2 01 27 | 74 00 23 86 01 6c 64 00 |..d....'|t.#..ld.|
|00005c70| 26 60 00 7f 24 00 4a b4 | 00 8d 64 00 4d 37 00 83 |&`..$.J.|..d.M7..|
|00005c80| 44 00 2d 9d 00 38 05 00 | 11 f8 00 71 64 00 4f 34 |D.-..8..|...qd.O4|
|00005c90| 00 e0 64 00 2f ef 01 65 | 64 00 12 1f 01 dc 44 00 |..d./..e|d.....D.|
|00005ca0| 33 d6 00 a8 44 00 37 d1 | 00 1c 45 00 0a 2e 01 0a |3...D.7.|..E.....|
|00005cb0| 64 00 51 33 01 18 64 00 | 3a 75 02 af 64 00 3e 43 |d.Q3..d.|:u..d.>C|
|00005cc0| 00 e9 05 00 02 b3 00 df | 64 00 53 d5 00 7e 64 00 |........|d.S..~d.|
|00005cd0| 04 65 01 5e 64 00 07 21 | 01 44 64 00 55 ac 00 f6 |.e.^d..!|.Dd.U...|
|00005ce0| 64 00 59 52 00 d3 05 00 | 5b b3 00 de 64 00 5b da |d.YR....|[...d.[.|
|00005cf0| 00 38 00 67 0d ff 00 15 | 0a 00 f7 4f 62 6a 65 63 |.8.g....|...Objec|
|00005d00| 74 20 42 61 73 65 64 20 | 43 6f 6d 70 75 74 69 6e |t Based |Computin|
|00005d10| 67 3a 20 41 20 4e 65 78 | 74 53 74 65 70 20 54 75 |g: A Nex|tStep Tu|
|00005d20| 74 6f 72 69 61 6c 20 61 | 6e 64 20 43 6f 6f 6b 62 |torial a|nd Cookb|
|00005d30| 6f 6f 6b 20 2d 20 56 65 | 72 73 69 6f 6e 20 31 2e |ook - Ve|rsion 1.|
|00005d40| 35 20 2d 20 44 47 4d 0d | 43 68 61 70 74 65 72 20 |5 - DGM.|Chapter |
|00005d50| 36 3a 20 45 76 65 6e 74 | 73 0d 0d 00 c6 64 00 0a |6: Event|s....d..|
|00005d60| 5d 00 2a a6 00 5c f2 00 | 00 a7 00 02 90 01 88 64 |].*..\..|.......d|
|00005d70| 00 15 90 00 7e 64 00 18 | 1a 01 94 64 00 1f fb 00 |....~d..|...d....|
|00005d80| 9a 64 00 22 7e 00 70 05 | 00 0c 9e 00 79 64 00 47 |.d."~.p.|....yd.G|
|00005d90| 43 00 f2 64 00 0f e2 01 | 27 74 00 23 86 01 6c 64 |C..d....|'t.#..ld|
|00005da0| 00 26 60 00 7f 24 00 4a | b4 00 8d 64 00 4d 37 00 |.&`..$.J|...d.M7.|
|00005db0| 83 44 00 2d 9d 00 38 05 | 00 11 f8 00 71 64 00 4f |.D.-..8.|....qd.O|
|00005dc0| 34 00 e0 64 00 2f ef 01 | 65 64 00 12 1f 01 dc 44 |4..d./..|ed.....D|
|00005dd0| 00 33 d6 00 a8 44 00 37 | d1 00 1c 45 00 0a 2e 01 |.3...D.7|...E....|
|00005de0| 0a 64 00 51 33 01 18 64 | 00 3a 75 02 af 64 00 3e |.d.Q3..d|.:u..d.>|
|00005df0| 43 00 e9 05 00 02 b3 00 | df 64 00 53 d5 00 7e 64 |C.......|.d.S..~d|
|00005e00| 00 04 65 01 5e 64 00 07 | 21 01 44 64 00 55 ac 00 |..e.^d..|!.Dd.U..|
|00005e10| f6 64 00 59 52 00 d3 05 | 00 5b b3 00 de 64 00 5b |.d.YR...|.[...d.[|
|00005e20| da 00 38 00 18 04 00 02 | 00 00 38 04 00 02 06 00 |..8.....|..8.....|
|00005e30| 38 24 00 5c f2 00 38 04 | 00 02 90 00 2a 02 3e f5 |8$.\..8.|....*.>.|
|00005e40| f6 ff 00 15 24 01 f7 43 | 68 61 70 74 65 72 20 36 |....$..C|hapter 6|
|00005e50| 0d 45 76 65 6e 74 73 20 | 2d 20 4f 75 74 6c 65 74 |.Events |- Outlet|
|00005e60| 73 20 66 6f 72 20 79 6f | 75 72 20 46 72 75 73 74 |s for yo|ur Frust|
|00005e70| 72 61 74 69 6f 6e 73 ff | 00 15 0c 00 f7 0d 0d 0d |rations.|........|
|00005e80| 0d 0d 0d 0d 0d 0d 0d ff | 00 15 0c 02 f7 0d 0d ff |........|........|
|00005e90| 00 15 24 01 f7 0d ff 00 | 15 18 01 f7 ff 00 15 0c |..$.....|........|
|00005ea0| 02 f7 0d fc 00 7e 01 e6 | 00 7e 00 0e 02 b0 06 30 |.....~..|.~.....0|
|00005eb0| f7 49 74 20 74 6f 6f 6b | 20 6d 65 20 61 20 79 65 |.It took| me a ye|
|00005ec0| 61 72 20 74 6f 20 6c 65 | 61 72 6e 20 74 6f 20 63 |ar to le|arn to c|
|00005ed0| 72 65 61 74 65 20 61 20 | 73 6d 61 6c 6c 20 70 72 |reate a |small pr|
|00005ee0| 6f 67 72 61 6d 20 77 69 | 74 68 20 5b 6d 79 20 70 |ogram wi|th [my p|
|00005ef0| 72 65 76 69 6f 75 73 20 | 73 79 73 74 65 6d 5d 2e |revious |system].|
|00005f00| 20 20 49 20 77 61 73 20 | 76 65 72 79 20 66 72 75 | I was |very fru|
|00005f10| 73 74 72 61 74 65 64 20 | 74 68 61 74 20 6a 75 73 |strated |that jus|
|00005f20| 74 20 74 6f 20 63 72 65 | 61 74 65 20 61 20 73 6d |t to cre|ate a sm|
|00005f30| 61 6c 6c 20 70 72 6f 67 | 72 61 6d 20 74 6f 6f 6b |all prog|ram took|
|00005f40| 20 6d 65 20 73 65 76 65 | 72 61 6c 20 64 61 79 73 | me seve|ral days|
|00005f50| 20 61 6e 64 20 74 68 6f | 75 73 61 6e 64 73 20 6f | and tho|usands o|
|00005f60| 66 20 6c 69 6e 65 73 20 | 6f 66 20 63 6f 64 65 2e |f lines |of code.|
|00005f70| 20 20 43 68 61 6e 67 69 | 6e 67 20 6f 6e 65 20 73 | Changi|ng one s|
|00005f80| 6d 61 6c 6c 20 66 65 61 | 74 75 72 65 20 69 6e 20 |mall fea|ture in |
|00005f90| 61 6e 20 6f 6c 64 20 70 | 72 6f 67 72 61 6d 20 77 |an old p|rogram w|
|00005fa0| 61 73 20 61 20 64 61 79 | 20 6c 6f 6e 67 20 74 61 |as a day| long ta|
|00005fb0| 73 6b 2e 20 20 54 68 65 | 6e 20 49 20 73 74 61 72 |sk. The|n I star|
|00005fc0| 74 65 64 20 75 73 69 6e | 67 20 4e 65 58 54 73 74 |ted usin|g NeXTst|
|00005fd0| 65 70 2e 20 20 49 6e 20 | 6f 6e 65 20 77 65 65 6b |ep. In |one week|
|00005fe0| 20 49 20 77 61 73 20 64 | 6f 69 6e 67 20 69 6e 20 | I was d|oing in |
|00005ff0| 6d 6f 72 65 20 69 6e 20 | 61 20 64 6f 7a 65 6e 20 |more in |a dozen |
|00006000| 6c 69 6e 65 73 20 74 68 | 65 6e 20 49 20 63 6f 75 |lines th|en I cou|
|00006010| 6c 64 20 62 65 66 6f 72 | 65 20 69 6e 20 61 20 74 |ld befor|e in a t|
|00006020| 68 6f 75 73 61 6e 64 20 | 6c 69 6e 65 73 20 6f 66 |housand |lines of|
|00006030| 20 63 6f 64 65 2e 20 20 | 57 68 79 20 64 69 64 6e | code. |Why didn|
|00006040| 27 74 20 5b 6d 79 20 70 | 72 65 76 69 6f 75 73 20 |'t [my p|revious |
|00006050| 63 6f 6d 70 75 74 65 72 | 20 76 65 6e 64 6f 72 5d |computer| vendor]|
|00006060| 20 64 6f 20 74 68 69 73 | 20 69 6e 20 74 68 65 20 | do this| in the |
|00006070| 66 69 72 73 74 20 70 6c | 61 63 65 3f 0d 00 c6 64 |first pl|ace?...d|
|00006080| 00 5e 3d 00 2a a6 00 5c | f2 00 00 a7 00 02 90 01 |.^=.*..\|........|
|00006090| 88 64 00 15 90 00 7e 64 | 00 18 1a 01 94 64 00 1f |.d....~d|.....d..|
|000060a0| fb 00 9a 64 00 22 7e 00 | 70 05 00 0c 9e 00 79 64 |...d."~.|p.....yd|
|000060b0| 00 47 43 00 f2 64 00 0f | e2 01 27 74 00 23 86 01 |.GC..d..|..'t.#..|
|000060c0| 6c 64 00 26 60 00 7f 24 | 00 4a b4 00 8d 64 00 4d |ld.&`..$|.J...d.M|
|000060d0| 37 00 83 44 00 2d 9d 00 | 38 05 00 11 f8 00 71 64 |7..D.-..|8.....qd|
|000060e0| 00 4f 34 00 e0 64 00 2f | ef 01 65 64 00 12 1f 01 |.O4..d./|..ed....|
|000060f0| dc 44 00 33 d6 00 a8 44 | 00 37 d1 00 1c 45 00 0a |.D.3...D|.7...E..|
|00006100| 2e 01 0a 64 00 51 33 01 | 18 64 00 3a 75 02 af 64 |...d.Q3.|.d.:u..d|
|00006110| 00 3e 43 00 e9 05 00 02 | b3 00 df 64 00 53 d5 00 |.>C.....|...d.S..|
|00006120| 7e 64 00 04 65 01 5e 64 | 00 07 21 01 44 64 00 55 |~d..e.^d|..!.Dd.U|
|00006130| ac 00 f6 64 00 59 52 00 | d3 05 00 5b b3 00 de 64 |...d.YR.|...[...d|
|00006140| 00 5b da 00 38 00 21 0d | 50 61 67 65 20 36 2d fd |.[..8.!.|Page 6-.|
|00006150| 00 f7 20 20 20 20 20 20 | 20 fd 01 f7 20 20 20 20 |.. | ... |
|00006160| 20 20 20 fd 02 f7 0d 0d | 00 c6 64 00 5e 3d 00 2a | .....|..d.^=.*|
|00006170| a6 00 5c f2 00 00 a7 00 | 61 45 01 88 64 00 15 90 |..\.....|aE..d...|
|00006180| 00 7e 64 00 18 1a 01 94 | 64 00 1f fb 00 9a 64 00 |.~d.....|d.....d.|
|00006190| 22 7e 00 70 05 00 0c 9e | 00 79 64 00 47 43 00 f2 |"~.p....|.yd.GC..|
|000061a0| 64 00 0f e2 01 27 74 00 | 23 86 01 6c 64 00 26 60 |d....'t.|#..ld.&`|
|000061b0| 00 7f 24 00 4a b4 00 8d | 64 00 4d 37 00 83 44 00 |..$.J...|d.M7..D.|
|000061c0| 2d 9d 00 38 05 00 11 f8 | 00 71 64 00 4f 34 00 e0 |-..8....|.qd.O4..|
|000061d0| 64 00 2f ef 01 65 64 00 | 12 1f 01 dc 44 00 33 d6 |d./..ed.|....D.3.|
|000061e0| 00 a8 44 00 37 d1 00 1c | 45 00 0a 2e 01 0a 64 00 |..D.7...|E.....d.|
|000061f0| 51 33 01 18 64 00 3a 75 | 02 af 64 00 3e 43 00 e9 |Q3..d.:u|..d.>C..|
|00006200| 05 00 02 b3 00 df 64 00 | 53 d5 00 7e 64 00 04 65 |......d.|S..~d..e|
|00006210| 01 5e 64 00 07 21 01 44 | 64 00 55 ac 00 f6 64 00 |.^d..!.D|d.U...d.|
|00006220| 59 52 00 d3 05 00 5b b3 | 00 de 64 00 5b da 00 38 |YR....[.|..d.[..8|
|00006230| 00 18 04 00 02 00 00 38 | 04 00 02 06 00 38 24 00 |.......8|.....8$.|
|00006240| 5c f2 00 38 04 00 61 45 | 00 2a |\..8..aE|.* |
+--------+-------------------------+-------------------------+--------+--------+