← Macintosh C Programming Primer 1992

Macintosh C Programming Primer 1992

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

Macintosh C Programming PRIMER

Dave Mark Cartwright Reed Macintosh C Programming PRIMER Volume I Second Edition Inside the Toolbox Using THINK C™

A book cover with a blue top band holding author names, a red background, large black title text, and the word PRIMER set in rotated multicolored tiles above the volume and edition lines.

Reading notes: Volume numeral reads as 'I' in the printed copy; 'Second Edition' is not a date or year, so it is listed only as printed edition text in printedDates.

Printed product names
Macintosh C Programming PRIMER
Printed dates
Second Edition
Languages
English
PDF page 1

Macintosh C Programming PRIMER

Dave Mark Cartwright Reed Macintosh C Programming PRIMER Volume I Second Edition Inside the Toolbox Using THINK C™

A red book cover with a blue band at the top holding the author names, large black title text, and the word PRIMER spelled in colorful tilted squares (orange, blue, pink, purple, teal, yellow), with volume and edition text and a subtitle at the bottom.

Reading notes: Printed date field lists 'Second Edition' rather than a numeric year; no numeric date is visible.

Printed product names
Macintosh C Programming PRIMER
Printed dates
Second Edition
Languages
English
PDF page 2

Macintosh C Programming Primer

Macintosh C Programming Primer Inside the Toolbox Using THINK CTM Volume I, Second Edition Dave Mark Cartwright Reed ... •• 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: Headline taken from the first lines of the supplied copy and may not match the printed layout. No image was inspected, so visual layout and reading order are unverified. The supplied copy lists no advertised products, prices, or dates; 'Second Edition' and 'Volume I' are edition labels, not printed dates. The publisher's city list and the '...' line are extracted fragments that may be incomplete.

Languages
English
PDF page 3

Macintosh C Programming Primer

The authors and publisher 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 use of the information or programs contained herein. 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. Library of Congress Cataloging-in-Publication Data Mark, Dave. Macintosh C programming primer I Dave Mark, Cartwright Reed. - 2nd ed. p. cm. Includes bibliographical references and index. Contents: v. 1. Inside the toolbox using THINK C. ISBN 0-201-60838-3 (v. 1) 1. Macintosh (Computer)-Programming. 2. C (Computer program language) I. Reed, Cartwright. II. Title. QA76.8.M3M368 1992 005.265-dc20 Copyright © 1992 by Dave Mark and Cartwright Reed 92-4299 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. Cover Concept: Doliber/Skeffington Set in 10/12 Palatino by ST Associates, Wakefield, MA 123456789-MW-9695949392 First printing, May 1992

Reading notes: Catalog data line 'QA76.8.M3M368 1992' and 'dc20' may be OCR-garbled Headline taken from title-page text 'Macintosh C programming primer' inferred from cataloging record

Printed product names
Macintosh · THINK C · Palatino
Printed dates
1992 · May 1992
Languages
English
PDF page 4

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

PDF page 5

Contents Source Code Disk for the Mac Primer ix Preface xi Acknowledgments xiii 1 Introduction 1 The Macintosh Way 3 About the Book 8 Writing Macintosh Applications 11 How to Use This Book 19 What You Need to Get Started 20 Ready,Set... 21 2 Setting Up 23 Installing THINK C 5 25 Accessing the Toolbox with C The Hello, World Program In Review 48 29 40 3 Drawing on the Macintosh 49 Introduction 51 Window Management 56 Drawing in Your Window: The QuickDraw Toolbox Routines 62 The QuickDraw Programs 69 Hello2 69 v

Reading notes: Source text is a table of contents with page numbers; no advertised products, prices, or dates are present.

Languages
English
PDF page 6

vi Macintosh C Programming Primer Walking Through the Hello2 Code 79 Variants 83 Mondrian 88 Walking Through the Mondrian Code 92 Variants 98 Show PICT 103 Walking Through the Show PICT Code 109 Variants 113 Screen Saver: The FlyingLine Program 113 Walking Through the FlyingLine Code 119 In Review 126 4 Events 127 Understanding Events 129 The Event Manager 129 A New Structure for Macintosh Programming (Part 1) 133 A New Structure for Macintosh Programming (Part 2) 139 EventTracker 143 Walking Through the EventTracker Code 154 Handling mouseDown Events in EventTracker 165 Building the EventTracker Application 167 Updater: The Return ofShowPICT 168 Walking Through the Updater Code 177 Handling mouseDown Events in Updater 184 EventTrigger: Sending Apple Events 190 The Event Trigger Algorithm 192 Walking Through the EventTrigger Code 196 In Review 199 5 Menu Management 201 Menu Components 203 The Hierarchical Menu 206 The Pop-up Menu 206 Adding Menus to Your Programs 208 WorldClock 209 Walking Through the WorldClock Code 235 In Review 258 6 Working with Dialogs 259 How Dialogs Work 262 Dialog Items: Controls 263 Other Dialog Items 266 Modal Dialogs 267 Modeless Dialogs 267

