# Macintosh Programming Techniques 1994 — source transcripts, page 1

[Canonical transcript page](https://www.vintageapple.net/transcripts/media/va-macintosh-programming-techniques-1994-f77176/1)

## Transcribed source material

Machine transcriptions and image descriptions; uncertain copy may be marked [illegible]. Verify against the linked originals. Historical rights remain with the original owners.

These are transcribed excerpts, not the full publications. Open the originals for remaining pages.

### Image 1

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-programming-techniques-1994-f77176/1#scan-fd6b3c17700fbda247aa7c1b1713c9f05914855bd4c1ed5077e9342dae5a254f)

Transcribed text:

New Technology Building Blocks

DISK INCLUDED

Macintosh Programming Techniques

A Foundation for All Macintosh Programmers

• Learn essential techniques for expert Macintosh programming

• Understand terms and concepts unique to Macintosh programming

• Gain hands-on experience with interactive software tutorial

Dan Parks Sydow

M&T BOOKS

Series Editor: Anthony Meadow
Bear River Associates

Image description: A book cover with a green and red layout showing a yellow Macintosh-style computer monitor, keyboard, mouse and tower, with a sparkling burst on the screen and a small green cartoon figure on a floppy disk emitting a glowing trail.

Reading notes: Small text in the top-right disk badge and M&T logo may be approximate. Series title line and author line are on separate visual levels; reading order follows layout.

Printed product names: Macintosh Programming Techniques

Languages: English

[Original Image 1](https://www.vintageapple.net/files/cccf75c13441c982c9ef1794de3bca0cefe9f572cd80c2a65333ce88702af66c/4a2071c144f1136e121d1567.webp)

### PDF page 1

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-programming-techniques-1994-f77176/1#scan-f508d6ed719349f7dd0121f9eaf87c1db0314233b35ac742530f66be21e287c0)

Macintosh Programming Techniques

Transcribed text:

Macintosh
Programming
Techniques
A Foundation for All Macintosh Programmers
~
• Learn   essential techniques for expert Macintosh
programming
•   Understand   terms and concepts unique to
Macintosh programming
•   Gain hands-on experience with interactive
software tutorial   Dan   Parks   Sydow

Reading notes: Transcript is intentionally empty because the exact extracted text is preserved separately; other fields were filled from the supplied copy only. Layout, reading order, and visual artwork were not confirmed against the image and are inferred from the supplied text. The supplied text ends with 'Dan Parks Sydow' with no separator, so the line break and whether it is one name or several (e.g., 'Dan Parks' and 'Sydow') is uncertain. The tilde (~) between the subtitle and the bullet list may be a decorative mark rather than text. No prices or dates appear in the supplied copy, so none were listed.

Printed product names: Macintosh Programming Techniques

Languages: English

[Original PDF page 1](https://www.vintageapple.net/files/f0abc2f1f3ee1c2ccd4e9ab347d9022ce747f91ee95cc1ca5cd1fdedc5324305/Macintosh_Programming_Techniques_1994.pdf#page=1)

### PDF page 2

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-programming-techniques-1994-f77176/1#scan-41c949bc1ae1722b00bed2d4fa8a45cf66ad26797ae32b8afba71919d8f6907f)

Image description: The image is a plain, entirely blank white portrait page with no visible artwork, layout, or markings.

Reading notes: No visible text found in the image; transcript and printed fields left empty.

[Original PDF page 2](https://www.vintageapple.net/files/f0abc2f1f3ee1c2ccd4e9ab347d9022ce747f91ee95cc1ca5cd1fdedc5324305/Macintosh_Programming_Techniques_1994.pdf#page=2)

### PDF page 3

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-programming-techniques-1994-f77176/1#scan-da673276da5d45f0041c5d66fd845fcf11c4c27d5dce29e84a7c38e9ba07dd43)

Image description: The image is a blank white page with no visible artwork, layout, or text.

[Original PDF page 3](https://www.vintageapple.net/files/f0abc2f1f3ee1c2ccd4e9ab347d9022ce747f91ee95cc1ca5cd1fdedc5324305/Macintosh_Programming_Techniques_1994.pdf#page=3)

### PDF page 4 · PDF page 6

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-programming-techniques-1994-f77176/1#scan-6b593f14ac300fe7e456afa17e67fd69be55bf9d33fb4942577a53eccd826ec6)

Image description: The image is an entirely blank white portrait-format page with no visible artwork, layout elements, or text.

Reading notes: No visible text found in the image; transcript and printed fields left empty per instructions.

[Original PDF page 4](https://www.vintageapple.net/files/f0abc2f1f3ee1c2ccd4e9ab347d9022ce747f91ee95cc1ca5cd1fdedc5324305/Macintosh_Programming_Techniques_1994.pdf#page=4) · [Original PDF page 6](https://www.vintageapple.net/files/f0abc2f1f3ee1c2ccd4e9ab347d9022ce747f91ee95cc1ca5cd1fdedc5324305/Macintosh_Programming_Techniques_1994.pdf#page=6)

### PDF page 5

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-programming-techniques-1994-f77176/1#scan-91e68449136d611d533d4bd89dfb62f43f7d13510fea4e7b005fbe8939c6887a)

Transcribed text:

M&T Books
A Division of MIS:Press, Inc.
A Subsidiary of Henry Holt and Company, Inc.
115   West 18th   Street
New York, New York   10011
©   1994 by M&T Books
Printed in the   United   States   of America
All rights reserved. No part of this book may be reproduced or transmitted in any form or by any
means, electronic or mechanical, including photocopying, recording, or by any information storage
and retrieval system, without prior written permission from the Publisher. Contact the Publisher for
information on foreign rights.
Limits of Liability and Disclaimer of Warranty
The Author and Publisher of this book have used their best efforts in preparing the book and the pro-
grams contained in it. These efforts include the development, research, and testing of the theories and
programs to determine their effectiveness.
The Author and Publisher make no warranty of any kind, expressed or implied, with regard to these
programs or the documentation contained in this book. The Author and Publisher shall not be liable
in any event for incidental or consequential damages in connection with, or arising out of, the fur-
nishing, performance, or use of these programs.
All products, names and services are trademarks or registered trademarks of their respective companies.
Library of Congress Cataloging-in-Publication Data
Sydow,   Dan   P.
Macintosh programming techniques: a foundation for all Macintosh programmers   I
DanP.   Sydow
p. cm.
Includes index.
ISBN   l-55828-326-9   : $34.95
1. Macintosh (Computer)--Programming. I. Title.
QA76.8.M3S96   1993
005   .265--dc20
96   95   94   4 3 2
Publisher:   Steve   Berkowitz
Associate Publisher: Brenda McLaughlin
Project Editor: Margot   Owens   Pagan
Development Editor: Mike Miley
Copy Editor: Judy Whittle
Technical Editor: Ray   Valdes
Production Editor: Eileen Mullin
Associate   Production   Editors: Maya Riddick, Joseph McPartland
Cover Design:   JPD   Communications
93-46619
CIP

Reading notes: Library of Congress catalog data contains OCR spacing and character irregularities such as 'DanP.' and 'l-55828-326-9' Cataloging line 'QA76.8.M3S96 1993' and printer digits '96 95 94 4 3 2' have uncertain reading order

Printed product names: Macintosh (Computer)

Printed prices: $34.95

Printed dates: 1994 · 1993 · 96 · 95 · 94

Languages: English

[Original PDF page 5](https://www.vintageapple.net/files/f0abc2f1f3ee1c2ccd4e9ab347d9022ce747f91ee95cc1ca5cd1fdedc5324305/Macintosh_Programming_Techniques_1994.pdf#page=5)

### PDF page 7

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-programming-techniques-1994-f77176/1#scan-16090bc2af06a9494d3bb7a469d1b9e14009b3ccce10d563c63418d422de25ef)

Transcribed text:

.,,.
'~··~   /
Table   of   Contents
Fe>re"VVe>rc:I   •••••••••••••••••••••••••••••••••••••••••••••••••••• lClCi
Why   This   Be>e>k   is   fe>r   Ye>u   ••••••••••••••••••••••••••••••••   1
l11tre>c:lllctie>11   ••••••••••••••••••••••••••••••••••••••••••••••••••••   3
What's on the Disk .........................................................................................   4
What You Need   ...............................................................................................5
Extracting the Contents of the Disk .............................................................5
Using   the   In   Action! Program   ........................................................................   9
Running the program ...............................................................................   9
The program windows .............................................................................   9
Moving about   in   the program   ................................................................   10
Chapter   1:   l11tre>c:luctio11   te>   Maci11te>sh
Pre>grammi11g   ••••••••••••••••••••••••••••••••••••••••••••••••   13
Development Systems ................................................................................. 13
Information environments ....................................................................14
Application frameworks ........................................................................ 14
Programming languages   .........................................................................14
vii

Reading notes: Headline not clearly identifiable; source appears to be a table of contents with no primary heading Possible OCR artifacts in characters such as 'lClCi' and 'Be>e>k' in the table of contents

Printed product names: In Action!

Languages: English

[Original PDF page 7](https://www.vintageapple.net/files/f0abc2f1f3ee1c2ccd4e9ab347d9022ce747f91ee95cc1ca5cd1fdedc5324305/Macintosh_Programming_Techniques_1994.pdf#page=7)

### PDF page 8

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-programming-techniques-1994-f77176/1#scan-51050b0bdabc06842e67111a5a232094782bf93ad58465ce2e4618ea1a0c7d63)

Transcribed text:

•••
VIII   Macintosh Programming Techniques
About Macintosh Programming   .................................................................. 15
Bit-mapped Graphics .................................................................................... 16
Event-driven Programming   .......................................................................... 17
Resources   .......................................................................................................   22
The Toolbox ..................................................................................................   26
The Operating System   ..................................................................................   31
System Software ...........................................................................................32
The System File and Finder .........................................................................   33
The   System   file   .......................................................................................   33
The Finder   ...............................................................................................34
Chapter Program: Intro to Mac Programming ...........................................35
Program project:   VeryBasics.n   ...............................................................36
Program resources:   VeryBasics.   n.rsrc   ...................................................   3   7
Program listing:   VeryBasics.c ................................................................38
Stepping through the code .....................................................................   40
Where are the   #includes?   ................................................................   40
Function prototypes   .........................................................................   41
The   #define   directives .....................................................................   41
Global variables ...............................................................................   42
The   main()   function ........................................................................   42
Toolbox initialization ......................................................................   42
Loading a window   ............................................................................   43
Drawing to a window ......................................................................   44
The main event loop   ........................................................................   45
A Macintosh function .....................................................................   46
Chapter Summary ........................................................................................   47
Chapter 1 Lessons on Disk
0.   Lesson   1-1:   Events .................................................................................   22
p   Lesson 1-2. Resources   ............................................................................   26
Lesson 1--3: The Toolbox ....................................................................... 30
Chapter   2: Macintosh Memory   •••••••••••••••••••••• 49
Memory Organization ..................................................................................   49
System partition organization   ...............................................................   50
System   global variables ...................................................................   51
System heap .....................................................................................   51
Application partition organization .......................................................   52
AS World   ...........................................................................................   52
Application stack .............................................................................   52

Reading notes: Table of contents with dot leaders and page numbers; some OCR fragments such as 'p Lesson 1-2' and 'AS World' are uncertain. Heading 'Chapter 1 Lessons on Disk' appears out of sequence with the surrounding contents, so reading order is uncertain.

Languages: English

[Original PDF page 8](https://www.vintageapple.net/files/f0abc2f1f3ee1c2ccd4e9ab347d9022ce747f91ee95cc1ca5cd1fdedc5324305/Macintosh_Programming_Techniques_1994.pdf#page=8)

### PDF page 9

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-programming-techniques-1994-f77176/1#scan-8d58a6c3a2cd33d9841c338e022fbf2972d655978d2d77c7f823b5f018d3355e)

Transcribed text:

• Table   of   Contents   IX
Application heap ..............................................................................   54
Summary   of memory organization .......................................................   56
The Application Heap ..................................................................................   57
Heap fragmentation ...............................................................................   58
Heap compaction ...................................................................................   60
Nonrelocatable and relocatable blocks   .................................................   61
Chapter Program: Memory Partitions ........................................................   65
Program resources:   MemoryFiller.1t.rsrc ...............................................68
Program listing:   MemoryFiJler.c   ...........................................................   69
Stepping through the code .....................................................................   70
Chapter   Summary   ........................................................................................ 71
Disk Files
Lesson 2-1: Memory organization ........................................................   57
Lesson 2-2: Heap fragmentation ...........................................................   58
Lesson 2-3: Heap compaction ...............................................................   60
Lesson 2-4: Master Pointers and Handles ............................................   64
Chapter 2 Lessons on Disk
b.   Lesson 2-1: Memory organization ........................................................   57
b   Lesson 2-2: Heap fragmentation ...........................................................   58
Lesson 2-3: Heap compaction ...............................................................   60
Lesson 2-4: Master pointers and handles .............................................   64
Chapter   3: Resources   ••••••••••••••••••••••••••••••••••••   73
About Resources ...........................................................................................   74
The importance of resources .................................................................   74
Resource types ........................................................................................   75
Checking for errors ................................................................................ 75
Working With   Strings   ...................................................................................   77
The   'STR#'   resource ...............................................................................   77
Using a string in a program ...................................................................   78
Pictures and Animation ...............................................................................   81
The   'PICT'   resource ...............................................................................   81
Displaying a 'PICT' in a program   ..........................................................   83
Using 'PICT's to create animation   ........................................................   86
Creating a series of 'PICT's .............................................................   86
Animation source code ...................................................................   88
Sounding   Off   .................................................................................................   91
The 'snd' file ..........................................................................................   91
The 'snd' resource .................................................................................   92

Reading notes: Table of contents entries show inconsistent OCR spacing and punctuation in several lines, e.g. 'MemoryFiJler.c' and 'Lesson 2-1' repeated with varied bullet characters.

Languages: English

[Original PDF page 9](https://www.vintageapple.net/files/f0abc2f1f3ee1c2ccd4e9ab347d9022ce747f91ee95cc1ca5cd1fdedc5324305/Macintosh_Programming_Techniques_1994.pdf#page=9)

### PDF page 10

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-programming-techniques-1994-f77176/1#scan-163c393562daed17b5088f1764789ddf2db04806e96c01d8049bc58717e39014)

Transcribed text:

X   Macintosh Programming Techniques
Playing a 'snd' in a program .................................................................   94
Giving a Program an Icon ............................................................................   95
Th.e Finder and icons   ..............................................................................   96
Creating the 'BNDL' resource ...............................................................   97
Setting the Creator in the compiler   ....................................................   102
Making the Finder aware of a new icon .............................................   102
Chapter Program:   Using   Resources   ...........................................................   103
Program resources:   ResourceUser:rc.rsrc   ............................................   104
Program listing:   ResourceUser.c .........................................................   106
Stepping through the code ...................................................................   110
The   #include   directives   .................................................................   110
The   #define   directives ...................................................................   110
The   main()   Function ..................................................................... 111
Using   strings .................................................................................. 112
Using   pictures for animation ........................................................ 113
Playing sounds ............................................................................... 113
Chapter Summary ...................................................................................... 113
Chapter 3 Lessons on Disk
tu   Lesson 3-1: The   'STR#'   resource ..........................................................   80
~   Lesson 3-2:   Th~   'PIC?T'   resource ...........................................................   86
Lesson 3-3: Animation ..........................................................................   90
Chapter   4:   QuickDraw Graphics   •••••••••••••••••   115
About QuickDraw ...................................................................................... 115
Initializing QuickDraw ....................................................................... 116
Pixels and the coordinate system ....................................................... 117
Graphics   Ports   ............................................................................................. 118
The   Graf Port   and GrafPtr   .................................................................... 118
The graphics pen .................................................................................. 119
Defensive Drawing ..................................................................................... 121
Changing ports ..................................................................................... 121
Changing characteristics of a port ...................................................... 123
Drawing   Shapes   .......................................................................................... 125
Working with rectangles   ...................................................................... 126
Working with ovals .............................................................................. 128
Working with round rectangles   ........................................................... 129
Patterns ....................................................................................................... 131
The   'PAT   ' resource .............................................................................. 131
The pattern source code ...................................................................... 133

Reading notes: Several table-of-contents entries contain OCR-damaged characters (e.g., 'Th.e', 'tu', '~', 'PIC?T', 'Graf Port') Reading order of mixed table-of-contents sections is uncertain

Languages: English

[Original PDF page 10](https://www.vintageapple.net/files/f0abc2f1f3ee1c2ccd4e9ab347d9022ce747f91ee95cc1ca5cd1fdedc5324305/Macintosh_Programming_Techniques_1994.pdf#page=10)

### PDF page 11

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-programming-techniques-1994-f77176/1#scan-01b142ebce610463eb4500bf718b556325d3a32f0f272323663c3f823c73da93)

Transcribed text:

• Table   of   Contents   XI
Color QuickDraw ....................................................................................... 134
Checking for color   ................................................................................ 134
Color windows ..................................................................................... 136
Color pattems   ....................................................................................... 137
The 'ppat' resource ........................................................................ 138
The color pattern source code ...................................................... 138
Color drawing .......................................................................................   140
The 'wctb' resource .............................................................................. 141
The Cursor .................................................................................................. 143
Chapter Program: Drawing on the Mac .................................................... 146
Program resources:   QuickDrawing.1t.rsrc   .......................................... 146
Program listing:   ResourceUser.c ......................................................... 147
Stepping through the code ...................................................................   152
The   #include   directives   ................................................................. 152
The   #define   directives ................................................................... 152
The   main()   function ...................................................................... 153
lnitialization   ................................................................................... 153
Checking for color ......................................................................... 154
Preserving the environment ......................................................... 154
Lines and shape painting   ............................................................... 155
Shape filling   .................................................................................... 156
Chapter Summary ...................................................................................... 15   7
Chapter 4 Lessons on Disk
tu   Lesson 4-1: Moving the pen ................................................................ 121
μ   Lesson 4-2:   Sw~tching   ports ................................................................ 123
Lesson 4-3:   Using   patterns   .................................................................. 134
Chapter   5: Working With Windows   ••••••••••••   159
Windows Primer .........................................................................................   160
The WIND resource .............................................................................   160
Loading a 'WIND'   .................................................................................   160
The WindowRecord, WindowPtr, and WindowPeek.........................   161
Event Handling ........................................................................................... 163
Windows and Events ..................................................................................   170
Mouse down events ............................................................................. 171
Handling a mouse click in a drag bar ...........................................   171
Handling a mouse click in a close box   .........................................   173
Handling a mouse click in a content region ................................   174
Handling a mouse click in other areas   .........................................   175

Reading notes: Table of contents page numbers and some characters are garbled (e.g., 'pems', 'tu', 'μ', 'Sw~tching').

Languages: English

[Original PDF page 11](https://www.vintageapple.net/files/f0abc2f1f3ee1c2ccd4e9ab347d9022ce747f91ee95cc1ca5cd1fdedc5324305/Macintosh_Programming_Techniques_1994.pdf#page=11)

### PDF page 12

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-programming-techniques-1994-f77176/1#scan-e4c53d6489726ecc7b2db3fa6d1b2d3cf8fdbd4d06725d3c7884f6ade02692ef)

Transcribed text:

•• XI   I   Macintosh Programming Techniques
Single Window Techniques .......................................................................   176
Activate events ..................................................................................... 177
Updating   a window ..............................................................................   177
Simple window techniques ................................................................. 182
Moving a window .......................................................................... 183
Showing and hiding a window   ......................................................   184
Changing a window's title ............................................................ 184
Multiple Window Techniques ...................................................................   184
Expanding the WindowRecord   ............................................................ 185
Activates and multiple windows ........................................................   190
Updates   and multiple windows .......................................................... 192
Chapter Program: Working With Multiple Windows ..............................   193
Program   resources:   MultiWindows.1t.rsrc   ..........................................   194
Program   listing: MultiWindows.c   ....................................................... 195
Stepping through the code   ...................................................................   205   .
The   #include   directives .................................................................   205
The   #define   directives ...................................................................   205
Global types ...................................................................................   206
Global variables .............................................................................   206
The   main()   function ......................................................................   207
Initialization   ...................................................................................   208
Marking and examining a window   ...............................................   209
Opening   a window   .........................................................................   211
Event handling ...............................................................................   213
Chapter Summary ......................................................................................   220
Chapter 5 Lessons on Disk
tu   Lesson 5-1: Handling events ............................................................... 169
D   Lesson 5-2: Window updating ............................................................ 182
Lesson 5-3:   MyWindPeek .................................................................... 185
Lesson 5-4:   Using   MyWindPeek ......................................................... 185
Chapter   6:   Dealing   With   Dialogs   •••••••••••••••••   223
Alerts ...........................................................................................................   224
Alert resources: 'ALRT' and 'DITL' ....................................................   224
Alert source code   ..................................................................................   227
Dialogs .........................................................................................................   228
Dialog Resources ........................................................................................   229
Dialog item types .................................................................................   229
The   'DLOG'   and 'DITL' Resources .....................................................   230

Reading notes: Table of contents page; some entries contain stray bullet and page-number characters that may affect reading order.

Languages: English

[Original PDF page 12](https://www.vintageapple.net/files/f0abc2f1f3ee1c2ccd4e9ab347d9022ce747f91ee95cc1ca5cd1fdedc5324305/Macintosh_Programming_Techniques_1994.pdf#page=12)
