# Mastering the Think Class Library 1995 — source transcripts, page 1

[Canonical transcript page](https://www.vintageapple.net/transcripts/media/va-mastering-the-think-class-library-1995-e58ee8/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-mastering-the-think-class-library-1995-e58ee8/1#scan-ca5fd079a76634f1233867693db615b2e7b5a8aaca86ebf89d5dacd3ebfc61f8)

mastering the THINK class library

Transcribed text:

mastering
the
THINK
class
library
using SYMANTEC C++™
and VISUAL ARCHITECT™
Richard O. Parker

Image description: A sepia-toned photograph of an incandescent light bulb fills the background, with large white serif title text over it and the word THINK rendered in large multicolored striped letters across the middle.

Reading notes: Trademark symbols ™ after SYMANTEC C++ and VISUAL ARCHITECT are small and may be partly obscured; transcribed as shown. The word THINK uses multicolored striped lettering that is stylized but legible.

Printed product names: SYMANTEC C++ · THINK class library

Languages: English

[Original Image 1](https://www.vintageapple.net/files/2b8b0ac01896738c24b01bc8f1d4cb253ff272d0bdf8022e7809349fd20b788a/75198afccc1fbbb75c779a6f.webp)

### PDF page 1

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-mastering-the-think-class-library-1995-e58ee8/1#scan-afa60cef8ec4801434e35908edc887464d8dcb491a8b2c5f35d16b4156da6fa1)

Transcribed text:

mastering the THINK class library

using SYMANTEC C++™
and VISUAL ARCHITECT™

Richard O. Parker

Image description: A sepia-toned book cover showing a photograph of a light bulb with the large word THINK in multicolored striped letters across the middle, with the title and author name in white and black serif type.

Reading notes: Headline is split across several lines with the word THINK in larger, colorful letters; reading order follows the visual top-to-bottom sequence. Trademark symbols (™) after SYMANTEC C++ and VISUAL ARCHITECT are small and included as printed.

Printed product names: SYMANTEC C++ · THINK class library

Languages: English

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

### PDF page 2

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-mastering-the-think-class-library-1995-e58ee8/1#scan-7ce5338f68680239d7ae8b14e2b51a823d97657c5be9bdd98ce6d7d47dc2d240)

Transcribed text:

Mastering the THINK Class Library
Using   Symantec C++   ™   and Visual   Architect™
Richard   0.   Parker
.. 'Y'Y
Addison-Wesley Publishing Company
Reading, Massachusetts   •   Menlo   Park,   California   •   New York
Don Mills, Ontario   •   Wokingham, England   •   Amsterdam
Bonn   •   Sydney   •   Singapore   •   Tokyo   •   Madrid   •   San Juan
Paris   •   Seoul   •   Milan   •   Mexico City   •   Taipei

Reading notes: No image was supplied, so the fields were filled from the provided extracted copy only. The line '.. 'Y'Y' near the author name appears to be a stray mark or OCR artifact and was not treated as text. The copy is a book title page rather than an advertisement, so no advertised products, prices, or dates were identified. Product-like names 'Symantec C++' and 'Visual Architect' appear only in the subtitle and were not listed as advertised products.

Languages: English

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

### PDF page 3

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-mastering-the-think-class-library-1995-e58ee8/1#scan-59e4df3e86454a1ef2771831dda06720650c08826b17c13bdd0ff61efa41f8ef)

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.
The author and publishers have taken care in preparation of this book, but make no
expressed or implied warranty of any kind and assume no responsibility for errors or
omissions. No liability is assumed for incidental or consequential damages in
connection with or arising out of the information or programs contained herein.
Library of Congress Cataloging-in-Publication Data
Parker,   Richard   0.
Mastering the THINK Class Library :   Using   Symantec C++ and
Visual Architect   I   Richard   0.   Parker.
p.   cm.
Includes index.
ISBN 0-201-48356-4 (alk. paper)
1. Symantec C++ for the Macintosh.
-Programming.   I.   Tide.
QA76.73.C153P39   1995
005.26'2-dc20
2.   Macintosh (Computer)-
Copyright© 1995 by Addison-Wesley   Publishing   Company
95-218
CIP
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 the publisher.   Printed   in the   United   States of   America.   Published
simultaneously in Canada.
Sponsoring Editor: Martha Steffen
Project   Manager: Sarah Weaver
Production   Coordinator: Deborah McKenna
Cover design: David High
Set in 11 point Adobe Garamond by   Pure   Imaging
1 2 3 4 5 6 7 8 9-MA-9998979695
First printing, July 1995
Addison-Wesley books are available for bulk purchases by corporations, institutions,
and other organizations. For more information please contact the Corporate,
Government, and Special Sales Department at   (800)   238-9682.

Reading notes: Library of Congress Cataloging-in-Publication data contains OCR-style spacing and split tokens such as 'Parker,   Richard   0.' that may need verification Subject heading line '2. Macintosh (Computer)-' and '-Programming.' appear split across lines, so reading order is uncertain

Printed product names: Symantec C++ · Visual Architect · THINK Class Library · Symantec C++ for the Macintosh

Printed dates: 1995 · July 1995 · 95-218 · 005.26'2-dc20 · QA76.73.C153P39

Languages: English

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

### PDF page 4

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-mastering-the-think-class-library-1995-e58ee8/1#scan-4a330ddc4b5abb8ce03f803d3c9c73bbac13e468a03a783229cea23ab6b84b84)

Transcribed text:

This book is dedicated to my extended family, and especially to my
mother, my son Rick, my daughter Kathryn, her husband Jerry,
and my grandchildren Shannon, Aaron, and Emily.
My sister Marianne, her husband Terry, her son Dafydd,
and their son Chris are always close to my heart.
My family is more important to me than any of them imagines.
May they always give more than they get and love
one another-that's what makes life worthwhile.

Languages: English

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

### PDF page 5

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-mastering-the-think-class-library-1995-e58ee8/1#scan-01f938b03c9ffbf24e0ecab4d78d4b8804b77386d3df76981bc276cead0e43b7)

Transcribed text:

Contents
Preface ......................................................................................................................................   xvii
Notation   Used   in This Book ............................................................................ xx
Acknowledgments ............................................................................................ xx
Chapter 1
Introduction to the TCL   ............................................................................................................. 1
Looking More Deeply into the TCL .................................................................. 2
Basic Structure of the TCL ....................................................................... 3
Defining the   Visual   Hierarchy .................................................................. 4
Defining the Chain of Command   ............................................................. 5
More About Commands   ........................................................................... 7
Using   the   Visual   Architect   .................................................................................. 8
Chapter Summary ...........................................................................................   10
Chapter 2
Building the Application's Foundation   .................................................................................... 11
Creating the Skeleton Application .................................................................... 11
Examining the Skeleton Application Code ....................................................... 14
Starting in the Main Function ................................................................ 16
Constructing the CApp Object   ............................................................... 17
CCollaborator Construction, 17
CBureaucrat Construction, 18
CDirectorOwner Construction, 18
CApplication Construction, 19
X_CApp and CApp Construction, 22
Initializing the Application Object   .......................................................... 22
Initializing CApp, 22
Initializing CApplication, 23
Making the Application Helpers ............................................................. 26
Loading Important Resources, 26
v

Reading notes: Source is a table of contents excerpt with page-number leaders; no advertising copy present.

Languages: English

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

### PDF page 6

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-mastering-the-think-class-library-1995-e58ee8/1#scan-d317b22fd953475b2448223bcad8ab2d3d06618a90b05360e937e0d34a6ccc2f)

Transcribed text:

vi   >-   Contents
Chapter 3
Creating the CSwitchboard Object, 27
Creating the CError Object, 28
Creating the CDesktop Object, 28
Creating the CClipboard Object, 29
Creating the CDecorator Object, 32
Setting the File   Parameters,   33
Forcing Class References, 33
Setting   Up   the Application's Menus, 35
Running the Application .................................................................................. 37
Processing   Events ...................................................................................   40
Customizing the Application Skeleton ............................................................. 41
Examining the Application's Initialization Code   ..................................... 41
Modifying the Apple Event-Handling Code ........................................... 42
Existing Handlers, 42
Handling New Events, 43
Other   Application Services ............................................................................... 46
Chapter Summary   ............................................................................................ 47
Creating and Managing Documents .........   ...............................................................................   .49
Creating the Default Document and Its Window ............................................ 49
Creating the Document with an   Open   Application Event ...................... 57
Managing the Document's Data ...................................................................... 58
Handling a Single File Type ................................................................... 59
Handling Multiple File Types ................................................................ 63
Opening a Document, 65
Creating a New Document, 68
Creating a File Type Dialog, 69
Generating the Dialog Code, 73
Adding the DoNewDialog Code, 74
Modifying the GetDocTypeFromDialog Code, 75
Modifying the CNewFile Dialog Code, 76
Performing   Simple Text File Input and   Output   ............................................... 78
Creating a CTextEdit   Panorama   in the   NewView   Window .................... 79
Examining the x_CNewView Header File Changes ................................ 81
Examining the x_CNewView Source File Changes ................................. 82
Examining the CTextData Header File   ................................................... 83
Examining the CTextData Source File ................................................... 83
CTextData.cp Beginning Declarations, 84
CTextData OpenFile Function Code, 84
CTextData ReadData Function Code, 86
CTextData DoSave Function Code, 87
CTextData WriteData Function Code, 88

Reading notes: Source is a table of contents; no headline, product names, prices, or dates are printed in the supplied copy. Page numbers listed after entries are not dates and are not extracted.

Languages: English

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

### PDF page 7

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-mastering-the-think-class-library-1995-e58ee8/1#scan-d34bb4548ba1492076715528d54bbcaefd4d1fa5245c4a2c55b2457d39c21512)

Transcribed text:

Chapter4
CTextData DoSaveAs Function Code, 89
CTextData DoRevert Function Code, 91
CTextData   Position Window Function Code, 92
CTextData ContentsToWindow Function Code, 92
CTextData WindowToContents Function Code, 93
CTextData MakeWindowName Function Code, 93
Contents   vii
Examining the CNewView Source File Changes .............................................. 94
CNewView ICNewView Function Code, 94
CNewView ContentsToWindow Function Code, 94
CNewView WindowToContents Function Code, 95
CApp ICApp Function Code Addition, 95
CApp MakeNewWindow Override Suggestion, 98
Multiple Documents Versus Multiple Views .................................................... 98
Application Document Summary   ......................................................................   99
Creating and Displaying Views .........................................................................................   ......   101
Creating a Business Account View .................................................................   101
Creating the Main View .......................................................................   102
Creating the Account View   ...................................................................   105
Adding an Account Menu .................................................................... 113
Creating a New Account Dialog ........................................................... 113
Adding Menu Commands to the Account Menu   .................................. 115
Generating Code and Viewing the Results ............................................ 117
Examining the Generated Code in x_CMain.............   ..   ... ...................... 119
MakeNewWindow Function Code, 119
DoCommand Function Code,   120
DoCmdNewAcct Function Code,   120
DoCmdEditAcct Function Code, 121
DoCmdDeleteAcct Function Code, 121
UpdateMenus   Function Code, 122
What About the Rest of the Generated Code? ...................................... 122
Making the Business View Fully Functional ......................................... 123
Examining the Custom Code in the CApp Class .................................. 124
Adding a New Instance Variable, 124
Newly Added Initialization Features, 125
Examining Custom Code in the CMain Class ...................................... 125
CMain Header File Additions, 126
ICMain Function Code, 126
MakeNewWindow Override Function Code, 127
DoCommand Override Function Code, 127
DoCmdNewAcct Override Function Code, 128
DoCmdEditAcct Override Function Code, 129

Languages: English

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

### PDF page 8

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-mastering-the-think-class-library-1995-e58ee8/1#scan-fcdb7beef12fb6376f659317d30ff7be967be7b64411bc4f6796efc5198e0e23)

Transcribed text:

viii   :>-   Contents
DoCmdDeleteAcct Override Function Code, 131
MakeDefau!tSettings Function Code, 133
ProviderChanged Override Function Code, 133
Examining the Custom Code in the CMainList Class .......................... 135
GetCellText Function Code, 135
Examining Newly Added CTransaction Class Code ............................. 135
CTransaction Class Header File, 135
CTransaction Class Source Code, 137
Examining Custom Code in the CAccount Class ................................. 139
CAccount Class Header File, 139
Preprocessor   and Compiler Directives, 141
ICAccount Member Function Code, 141
CloseWind Override Function Code, 142
CreateNewEntries Function Code, 142
Examining Custom Code in the CAcctList Class .................................. 144
CAcctList Header File Contents, 144
Global List Border Array, 144
DrawCell Override Function Source Code, 145
Recommended Tasks For Completing The Business Account View ..... 146
Creating a Splash Screen View .......................................................................   150
Creating the Splash View   ......................................................................   150
Examining the Splash View Code ......................................................... 152
MakeNewWindow Function Code, 152
ShowSplashScreen   Function Code, 153
Creating a Floating   Palette   View .................................................................... 154
Creating the View   ................................................................................. 154
Creating the   PICT   Image for the   Palette   .............................................. 156
Creating the   PICT   Grid Resource ........................................................ 157
Examining the Floating   Palette   View Code   ........................................... 158
SetUpMenus   Function Code, 159
CWidgets Constructor Function Code, 159
MakeNewWindow Function Code,   160
CMain MakeNewWindow Override Function Code, 161
CMain Activate Override Function Code, 161
CMain Deactivate Override Function Code, 161
CWidgets DoCommand Function Code, 162
Creating a Tear-off Menu View ..................................................................... 163
Creating the Tear-off View ................................................................... 163
Examining the Tear-off View's Code .................................................... 167
SetUpMenus   Function Code, 168
CTools Constructor Function Code, 168
A View Summary ........................................................................................... 169

Reading notes: Source appears to be a table of contents with the word 'Contents' as the only heading; no primary headline was identified. The OCR-like text contains a stray character in 'MakeDefau!tSettings', preserved as printed.

Languages: English

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

### PDF page 9

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-mastering-the-think-class-library-1995-e58ee8/1#scan-fd33c1fa7d7b4bb54ee43c99afa75ff0a691c2ad6f0fedf95477332685f3086b)

Transcribed text:

Contents   ix
Chapter 5
Creating and Managing Dialogs   ............................................................................................. 171
Creating a Text Style Modal Dialog ............................................................... 171
Creating the Main and Notebook   Views   ........................................................ 172
Creating The CFontList and CSizeList Classes, 173
Creating the Font and Size Lists, 174
Creating the Style Checkboxes, 175
Creating the Justification Radio Buttons, 175
Creating the CDialogText Fields, 175
Creating the   OK   and Cancel Buttons, 175
Creating the Labels, 176
Creating the Format Menu ................................................................... 176
Generating and Running the Skeleton Code   ......................................... 177
Examining the Custom CApp Code ..................................................... 179
SetUpMenus Function Code, 179
Examining the Custom CMain Code ................................................... 179
Defining the CTextSettings Structure, 179
The CMain Header File Contents,   180
ICMain Initialization Function Code, 181
DoCommand Function Code, 182
DoCmdNotebook Override Function Code, 182
Initializing the Dialog, 183
ExchangeSettings Function Code, 183
Examining the Notebook Dialog Code   ................................................. 184
Ix_CNotebook Function Code, 184
MakeNewWindow Function Code, 185
DoBeginData Function Code, 187
BeginData Function Code, 189
DrawSample Function Code, 192
DispensePaneValues   Function Code, 193
Examining the Code for Running the Notebook Dialog   ....................... 195
DoModalDialog Function Code, 196
x_CNotebook ProviderChanged Function Code, 198
CNotebookUpdate Structure Definition,   200
UpdateData Function Code,   201
Examining the Code to Dismiss the Notebook Dialog .........................   203
EndDialog Function Code,   203
DoEndData Function Code,   205
EndData Function Code,   205
Update   Function Code,   207
Creating a Category Editor Dialog .................................................................   208
Creating the Dialog   Views   ....................................................................   208
Examining the CMain Code   ................................................................. 216
CMain.h Header File Contents, 217

Reading notes: Table-of-contents page numbers are partly ambiguous due to OCR-style line breaks.

Languages: English

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

### PDF page 10

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-mastering-the-think-class-library-1995-e58ee8/1#scan-6b8a7b1a64bd27f44d7dbe895eae966d15405866e564590565948d8c531410e0)

Transcribed text:

x   :>-Contents
Chapter6
ICMain Function Code, 218
AddCategory Function Code, 218
De!Category Function Code, 219
GetCategory Function Code, 219
SetCategory Function Code,   220
SorrCat   Function Code,   220
SetSelected   Category Function Code, 221
DoCmdEditCategories Function Code, 222
Examining the CCategories Code ......................................................... 223
The x_   CCategories Class Header File, 223
Ix_CCategories Function Code, 225
MakeNewWindow Function Code, 226
The CCategories Class Header File, 227
ICCategories Function Code, 228
BeginData Function Code, 229
DisableButtons Function Code,   230
CmdUseCat Function Code,   230
CmdDeleteCat Function Code,   230
CmdNewCat Function Code, 231
DoCmdEditCat Function Code, 233
ExchangeSettings Function Code, 234
Examining the CNewCat Dialog Code   ................................................. 234
BeginData Function Code, 234
EndData Function Code, 236
CNewCat Header File Additions, 236
Examining the CCatTable Class Code   .................................................. 237
Examining the CCat Class Code .......................................................... 237
CCat Class Header File, 238
CCat Constructor Function Code, 238
PutTo   and GetFrom Function Code, 239
CCat Class Access Function Code, 239
Creating a Dynamic Modeless Dialog ............................................................ 241
Examining the x_CMain Code ............................................................. 245
Examining the CSettings Code ............................................................. 246
MakeNewWindow Override Function Code, 247
ProviderChanged Function Code, 248
Modal and Modeless Dialog Summary   ...........................................................   250
Creating and Managing Controls   ...........................................................................................   253
So   What   Is   a Semantic Event? ........................................................................ 253
Learning About Buttons .................................................................................   260
Examining the CButton Class .............................................................. 261

Reading notes: Source appears to be a table of contents with page numbers; dot leaders and some OCR spacing irregularities make certain entries uncertain (e.g., 'x_CCategories', 'Ix_CCategories', 'SorrCat'). Entries such as 'ICMain Function Code' and 'De!Category' may contain OCR-damaged characters.

Languages: English

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

### PDF page 11

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-mastering-the-think-class-library-1995-e58ee8/1#scan-043c0542a27d17b4ab98bf62e95974112f6690c2587519810d42f4bc1c1b5160)

Transcribed text:

Chapter?
Button   Properties,   261
Button Actions, 265
Contents   xi
Examining the CRadioControl Class .................................................... 267
Radio Button Properties, 268
Radio Button Actions, 269
Examining the CCheckBox Class ......................................................... 271
CCheckBox Properties, 271
CCheckBox Actions, 271
Learning About   Pop-Up   Menus ..................................................................... 272
Pop-up   Menu Properties, 273
Pop-up   Menu Actions, 275
Learning About Tables ................................................................................... 277
Table   Properties,   278
Table Actions, 285
Learning About Text ...................................................................................... 289
Text   Properties,   290
Text Actions, 292
Control   Object   Summary   ............................................................................... 294
Handling Events   ......................................................................................................................   295
Examining the Main Event Loop ................................................................... 295
The   Process   Event Function's Role ....................................................... 297
The Doldle Function's Role ................................................................. 297
The DispatchEvent Function's Role ..................................................... 299
Handling Mouse Down Events, 299
Handling Mouse   Up   Events, 299
Handling Key Events,   300
Handling Disk Inserted Events,   301
Handling   Update   Events,   301
Handling Activate and Deactivate Events,   305
Handling Suspend and Resume Events,   309
Handling High-Level Events,   309
More About Mouse Down Events ........................................................   310
Handling inDesk Clicks, 311
Handling inMenuBar Clicks, 311
Handling inSysWindow Clicks, 312
Handling inContent Clicks, 312
Handling inDrag Clicks, 315
Handling inGrow Clicks, 316
Handling inGoAway Clicks, 321
Handling inZoomln and   inZoomOut   Clicks, 323
Summary Event   Processing   ............................................................................ 325

Reading notes: Source appears to be a table of contents; no headline or advertised products identified. Some entries contain stray characters such as the leading 'Chapter?' and 'Contents xi' which may be OCR artifacts.

Languages: English

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

[Next transcribed scans](https://www.vintageapple.net/transcripts/media/va-mastering-the-think-class-library-1995-e58ee8/2.md)