Reading notes: Source is a table of contents; no headline, products, prices, or dates are printed. Heading 'Macintosh C Programming Primer' is a book title, not an advertisement headline.

Languages
English
PDF page 7

Contents Adding Dialogs to Your Programs 268 Working with Alerts 275 The Notification Manager 278 Using the Notification Manager 279 The Process Manager 281 Reminder 284 Resources 285 Running Reminder 328 Walking Through the Reminder Code In Review 361 7 Toolbox Potpourri 363 Writing Out Resources 365 ResWriter 365 Walking Through the ResWriter Code Scroll Bars! We're Gonna Do Scroll Bars! Pager 382 Walking Through the Pager Code 393 The Scrap Manager 404 Walking Through the ShowClip Code The Sound Manager 416 SoundMaker 416 Walking Through the SoundMaker Code Working with Macintosh Files 424 The Standard File Package 425 The File Manager 427 Walking Through the OpenPICT Code The Printing Manager 443 PrintPICT 444 Walking Through the PrintPICT Code In Review 456 8 Finishing Touches 457 335 373 379 411 420 436 450 Building a Standalone Application 459 More Finder Resources 471 The Help and Edition Managers 478 Responding to the Required Apple Events 480 In Review 489 9 The Final Chapter 491 Macintosh Periodicals 493 The Essential Inside Macintosh 493 Apple Technical References 496 Apple's Developer Programs 497 vii

Reading notes: Contents listing has page numbers displaced from their entries, so chapter-to-page pairing is uncertain.

Languages
English
PDF page 8

viii Macintosh C Programming Primer Macintosh Developer Technical Support and Applelink 498 Software Development Tools 499 Source Code Bounty 501 To Boldly Go 502 Appendix A Glossary 503 Appendix B Code Listings 521 Appendix C THINK C Command Summary 603 Appendix D The Debugger Command Summary 615 Appendix E Debugging Techniques 623 Appendix F Building HyperCard XCMDs 629 Appendix G Bibliography 639 Appendix H New Inside Macintosh Series 643 Index 647

Reading notes: Table of contents format makes page numbers and section boundaries ambiguous

Printed product names
THINK C · HyperCard · Applelink · Macintosh
Languages
English
PDF page 9

Source Code Disk for the Mac C Primer IF YOU WOULD like the source code presented in the Macintosh C Programming Primer on disk, please send in the coupon on the last page (or a copy of the coupon; we're not picky). If you like, you can order the disk by calling (215) 387-6002. We hope you like the Macintosh C Programming Primer. If you have any comments or suggestions drop us a line on CompuServe. When you log on to CompuServe, type GOMACDEV, then stop by the Learn Programming area (Section 11) and say hello. ix

Printed product names
Macintosh C Programming Primer
Languages
English
PDF page 10

Preface ARE YOU INTERESTED in creating your very own Macintosh applications? Is the next great Macintosh software miracle tucked away in your brain? If so, you've come to the right place. With this new edition of the Macintosh C Programming Primer in hand and a copy of THINK C on your hard drive, you've got everything you need to enter the wonderful world of Macintosh programming. The Mac Primer uses step-by-step approach that shows you how to add each element of the Macintosh user interface to your programs. You'll start by learning how Macintosh windows are created. Next, you'll learn how to draw text and graphics inside your windows. As you progress through the book, you'll learn about events, menus, dialog boxes, and much, much more. The Mac Primer is chock-full of reusable sample code. Each program is discussed in detail. Nothing is left as an exercise for the reader. There's no better way to learn the art of Macintosh programming. For readers of the first edition, this edition of the Mac Primer pre- sents a boatload of brand-new material. All the source code has been rewritten and specifically designed with System 7 in mind. You'll learn how to create System 7-savvy programs using the latest versions of THINK C and ResEdit. You'll also get the inside scoop on the new additions to the Inside Macintosh family. Get yourself a copy of THINK C, grab your Mac Primer, and we'll meet you inside. Dave Mark Arlington, VA Cartwright Reed Philadelphia, PA xi

Printed product names
THINK C · ResEdit · Inside Macintosh · Macintosh C Programming Primer · Mac Primer
Languages
English
PDF page 11

Acknowledgments WE'D LIKE TO express our appreciation to the people who helped make this book possible, or at least coexisted with us harmoniously during its development. First and foremost, we'd like to thank our wives, Deneen Melander and Kate Joyce, who know us and still smile. A special thanks to Elizabeth Rogalin and Julie Stillman for loyalty, late nights, and much-needed moral support. Thanks also to Kathy Traynor, Diane Freed, and the rest of Addison-Wesley's finest! Thanks also to Jackie Cowlishaw, copyeditor extraordinaire. A special note of thanks to Andy Richter of Intelligence At Large. Andy was a critical factor in making the code both clean and exciting. Thanks, Andy! Thanks to Jim Reekes, Richard Clark, and Phil Shapiro for much- needed technical support. These guys kept us from going down for the compatibility count. Finally, thanks to Apple and Symantec, whose products are the finest in the land. xiii

Languages
English