# Macintosh Pascal Programming Primer 1990 — source transcripts, page 1

[Canonical transcript page](https://www.vintageapple.net/transcripts/media/va-macintosh-pascal-programming-primer-1990-0081f4/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-pascal-programming-primer-1990-0081f4/1#scan-b931f73468468dbbcbd353df570e011906d8d35b43b318fb64b05de3f429ee4b)

Macintosh Pascal Programming Primer

Transcribed text:

ddison-Wesley

Dave Mark
Cartwright Reed

Macintosh®
Pascal
Programming
Primer

Inside the Toolbox Using THINK Pascal™

Volume I

Image description: A book cover with a cream background, blue bold serif title text, and colorful geometric shapes (purple triangle, red circle, green octagon, orange and tan rectangles) behind the individual letters of the word Primer, with gray corner triangles.

Reading notes: The publisher name at top left is cropped, so it appears as 'ddison-Wesley' and is likely 'Addison-Wesley'. The word 'Primer' is set in mixed letter blocks and reads as 'Primer' in reading order. The title 'Macintosh Pascal Programming' is rendered in large display type; the letters are clear.

Printed product names: Macintosh

Languages: English

[Original Image 1](https://www.vintageapple.net/files/f2b200e95ac237cc51eb9db8b029aeb730d4ccbbb3f24dac2b4ba854c0324a6d/2e845383a377ad6dd2734f13.webp)

### PDF page 1

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-pascal-programming-primer-1990-0081f4/1#scan-4802fa7a2c8073db87cb3bf1861181032985c179f6a5288d1eda54c07fe2ccfd)

Macintosh® Pascal Programming Primer

Transcribed text:

Addison-Wesley

Dave Mark
Cartwright Reed

Macintosh® Pascal Programming

Primer

Inside the Toolbox Using THINK Pascal™

Volume I

Image description: A book cover with blue bold serif title text on a cream background, large colorful geometric shapes behind the letters of the word 'Primer' in varied colors, and gray triangular corner accents with the publisher name at top left and 'Volume I' at bottom.

Reading notes: The publisher name 'Addison-Wesley' is cropped at the left edge, so only 'ddison-Wesley' is fully visible; the leading letter is cut off. Title 'Macintosh' is followed by a registered trademark symbol ® and 'THINK Pascal' by a trademark symbol ™, transcribed as shown.

Printed product names: Macintosh

Languages: English

[Original PDF page 1](https://www.vintageapple.net/files/58d67c009ca6a2e463bea0989353deadeabce78da3c7035051be9f726857a9d0/Macintosh_Pascal_Programming_Primer_1990.pdf#page=1)

### PDF page 2

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-pascal-programming-primer-1990-0081f4/1#scan-277bc1b1614146bf55975affcf7678cb7900889287992bd8dd52b89412079626)

Macintosh® Pascal Programming Primer, Volume I

Transcribed text:

Macintosh®Pascal
Programming   Primer,
Volume I
Inside the Toolbox   Using
THINK Pascal™
Dave Mark   Cartwright Reed
• TT
Addison-Wesley Publishing Company, Inc.
Reading, Massachusetts   Menlo   Park,   California   New   York
Don Mills,   Ontario   Wokingham, England   Amsterdam   Bonn
Sydney   Singapore   Tokyo   Madrid   San   Juan

Reading notes: Transcript is intentionally empty per instructions; the exact extracted text is preserved separately. Layout and visual artwork were not verified against the image, only the supplied extracted copy. Headline is inferred from the title block in the supplied copy and may not match the printed hierarchy. Author names (Dave Mark, Cartwright Reed) and publisher imprint lines appear in the supplied copy but were not treated as advertised products. A bullet symbol (•) and a 'TT' mark appear in the supplied copy with unclear meaning. No prices or explicit publication dates appear in the supplied copy.

Printed product names: Macintosh® Pascal · THINK Pascal™

Languages: English

[Original PDF page 2](https://www.vintageapple.net/files/58d67c009ca6a2e463bea0989353deadeabce78da3c7035051be9f726857a9d0/Macintosh_Pascal_Programming_Primer_1990.pdf#page=2)

### PDF page 3

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-pascal-programming-primer-1990-0081f4/1#scan-2b4cf071b78ad7d32f852a27731f9f95964451f3099aa1814c0ead84ce7bb5b3)

Transcribed text:

Many of the designations used by manufacturers and sellers to
distinguish their products are claimed as trademarks. Where
those designations appear in this book, and Addison-Wesley
was aware of a trademark claim, the designations have been
printed in initial capital letters or all capital letters.
Library of Congress Cataloging-in-Publication Data
Mark, Dave.
Inside the Toolbox using THINK   Pascal   I   Dave Mark,
Cartwright Reed.
p. cm.-(Macintosh   Pascal   programming primer; v. 1)
Includes bibliographical references and index.
ISBN   0-201-57084-X
1.   Macintosh (Computer)--Programming. 2.   Pascal   (Com-
puter program language). 3. Macintosh Toolbox (Computer
programs). 4. Think Pascal. I. Reed, Cartwright. II. Title.
III.   Series:   Mark, Dave. Macintosh   Pascal   programming
primer; v. 1.
QA76.8.M3M3677   1990
005.265-dc20
90-20303
CIP
Copyright© 1991 by Dave Mark and Cartwright Reed
All rights reserved. No part of this publication may be
reproduced, stored in a retrieval system, or transmitted, in
any form or by any means, electronic, mechanical,
photocopying, recording, or otherwise, without the prior
written permission of Addison-Wesley. Printed in the   United
States   of America.
ABCDEFGHIJ-MW-91
First printing, December 1990

Reading notes: OCR-style ambiguity in the Library of Congress date string '005.265-dc20' Reading order of catalog data and copyright notice may be mixed

Printed product names: THINK Pascal

Printed dates: 1991 · December 1990 · 1990 · 90-20303

Languages: English

[Original PDF page 3](https://www.vintageapple.net/files/58d67c009ca6a2e463bea0989353deadeabce78da3c7035051be9f726857a9d0/Macintosh_Pascal_Programming_Primer_1990.pdf#page=3)

### PDF page 4

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-pascal-programming-primer-1990-0081f4/1#scan-2aff9ccd96260ea781092b5810364ceec76a0011fa0d74670f0df7330a8c81ff)

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

[Original PDF page 4](https://www.vintageapple.net/files/58d67c009ca6a2e463bea0989353deadeabce78da3c7035051be9f726857a9d0/Macintosh_Pascal_Programming_Primer_1990.pdf#page=4)

### PDF page 5

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-pascal-programming-primer-1990-0081f4/1#scan-d5e2e499d643cbc78fcfa0f8a956b1b0aa2a1019685beef07903fb07167ecb11)

Transcribed text:

Contents
Preface   xi
Acknowledgments   xin
1   Introduction   1
The Macintosh Vision   3
The Macintosh Interface   4
The Macintosh Toolbox   5
Resources   6
About the Book   7
What You Need to Know   8
Why We Chose THINK Pascal   8
Using   THINK Pascal   9
Inside THINK Pascal   10
Writing Macintosh Applications   11
Chapter Synopsis   12
How to   Use   This Book   20
What You Need to Get Started   21
Ready,   Set   . . .   22
2   Setting   Up   23
Installing THINK Pascal   25
Source Code Files   26
ResEdit   27
Macintosh Programming Issues   28
Accessing the Toolbox with Pascal   28
Naming Conventions   29
Predefined Data Types   29
v

Reading notes: OCR spacing irregularities in 'Acknowledgments xin' and 'Ready, Set . . .' lines may reflect damaged characters. Page number 'xin' may be an OCR error for 'xiii'.

Printed product names: THINK Pascal · ResEdit

Languages: English

[Original PDF page 5](https://www.vintageapple.net/files/58d67c009ca6a2e463bea0989353deadeabce78da3c7035051be9f726857a9d0/Macintosh_Pascal_Programming_Primer_1990.pdf#page=5)

### PDF page 6

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-pascal-programming-primer-1990-0081f4/1#scan-2d657ff7feee58a9f6128749de8426c9cde66a0a22386bbef3fc60246a3f0c28)

Transcribed text:

vi   Macintosh Programming Primer
Resources   30
Data Forks and Resource Forks   32
The Hello, World Program   33
Create a New Project   33
The Code   35
Running Hello, World   37
The Problem with Hello, World   39
In Review   39
3   Drawing on the Macintosh   41
Introduction   43
The QuickDraw Coordinate System   43
Window Management   48
Window Parts   48
Window Types   49
Setting   Up   a Window for Your Application   51
Drawing in Your Window: The QuickDraw
Toolbox Routines   54
Setting the Current Window   55
Drawing Lines   55
Drawing Shapes   56
Drawing Text   58
Drawing Pictures   59
About Regions   59
Basic MacProgram Structure   60
The QuickDraw Programs   61
Hello2   61
The Hello2 Project   64
Adding the Resource File   65
Running Hello2   66
Walking Through the Hello2 Code   66
Variants   70
Changing the Font   71
Changing Text Style   72
Changing Text Size   73
Changing the Hello2 Window   74
Mondrian   74
Resources   75
Running Mondrian   77
Walking Through the Mondrian Code   78
Variants   81
ShowPICT   86
Resources   87

Languages: English

[Original PDF page 6](https://www.vintageapple.net/files/58d67c009ca6a2e463bea0989353deadeabce78da3c7035051be9f726857a9d0/Macintosh_Pascal_Programming_Primer_1990.pdf#page=6)

### PDF page 7

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-pascal-programming-primer-1990-0081f4/1#scan-daf10120f258a719632b0f63a1c550798568ef918a85d5e6a0a5d4706fb3eb27)

Transcribed text:

Contents   vii
Running ShowPICT   90
Walking Through the ShowPICT Code   90
Variants   94
Screen Saver: The Flying Line Program   94
Running Flying Line   98
Walking Through the Flying Line Code   99
In Review   105
4   The Event Mechanism   107
Event Types   110
The Structure of a Mac Program: New and Improved   113
Retrieving Events from the Event Queue   116
Calling GetNextEvent and WaitNextEvent   117
Handling Events   119
Event'futor:   The Return of Show PICT   120
Setting   Up   the   Event'futor   Project   120
Resources   121
Running   Event'futor   129
Walking Through the   Event'futor   Code   132
Handling mouseDown Events   143
In Review   148
5   Menu Management   149
Menu Components   152
The Pull-Down Menu   154
The Hierarchical Menu   154
The   Pop-Up   Menu   155
Other   Kinds of Menus   156
Putting Menus into   Your   Programs   157
Timer   157
Setting   Up   the Project   158
Resources   158
Timer Code   171
Running Timer   178
Walking Through the Timer Code   180
Zinger   191
Walking Through the   Zinger   Code   197
In   Review   203
6   Working with Dialogs   205
How Dialogs Work   209
Modal Dialogs   210
Modeless Dialogs   210

Reading notes: Source is a table of contents excerpt with no advertised products, prices, or dates. Some OCR-like character errors appear, such as 'Event'futor' and 'Show PICT' spacing.

Languages: English

[Original PDF page 7](https://www.vintageapple.net/files/58d67c009ca6a2e463bea0989353deadeabce78da3c7035051be9f726857a9d0/Macintosh_Pascal_Programming_Primer_1990.pdf#page=7)

### PDF page 8

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-pascal-programming-primer-1990-0081f4/1#scan-47df068915d02b1ea5f686135acfe004b3cbeb71e13adb83d11a624f1b1c6c2d)

Macintosh Programming Primer

Transcribed text:

viii   Macintosh Programming   Primer
The Modal Dialog Algorithm   210
The Modeless Dialog Algorithm   211
Dialog Items: Controls   211
Buttons   212
Checkboxes   212
Radio Buttons   213
Dials   214
Other   Dialog Items   215
Working with Alerts   216
The Alert Algorithm   218
Adding Dialogs to Your Programs   218
The Notification Manager   224
Reminder   228
Setting   Up   the Project   229
Making the Resources for Reminder   229
Setting   Up   the Notification Manager Resources   234
Adding the Menu Resources   236
The Home Stretch   239
The Reminder Code   240
Running Reminder   252
Walking Through the Reminder Code   255
In Review   273
7   Toolbox Potpourri   275   277 Keeping Track of Windows: WindowMaker
WindowMaker Specifications   277
Setting up the WindowMaker Project   278
Running WindowMaker   292
Walking Through the WindowMaker Code
The   Scrap   Manager   306
Scrap   Manager Basics   306
InfoScrap   307
UnloadScrap   and LoadScrap
ZeroScrap   307
PutScrap   308
GetScrap   308
ShowClip   308
ShowClip   Specifications   309
Setting   Up   the   ShowClip   Project
Running   ShowClip   315
307
Walking Through the   ShowClip   Code
Inside the Printing and File Managers
The Standard File Package   319
309
316
319
294

Reading notes: Table-of-contents page numbers are partially run together and some entries have irregular spacing.

Languages: English

[Original PDF page 8](https://www.vintageapple.net/files/58d67c009ca6a2e463bea0989353deadeabce78da3c7035051be9f726857a9d0/Macintosh_Pascal_Programming_Primer_1990.pdf#page=8)

### PDF page 9

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-pascal-programming-primer-1990-0081f4/1#scan-93e31b4ceec40982f448fab4a6db18027462d6f9b9d1c3f7d5f141d0c842a619)

Transcribed text:

Contents
Using the File Manager
Using the Printing Manger
PrintPICT   325
322
324
PrintPICT Specifications   325
Setting   Up   PrintPICT Resources
Setting   Up   the PrintPICT Project
Changing the Compilation   Order
Running PrintPICT   332
326
328
332
Walking Through the PrintPICT Code
Scroll   Bars! We're Gonna Do   Scroll   Bars!
334
339
Making   Use   of   Scroll   Bars   339
Pager   342
Setting   Up   the Pager Project   342
Running Pager   350
Walking Through the Pager Code
The   Sound   Manager   358
Sounder   359
Setting   Up   the   Sounder   Project
Walking Through the   Sounder   Code
In Review   366
8   UsingResEdit   367
Notes on Using ResEdit   371
How ResEdit Works   372
350
359
364
ix
Completing a Stand-alone Application: Hello2 Revisited   377
Installing the Finder Resources   379
Examining the Resources of Hello2   380
Adding an Icon to Hello2   381
Rebuilding the Desktop   391
The v e r s Resource   392
Last of the Finder Resources:
The   s   I   z   E Resource   396
Minimalist, the ResEdit Program   398
In Review   401
9   The Final Chapter   403
Macintosh Periodicals   405
The Essential   Inside Macintosh   406
The Typical   Inside Mac   Chapter   406
Appendixes and   Special   Sections   407
Apple Technical References   408

Reading notes: Table-of-contents layout makes reading order and page-number associations unclear. Some page numbers are separated from their chapter titles, so mapping is uncertain.

Languages: English

[Original PDF page 9](https://www.vintageapple.net/files/58d67c009ca6a2e463bea0989353deadeabce78da3c7035051be9f726857a9d0/Macintosh_Pascal_Programming_Primer_1990.pdf#page=9)

### PDF page 10

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-pascal-programming-primer-1990-0081f4/1#scan-df903afd93eb1f2e4e7205120828dc913a32f1c88f9f07667193c0c515a67e36)

Macintosh Programming Primer

Transcribed text:

x   Macintosh Programming   Primer
Macintosh Technical Notes   408
Other Books   409
Apple's Developer Programs   409
Macintosh Developer Technical Support and AppleLink   410
Software Development Tools   411
MPW From Apple   411
Debugging with THINK Pascal, TMON, and Macsbug   412
To Boldly Go   412
Appendix A Glossary   415
Appendix B Code Listings   431
Appendix C Debugging Techniques   493
Appendix D Building Hypercard
XCMDs   499
Appendix E Bibliography   507
Index   511

Reading notes: Table of contents page numbers may be OCR-affected; reading order of entries is as supplied

Languages: English

[Original PDF page 10](https://www.vintageapple.net/files/58d67c009ca6a2e463bea0989353deadeabce78da3c7035051be9f726857a9d0/Macintosh_Pascal_Programming_Primer_1990.pdf#page=10)

### PDF page 11

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-pascal-programming-primer-1990-0081f4/1#scan-e4e70df4c2b7b0c3ea460fa588ce3f00fdefdc5bb376f24635cdce577453d5e0)

Transcribed text:

Preface
This book shows you how to write Macintosh applications with
THINK   Pascal.   We wrote it to help people to get down to the business
of writing code that displays the distinctive Mac   "feel."
The   Macintosh Pascal Programming Primer   evolved from an
earlier book that used THINK C to demonstrate the art of Mac
programming. That book,   Macintosh Programming Primer: Inside
the Toolbox Using THINK   C,   was and is quite successful, and has
received favorable reviews from   MacUser, Macworld   and other
computer publications. Many readers sent many helpful suggestions
on the C book. A common one was that we write a   Pascal   version,
and here it is.
We stress that, although the program designs for these two books
are similar, the code has been written from the ground up to take
advantage of the THINK   Pascal   environment. These programs
consist of thoroughly tested, debugged, clean   Pascal   code. We hope
that they provide an impetus for you to write your own   Pascal   Mac
applications.
If   you have THINK   Pascal   and don't yet own this book, consider
InfoWorld magazine's concluding thoughts in a review of Symantec's
Pascal   package:
"an   excellent software development environment, with authoritative
reference material at a reasonable price. All it needs is a tutorial that
explains how to use it with the Macintosh Toolbox   ...   "
...We give you the Macintosh   Pascal   Programming   Primer.
Dave Mark
Arlington,   VA
Cartwright Reed
Philadelphia, PA
xi

Reading notes: Printed page number 'xi' is the only numeric marking; no explicit publication year is printed in the supplied copy.

Printed product names: THINK Pascal · THINK C · Macintosh Pascal Programming Primer · Macintosh Programming Primer: Inside the Toolbox Using THINK C

Printed dates: xi

Languages: English

[Original PDF page 11](https://www.vintageapple.net/files/58d67c009ca6a2e463bea0989353deadeabce78da3c7035051be9f726857a9d0/Macintosh_Pascal_Programming_Primer_1990.pdf#page=11)

[Next transcribed scans](https://www.vintageapple.net/transcripts/media/va-macintosh-pascal-programming-primer-1990-0081f4/2.md)
