← Macintosh Revealed, Volume Two: Programming with the Toolbox, Second Edition

Macintosh Revealed, Volume Two: Programming with the Toolbox, Second Edition

From the originals

13 scans

Machine-transcribed text and image descriptions. Check the linked original for uncertain words or fine print.

These are transcribed pages from the documents, not the full publications. Open the original for the remaining pages.

Image 1

HAYDEN Macintosh Library BOOKS 048401 Macintosh™ Revealed Programming with the Toolbox Volume Two • Second Edition Updated for the Macintosh Plus™ and Macintosh SE™ Stephen Chernicoff

A book cover with a blue gradient background, an orange wavy line on each side, and a framed central image of geometric solids such as pyramids and cubes set in a stone archway against a blue sky.

Reading notes: The number 048401 near the top right is small and may be a catalog code rather than a date; it was included in the transcript as printed. Cover text reads in a top-to-bottom order: publisher line, title, subtitle, volume line, update note, author name.

Languages
English
PDF page 1

HAYDEN Macintosh Library BOOKS 048401 Macintosh™ Revealed Programming with the Toolbox Volume Two • Second Edition Updated for the Macintosh Plus™ and Macintosh SE™ Stephen Chernicoff

A book cover with a blue gradient background, orange wavy lines on each side, and a central framed image of geometric solids such as pyramids and cubes inside an arched architectural window against a blue sky.

Reading notes: The number 048401 near the top right is a catalog or series number, not clearly a date; it is listed under printedDates only as printed. Reading order of the top banner is inferred from left to right: HAYDEN, Macintosh Library (script), BOOKS, then the number.

Printed product names
Macintosh
Printed dates
048401
Languages
English
PDF page 2

Macintosh™ Revealed Volume Two: Programming with the Toolbox

A plain cream-colored title page with the bold serif title 'Macintosh™ Revealed' above three horizontal rules and a subtitle 'Volume Two: Programming with the Toolbox', with faint, washed-out text ghosting through the background below.

Reading notes: Faint ghosted text and bleed-through from the reverse side of the page below the title block are not legible and were not transcribed. The trademark symbol after Macintosh is rendered as superscript TM and was transcribed as ™.

Languages
English
PDF page 3

Macintosh Revealed

HAYDEN Macintosh® Revealed Volume One: Unlocking the Toolbox Second Edition Stephen Chernicoff Volume Two: Programming with the Toolbox Second Edition Stephen Chernicoff Volume Three: Mastering the Toolbox (forthcoming) Stephen Chernicoff Volume Four: Programming the Macintosh® II (forthcoming) Stephen Chernicoff and Geri Younggren How to Write Macintosh® Software Second Edition Scott Knaster MacAccess: Information in Motion Dean Gengle and Steven Smith Personal Publishing w ith the Macintosh® (Version 2.0) Second Edition Terry M. Ulick BOOKS MPW and Assembly Language Programming Scott Kronick The Macintosh® Advisor (Updated for Multifinder) Cynthia Harriman and Bencion Calica Object-Oriented Programming for the Macintosh® Kurt J. Schmucker dBASE® Mac Programmer's Reference Guide Edward C. Jones HyperTalk TM Programming (Version 1.2), Revised Edition Dan Shafer HyperTalk •M Tips and Techniq·ies (forthcoming) Dan Shafer The Waite Group's HyperTalk •M Bible The Waite Group IBM® PC and Macintosh® Networking: Featuring TOPS and AppleShare •M Steue Michel Macintosh® Hard Disk Management Charles Rubin.and Bencion J. Calica For the retailer nearest you, or to order directly from the publisher, call 8()()..428-SAMS. In Indiana, Alaska, and Hawaii call 317-298-5699.

Reading notes: Some characters in the catalog listing are garbled, including 'Techniq·ies' and 'HyperTalk •M', and the author name 'Steue Michel' may be a misreading. The reading order of the book listings is uncertain because the catalog columns are interleaved in the source text.

Printed product names
Macintosh · Macintosh II · TOPS · AppleShare · dBASE Mac · HyperTalk · IBM PC · Multifinder
Languages
English
PDF page 4

