# Macintosh Programming Techniques, Second Edition — source transcripts, page 1

[Canonical transcript page](https://www.vintageapple.net/transcripts/media/va-macintosh-programming-techniques-1996-a8256e/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-1996-a8256e/1#scan-0348070d32e0a2609bf95e07d54ee7c155d231d2fc49eafc0eeed8ac2665ae0e)

Transcribed text:

New Technology Building Blocks

Macintosh Programming Techniques SECOND EDITION

A Foundation for all Macintosh Programmers

CD-ROM INCLUDED

Master the fundamentals of Macintosh programming

Covers 68k and Power Macintosh techniques

Includes advice on memory management, resources, and system calls

CD-ROM includes a limited version of Symantec C++ for the Macintosh

Series Editor: Tony Meadow
Bear River Associates

M&T BOOKS

Dan Parks Sydow

Image description: A book cover with a dark background, large yellow title text, a blue banner, a photo of a hand reaching toward beige computers on the right, an orange vertical stripe on the left, a CD-ROM badge, and a bear river associates logo.

Reading notes: Small logo text near the bottom left (Bear River Associates) and the M&T Books mark are partially stylized and were transcribed as shown; the small text under the Series Editor line may be slightly imprecise.

Printed product names: Symantec C++ for the Macintosh

Printed dates: Second Edition

Languages: English

[Original Image 1](https://www.vintageapple.net/files/f786f278f63e5bcd308aa84fde84ac2c1f87b3fb0b1fe6b5f40533aeb07749c3/cc7f99e7d99dbd6a684b30ff.webp)

### PDF page 1

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-programming-techniques-1996-a8256e/1#scan-ee161d84c2cdc8f6004ea0e45bf53c1d54cc28de42c4a522055877fdd2922041)

Transcribed text:

New Technology Building Blocks

Macintosh Programming Techniques SECOND EDITION

A Foundation for all Macintosh Programmers

CD-ROM INCLUDED

Master the fundamentals of Macintosh programming

Covers 68k and Power Macintosh techniques

Includes advice on memory management, resources, and system calls

CD-ROM includes a limited version of Symantec C++ for the Macintosh

Series Editor: Tony Meadow
Bear River Associates

M&T BOOKS

Dan Parks Sydow

Image description: Book cover with a dark green and black background, large yellow title text, a blue banner, a CD-ROM badge, and a photo of a hand reaching toward beige computers and a monitor.

Reading notes: Small text in the photo area and the publisher logo text may be imprecise; the 'Bear River Associates' logo text is partly stylized.

Printed product names: Symantec C++

Languages: English

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

### PDF page 2

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-programming-techniques-1996-a8256e/1#scan-08cc253169eb178c3198ba031495229613e988c87af7c3a6f38f3da55324f998)

Transcribed text:

MACINTOSH PROGRAMMING TECHNIQUES, 2E

Image description: A cover-style title page with a vertical dark gray bar on the left displaying the large white letters M, P, and T, with the bold title text in dark type between two horizontal black rules on a plain white background.

Reading notes: Vertical letters M, P, T on the gray bar are stylized initials and were transcribed as part of the title block; the handwritten mark at top right is not legible text and was omitted.

Printed product names: Macintosh Programming Techniques, 2E

Languages: English

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

### PDF page 3

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-programming-techniques-1996-a8256e/1#scan-a207c025c563ab9d4229c16f21bd38cb51ca460c563dbb404ac8bc70b87e8eb6)

Macintosh Programming Techniques, 2E

Transcribed text:

MACINTOSH PROGRAMMING TECHNIQUES, 2E
MPT
Dan Sydow
M&T BOOKS

Image description: A book title page with a large vertical dark bar containing the letters M, P, T in white, horizontal rules above and below the title, the author name Dan Sydow in bold beneath, and the M&T Books logo at the bottom center, with faint bleed-through text from the reverse page visible on the right.

Reading notes: Faint bleed-through text from the reverse side of the page on the right edge and background is not transcribed because it is not legible. Title is set in stylized display type; the letters M, P, T are set in the vertical bar and read as MPT.

Printed product names: Macintosh Programming Techniques, 2E

Languages: English

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

### PDF page 4

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-programming-techniques-1996-a8256e/1#scan-cd3e9f4e2b1d7c6205e2ca33b3bf3b7955fc73a4f91d47736c696be92d215654)

Macintosh programming techniques

Transcribed text:

M&r   ~   M&T Books
[   '·1111   ~   A Division of   MIS:Press,   Inc.
11111'::   A Subsidiary of Henry Holt and Company, Inc.
115 West 18th Street
New York, New   York   10011
©   1996 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 programs 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 con-
nection with, or arising out of, the furnishing, 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 Parks.
Macintosh   programming techniques   I   Dan   Parks   Sydow.   --   2nd ed.
p.   Cm.
ISBN   1-55851-458-9
1.   Macintosh   (Computer)--Programming.   I.   Title.
QA76.8.M3S9582   1996
005.265--dc20   95-51548
10987654321
Associate Publisher:   Paul   Farrell
Editor: Michael Sprague
Copy Edit Manager: Shari Chappell
Managing Editor: Cary Sullivan
Technical Editor:   Peter   Ferranti
Copy Editor:   Suzanne   Ingrao
Production Editor: Maya Riddick
CIP

Reading notes: Publication date 1996 and 'dc20' cataloging code may be partly garbled; 'Sydow. Dan Parks.' author line has uncertain word order OCR spacing irregularities in the 'M&T Books' and ISBN fields

Printed dates: 1996 · 95-51548

Languages: English

[Original PDF page 4](https://www.vintageapple.net/files/af6bd1f51d308c6b5639cf51bb1c2fdc5247b06c56904dde0691a68d091ee3b9/Macintosh_Programming_Techniques_1996.pdf#page=4)

### PDF page 5

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-programming-techniques-1996-a8256e/1#scan-1778eccb2dd71133dd6c883df3c86a8a1c8f10b85cdac9e3398bc7e72a4147e5)

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

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

### PDF page 6

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-programming-techniques-1996-a8256e/1#scan-0fac846f1c0872973e43bb75687a494cfd7754cd13dcc10b9eeedc45501a4b25)

Transcribed text:

ficKnOWLEDGMEnTS
Michael Sprague, Development Editor, M&T Books, for keeping things
rolling and on schedule.
Maya Riddick, Production Editor, M&T Books, for such a fine page
layout effort.
Carole McClendon, Waterside Productions, for making   this   book happen.

Reading notes: Heading 'ficKnOWLEDGMEnTS' appears to be a stylized or OCR-affected rendering of 'ACKNOWLEDGMENTS'; uncertain whether it is a primary heading.

Languages: English

[Original PDF page 6](https://www.vintageapple.net/files/af6bd1f51d308c6b5639cf51bb1c2fdc5247b06c56904dde0691a68d091ee3b9/Macintosh_Programming_Techniques_1996.pdf#page=6)

### PDF page 7

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-programming-techniques-1996-a8256e/1#scan-0cc38c12e2299ef2d3c8e4b4dd4e9112840f2758f690088bed4fa48df6a93e54)

Transcribed text:

flCIHTOSH   PROGRAMMING   TECHHIQOES,   ZE
Contents
Why This Book is for   You   . . . . . . . . . . . . . . .   .xx.I
Introduction   ... .   •   •   . . .   •   . . . . . . . . . . . . . .   •.   .xx.Ill
Chapter   1: Macintosh Programming   Overview   ..   .1
Development Systems .......... .. .. . ........ ... ... .........1
Information Environments ...... . ..... . ............ ... ....2
Application Frameworks ............ .... .... . ..... ... ... .2
Programming Languages ............. ........... .. ... ....3
About Macintosh   Programming   .................. ..... . . . ...3
Bitrnapped Graphics .................... .. .. ....... . ... ... .4
Event-Driven Programming ............... .. ... ...... . .... .   .5
Resources ............ . ....... . . ..... ................... .11
Resource Editors ........ ..... ................. .. .. . . . ..12
Creating a Resource File and a Resource Using ResEdit   . .. ....13
Resources, Source Code, and Applications   . .. ...... .........16
Resource Types   ............ ......... .... .. .............19
The Toolbox ........... . ..... ... ................... .. ... .19
vii

Reading notes: OCR noise in the running header, e.g. 'flCIHTOSH' and 'TECHHIQOES' Page-number and table-of-contents layout may affect reading order

Printed product names: Macintosh · ResEdit

Languages: English

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

### PDF page 8

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-programming-techniques-1996-a8256e/1#scan-15e9cfded059fedd754b6a0f080963f29810a2dac817f9c94d80a91885993aab)

Transcribed text:

viii   Macintosh   Programming   Technlqaa.   ZE
Resources, Source Code, and the Toolbox ...................21
Toolbox Routines and Application-Defined Routines .........24
The Operating System .....................................25
System Software .........................................26
The System File and Finder ................................27
The System File ........................................27
The Finder ............................................28
Chapter Program: VeryBasics ............................... 30
Program Project: VeryBasics68K.μ or VeryBasics68K.7t ........32
Program Listing: VeryBasics.c ........................... .41
Stepping through the Code ..............................43
Chapter Summary ........................................51
Chapter   Z:   Macintosh   Memory   . . . . . . . . . . .   .53
Memory Organization .....................................53
System Partition Organization ........................... .56
Application Partition Organization ........................57
Summary of Memory Organization   .......................61
The Application Heap .....................................63
Heap Fragmentation ....................................63
Heap Compaction .......................................65
Nonrelocatable and Relocatable Blocks .....................67
Macintosh Memory Management ...........................72
Avoiding Heap Fragmentation ..............................74
How Nonrelocatable Blocks Get Created ...................74
Nonrelocatable Blocks and Heap Fragmentation .............76
Nonrelocatable Block Placement in the Heap ................77
Reserving Memory to Reduce Fragmentation ...............   79
Heap Management .......................................84
Allocating Master Pointer Blocks ..........................84

Reading notes: Source text is a table of contents with OCR damage in the header line ("Technlqaa.") and chapter title lines. Page numbers and reading order in the table of contents are partly garbled.

Languages: English

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

### PDF page 9

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-programming-techniques-1996-a8256e/1#scan-cc5eb13011e438d87cec2ec5180c223540589b1621e3388d54aa5ef530206a59)

Transcribed text:

Contents   ix
Expanding the Heap ....................................89
Setting the Application Partition Size of a Program ............. 90
The   User's   Role in Setting the Partition Size ................ 90
Setting an Application's   Partition   Size .....................92
Determining Your Application's Memory Needs .............93
Writing 32-Bit Clean   Programs   ..............................98
Chapter   Program:   MemoryBasics .......................... 101
Program   Resources: MemoryBasics.rsrc ................... 103
Program   Listing: MemoryBasics.c ........................ 103
Stepping through the Code ............................. 105
Chapter Summary ....................................... 107
Chapter   3: QuickDraw Graphics   .........   . 109
About QuickDraw and Color QuickDraw   ................... 110
Initializing QuickDraw ................................. 110
Pixels   and the Coordinate System ........................111
Graphics   Ports   ..........................................112
The GrafPort and GrafPtr ...............................113
Color Windows and the CGrafPort .......................114
The Graphics Pen   .....................................116
Defensive Drawing ......................................118
Changing   Ports   .......................................118
Changing Characteristics of a   Port   ....................... 120
Drawing Shapes .........................................122
Working with Rectangles ...............................123
Working with   Ovals   ...................................125
Working with Round Rectangles .........................127
Patterns ................................................129
The PAT Resource .....................................129
The PAT Source Code ..................................131

Reading notes: Source is a table of contents with dotted leaders and page numbers; no headline, product names, prices, or dates are printed. Some lines contain OCR-like spacing irregularities and possible dropped characters.

Languages: English

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

### PDF page 10

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-programming-techniques-1996-a8256e/1#scan-0481d2a5c2a5ac1a68f933413d999edad691c166b5c83000a013771f4f3bc055)

Transcribed text:

x   Macintosh   Programming   Techniques.   ZE
The ppat Color   Pattern   Resource .........................133
The ppat Color   Pattern   Source Code ......................134
Pictures   and Animation   ..................................137
The   PICT   Resource ....................................137
Displaying a   PICT   in a   Program   .........................139
Using   PICT   Resources to Create Animation ................143
Pictures   as   Patterns   ......................................148
Converting a   Picture   to a ppat Resource Using   Pict2ppat   .....   148
The Cursor .............................................153
Chapter   Program:   QuickDrawing ..........................157
Program   Resources: QuickDrawing.rsrc ...................158
Program   Listing: ResourceUser.c .........................159
Stepping through the Code .............................164
Chapter Summary .......................................166
Chapter   4: Working with Windows   .......   .169
Windows   Primer   ........................................ 170
The WIND Resource ................................... 170
Loading a WIND ...................................... 170
The WindowRecord,   WindowPtr   and   WindowPeek   .........171
Event Handling .........................................173
Windows and Events   ....................................178
Mouse Down Events ...................................179
Single-Window Techniques   ...............................184
Activate Events .......................................185
Updating a Window ...................................185
Simple   Window Techniques .............................191
Multiple-Window Techniques .............................193
Expanding the WindowRecord ..........................   194
Activates and Multiple Windows   ........................199

Reading notes: Source appears to be a table of contents fragment with page numbers and no headline or advertised content. Leading and trailing text is cut off, so the first and last entries may be incomplete.

Languages: English

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

### PDF page 11

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-programming-techniques-1996-a8256e/1#scan-4103dc2a535b5baf545ee0d28933621da6bfa28b3b67a5670a2adcbfef276297)

Transcribed text:

Contents   xi
Updates   and Multiple   Windows   ......................... 201
Chapter Program: MultiWindows .......................... 202
Program Resources: MultiWindows.rsrc ................... 203
Program Listing: MultiWindows.c ........................ 204
Stepping Through the Code .............................214
Chapter Summary .......................................238
Chapter   5:   Dealing   with   Dialog   Boxes   ....   .241
Alerts .................................................242
Alert Resources: ALRT and DITL   ........................242
Alert Source Code .....................................244
Dialog Boxes   ...........................................246
Dialog Box Resources ....................................247
Dialog Item Types .....................................247
The   DLOG   and DITL Resources   .........................248
Working with Dialog Items ...............................255
Getting Dialog Box Item Information .....................255
Working with Edit Text Items   ...........................256
Working with Checkbox Items ...........................258
Working with Radio Button Items ........................259
Modal Dialog Boxes   ..................................... 260
The DialogRecord Data Structure ........................ 260
Modal Dialog Box Source Code ..........................262
Modeless Dialog Boxes ...................................265
Using   User   Items ........................................ 270
The   User   Item Resource ................................ 270
The   User   Item Source Code ..............................271
Chapter Program:   DialogPlus   .............................279
Program Resources:   DialogPlus.rsrc   ......................281
Program Listing:   DialogPlus.c   ...........................283

Reading notes: Source appears to be a table of contents with page numbers; no headline is printed. Some section entries contain irregular spacing from extraction.

Languages: English

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

[Next transcribed scans](https://www.vintageapple.net/transcripts/media/va-macintosh-programming-techniques-1996-a8256e/2.md)