Macintosh™ Revealed

Macintosh™ Revealed Volume Two: Programming with the Toolbox Second Edition Stephen Chernicoff HAYDEN BOOKS A Division of Macmillan Computer Publishing 11711 North College. Carmel. Indiana 46032 U SA

Reading notes: Printed title and publisher text appear in reading order from the supplied copy; no image was provided.

Printed product names
Macintosh™
Languages
English
PDF page 5

For Ann, who likes the one with the mouse. c 1955 and 1987 by Hayden Books A Division of SAMS. SECOND EDITION FOURTH PRINTING - 1991 All rights reserved. No part of this book shall be reproduced, stored in a retrieval system, or transmitted by any means, electronic, mechanical, photocopying, recording, or otherwise, without written permission from the publisher. No patent liability is assumed with respect to the use of the information contained herein. While every precaution has been taken in the preparation of this book, the author and publisher assume no responsibility for errors or omissions. Neither is any liability assumed for damages resulting from the use of the information contained herein. International Standard Book Number: 0-672-48401·3 Library of Congress Catalog Card Number: 87·60909 Acquisitions Editor: Michael McGrath Macintosh Library Cover Design: Jim Bernard Cover Art: Celeste Design Index: Ted Lau/( Composition: Shepard Poorman Communications Corp., Indianapolis Printed in the United States of America Trademark Acknowledgments All terms mentioned in this book that are known to be trademarks or service marks are listed below. In addition, terms suspected of being trademarks or service marks have been appropriately capitalized. Hayden Books cannot attest to the accuracy of this information. Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark. AppleTalk, LaserWriter, and Lisa are registered trademarks of Apple Computer Inc. ImageWriter, ImageWrite II, Macintosh, MacPaint, MacWrite, and MacWorks are trademarks of Apple Computer Inc. Turbo Pascal is a registered trademark of Borland International. LightSpeed Pascal is a trademark of THINK Technology.

Reading notes: Dedication line 'who likes the one with the mouse' is printed but may not be a heading. Printed dates 'c 1955' and '1987' appear in copyright line; date for first edition may be ambiguous.

Printed product names
AppleTalk · LaserWriter · Lisa · ImageWriter · ImageWrite II · Macintosh · MacPaint · MacWrite · MacWorks · Turbo Pascal · LightSpeed Pascal
Printed dates
1955 · 1987 · 1991
Languages
English
PDF page 6

Preface If you're reading this book, you probably don't need to be told that Apple Computer's Macintosh is an extraordinary personal computer. It does things you may never have seen a computer do before, in ways you'd never even imagined. If you've wondered what goes on behind the scenes to make the magic happen, this book is for you. By the time you've finished it, the inner workings of the Macintosh will stand revealed before your eyes, and you'll be able to use its built-in User Interface Toolbox to perform the same magic in your own programs. One thing must be said, however, right at the outset: the Tool- box is for experienced programmers, not beginners. To get the most out of this book, you should have some previous experience (the more the better) in at least one high-level programming language. The programming examples given here are written in Pascal, but the general principles they embody are applicable in other languages as well. If Pascal isn't your native programming tongue, you should at least be able to pick up enough of it to follow the logic of the programming examples and apply them in your own preferred lan- guage. The book will offer a few hints to help you over the rough spots, but in general it's assumed that you're already acquainted with the syntax and semantics of standard Pascal. (For hard-core bit bangers, there's also information on how to use the Toolbox in as- sembly language.) The only other assumption is that you want to know how the Macintosh user interface works from the inside. Whether you're a professional software developer, a college student, a midnight hacker, or just the kind of person who likes to take watches apart and see what makes them tick, read on and behold the Macintosh revealed. STEPHEN CHERNlCOFF Berkeley 1 California v

Reading notes: Source text contains a possible OCR artifact 'lCOFF' in the author name and 'Berkeley 1' in the location line.

Printed product names
Apple Computer's Macintosh · Macintosh · Toolbox · User Interface Toolbox
Languages
English
PDF page 7

Acknowledgments No book is ever the product of one person working alone- especially a book of the size and complexity of this one. These are some of the people who have helped me bring the book to comple- tion, and to whom I owe a special debt of gratitude and appreciation: First and forever, to my wife, Helen, whose love and under- standing through the ordeal of living with an author have brought new meaning to the word "patience"; and to my parents, Murray and Annette Chernicoff, for their unwavering encouragement and support. To Chris Espinosa and Mike Murray, who, as my managers at Apple, graciously afforded me the freedom to pursue this project as an independent agent. To Mike McGrath, Ronnie Groff, Mary Picklum, and Nancy Ragle of Hayden Book Company, professionals all in the noblest sense of the word, whose contributions were manifold and invaluable. To Don Herrington, Jennifer Ackley, and Wendy Ford of Howard W. Sams & Co., for their aid in preparing the second edition. To David Casseres of Apple Computer, for his indispensable assistance with the programming examples and his wise and thought· I ful counsel throughout. To Scott Knaster of Apple Computer, for his thorough techni- cal review of the manuscript and his inexhaustible patience with my questions, intelligent and otherwise. To Steven Smith of CommuniTree Group, who executed the illustrations with imagination and panache. And finally, to the men and women of Apple Computer's Macin- tosh Division, as talented and creative a group of people as I have ever been privileged to work with; and to Steven Jobs, erstwhile chairman of the board of Apple Computer and general manager of the Macintosh Division, who provided the vision and inspiration for these remarkable people to bring Macintosh to reality. vi

Reading notes: Possible OCR artifacts in the separator character '·' within 'thought· I ful' and the broken word 'comple-tion' at a line break.

Printed product names
Macintosh · Macintosh Division
Languages
English
PDF page 8

Chapter 1 Chapter 2 Contents All the Tools You Need How This Book Is Organized How to Use This Book What's in the Reference Sections Some Terms and Conventions Keeping Up with Events The Event Queue The System Clock Living with Desk Accessories Event Types Keyboard Events Event Records Event Masks Event Reporting Intercepted Events Responding to Events Posting and Removing Events Reading the Mouse and Keyboard Curs or Display Nuts and Bolts Reference 2.1 Internal Representation of Events 2.1.1 Event Records 2.1.2 Event Types 2.1.3 Event Masks 2.1.4 Event Messages 2.1.5 Event Modifiers 2.2 Event Reporting 2.2.1 Retr ieving Eve nts 2.3 Posting and Removing Events vii 1 2 4 5 8 11 13 14 15 17 18 18 19 20 21 23 27 29 31 35 37 37 37 39 41 42 44 45 45 47

Reading notes: Chapter heading is spaced irregularly in the source text ("Chapter 2" appears after "Chapter 1"), so the primary heading is uncertain. Several words contain stray spacing (e.g., "Retr ieving Eve nts", "Curs or Display"), which may reflect OCR damage.

Languages
English
PDF page 9

Chapter 3 viii Contents 2.3.1 Emptying the Event Queue 2.3.2 Posting Events 2.4 The Mouse 2.4.1. Reading the Mouse Position 2.4.2 Reading the Mouse Button 2.5 The Cursor 2.5.1 Cursor Records 2.5.2 Setting the Cursor 2.5.3 Showing and Hiding the Cursor 2.5.4 Obscuring and Shielding the Cursor 2.6 The Keyboard 2.6.1 Reading the Keyboard 2. 7 The System Clock 2.7.1 Reading the System Clock 2.7.2 Performing Periodic Tasks 2.8 The Speaker 2.8.1 Beeping the Speaker 2.9 Event-Related Resources 2.9.1 Resource Type 'CURS' 2.9.2 Resource Type 'FKEY' Windows on the World Window Fundamentals Anatomy of a Window Window Records Creating and Destroying Windows Window Types and Definition Functions Window Events Activate and Deactivate Events Update Events Responding to the Mouse Nuts and Bolts Reference 3.1 Internal Representation of Windows 3.1.1 Window Records 3.2 Creating and Destroying Windows 3.2.1 Initializing the Toolbox for Windows 3.2.2 Creating Windows 3.2.3 Destroying Windows 3.2.4 Setting Window Properties 3.3 Window Display 3.3.1 Showing and Hiding Windows 3.3.2 Moving and Sizing Windows 47 48 50 50 51 52 52 54 56 57 58 58 60 60 61 62 62 63 63 64 67 67 69 79 83 90 92 92 95 100 109 112 112 112 116 116 117 120 121 122 122 124

Reading notes: Table-of-contents page numbers appear as a run of unlabeled numerals whose alignment to entries is uncertain

Languages
English
PDF page 10

Chapter 4 ix Contents 3.3.3 Front -to-Back Ordering 3.3.4 Window Highlighting 3.4 Updating Windows 3.4.1 Update Processing 3.4.2 Manipulating the Update Region 3.4.3 Window Pictures 3.5 Responding to the Mouse 3.5.1 Locating Mouse Clicks 3.5.2 Window Selection 3.5.3 Click in a System Window 3.5.4 Tracking the Mouse 3 .6 Nuts and Bolts 3.6.1 Nuts and Bolts 3.7 Window-Related Resources 3.7.1 Resource Type 'WIND' What's on the Menu? Anatomy of a Menu Menu Records Building Menus Listing Resources on a Menu Menus as Resources Choosing from a Menu Controlling Menu Items Text of an Item Character Style Enabling and Disabling Items Marking Items Item Icons Reference 4.1 Internal Re presentation of Menus 4.1.1 Menu Records 4.2 Creating and Destroying Menus 4.2.1 Initializing the Toolbox for Menus 4.2.2 Creating Menus 4.2.3 Destroying Menus 4 .3 Buildihg Menus 4.3.1 Adding Menu Items 4.3.2 Modifier Characters 4.3.3 Adding Resource Names to a Menu 4.3.4 Deleting Menu Items 4.3.5 Counting Menu Items 4.4 Building the Menu Bar 126 127 128 128 129 130 132 132 133 134 135 137 137 139 139 141 141 144 146 151 153 155 165 165 166 166 167 169 170 170 170 173 173 174 175 176 176 177 178 180 181 182

Reading notes: Table of contents page numbers appear as a bare column of figures with unclear alignment to entries Some section numbers contain stray spacing (e.g., '3 .6', '4 .3') that may be typesetting artifacts

Languages
English
PDF page 11

Chapter 5 X Contents 4.4.1 Adding and Removing Menus 4.4.Z Reading Menu Bars as Resources 4.4.3 Drawing the Menu Bar 4.4.4 Changing Menu Bars 4.4.5 Getting Menus from the Menu Bar 4.5 Responding to the Mouse and Keyboard 4.5.1 Choosing Menu Items 4.5.Z Opening and Closing Desk Accessories 4.5.3 Editing in Desk Accessories 4.5.4 Highlighting Menu Titles 4.6 Controlling Menu Items 4.6.1 Text of an Item 4.6.Z Enabling and Disabling Items 4.6.3 Character Style of Menu Items 4.6.4 Marking Items 4.6.5 Item Icons 4. 7 Nuts and Bolts 4.7.1 Menu Dimensions 4.7.Z Flashing Menu Items 4.8 Menu-Related Resources 4.8.1 Resource Type 'MENU' 4.8.Z Resource Type 'MBAR' Scissors and Paste Edit Records Destination and View Rectangles Line Starts Preparation for Editing Text Display Text Selection Tracking the Mouse Selection Display Keyboard Input Cutting and Pasting Access to the Scrap Nuts and Bolts Search and Replace Automatic Scrolling Word-Break Routines Customized Text Selection Reference 5.1 The Editing Environment 5.1.1 Edit Records 182 183 184 185 186 187 187 189 190 191 192 192 193 195 196 198 200 200 201 202 202 203 205 205 206 209 211 216 219 220 223 224 226 229 236 236 236 237 238 239 240 240

Reading notes: Source text is a table of contents with page numbers, not an advertisement; no headline, products, prices, or dates are present. Some characters in the section numbering appear to be OCR errors (e.g., 'Z' in place of '2', '4. 7' spacing).

Languages
English