← SAMS Macintosh Programming Techniques 1985

SAMS Macintosh Programming Techniques 1985

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

SAMS 22411 Macintosh™ Programming Techniques David C. Willen Microsoft® BASIC 2.0

A dark red book cover with the SAMS logo at top left and a framed photograph of red apples surrounding a light bulb whose upper half is an apple sliced open with a glowing ring at its middle.

Reading notes: The number 22411 at top right is likely a catalog or stock number rather than a date; it is included only as printed. The ™ symbol after Macintosh and the ® after Microsoft are small superscripts and are transcribed as shown.

Printed product names
Microsoft BASIC 2.0
Printed dates
22411
Languages
English
PDF page 1

Macintosh™ Programming Techniques

SAMS 22411 Macintosh™ Programming Techniques David C. Willen Microsoft® BASIC 2.0

A book cover with a deep maroon background, a gold-bordered photograph of a red apple shaped like a glowing light bulb with a leaf on top and a screw base, surrounded by other red apples against a blue-tinted backdrop, with the SAMS logo at top left and the title in large white type at top right.

Reading notes: The title 'Macintosh' is followed by a superscript trademark symbol (™), transcribed as printed. The '22411' catalog number appears at top right and is in small type; its meaning is not stated on the cover.

Printed product names
Microsoft BASIC 2.0
Languages
English
PDF page 2

Macintosh™ Programming Techniques Microsoft® BASIC 2.0

A plain white title page with a thin vertical black rule on the left, and a large bold green two-line title with a smaller black subtitle beneath it, all left-aligned in the upper-middle area of the page.

Reading notes: Trademark symbols (™, ®) are transcribed as printed; the exact superscript formatting is approximate.

Printed product names
Microsoft BASIC 2.0
Languages
English
PDF page 3

Macintosh TM Programming Techniques

Macintosh TM Programming Techniques Microsoft® BASIC 2.0 David C. Willen Howard W. Sams & Co., Inc. A Subsidiary of Macmillan, Inc. 4300 West 62nd Street, Indianapolis, Indiana 46268 U.S.A.

Reading notes: Trademark symbols TM and ® are rendered inconsistently in the source text

Printed product names
Macintosh · Microsoft BASIC 2.0
Languages
English
PDF page 4

© 1985 by David C. Willen FIRST EDITION FIRST PRINTING-1985 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 publisher assumes 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-22411-9 Library of Congress Catalog Card Number: 84-51275 Printed in the United States of America Macintosh, MacPaint, MacWrite are trademarks of Apple Computer, Inc. Multiplan is a trademark of Microsoft Corp. American People/Link is a division of American Home Network, Inc. Compuserve refers to the Compuserve Information Service. Dow Jones is a trademark of Dow Jones and Company, Inc. The Source is a trademark of Source Telecomputing, Inc.

Reading notes: Copyright and printing dates are present but the Library of Congress catalog number is partly a control number rather than a date No primary heading is printed, so headline is null

Printed product names
Macintosh · MacPaint · MacWrite · Multiplan · American People/Link · Compuserve · Dow Jones · The Source
Printed dates
1985 · 84-51275
Languages
English
PDF page 5

v Contents Preface vii Acknowledgments ix Chapter 1 Introduction 1 What You Will Need-Starting up BASIC-The Three Windows- Running a Program-Maintaining Program Files-Listing Programs-Other Menu Functions-Onward Chapter 2 BASIC Program Structure 13 BASIC Statements-The Assigned Statement and Expressions- Data Types-Character String Data-Array Variables-Statement Labels-Simple Input and Output-Decision Making-Program Loops-Storing Data Within a Program-Built-In Numeric Functions-Built-In String Functions-Summary Chapter 3 Advanced Programming Structures 61 Program Structure-User-Defined Functions-Subprograms- Program Chaining-Interrupt Driven Structures-Intercepting Program Errors Chapter 4 BASIC Files 97 Types of File Access-File Access Protocols-Sequential Files- Writing Sequential Files-Reading Sequential Files- File Structure- Device Independent 1/0-Accessing the Clipboard-Accessing the Communications Port-The Check Writing Program, Version 1- Random Files-Defining Random Files-Accessing Random File Data-The LSET and RSET Statements-The Appointment Calendar Program, Version 1-File Types-The FILE$ Dialog Boxes Chapter 5 BASIC Graphics JS 9 Pixels and Graphics Coordinates-Relative Coordinates-The POINT Function-The LINE Statement-The CIRCLE Statement- Animating Graphics Images-Summary

Reading notes: OCR spacing and hyphenation irregularities in chapter titles, e.g. 'JS 9' likely 'J 9' or 'page 139' uncertain

Languages
English
PDF page 6

vi Chapter 6 The Mouse 189 The MOUSE Function-Mouse Interrupts-Controlling the Mouse Cursor Chapter 7 Graphics Revisited 21'9 Controlling the Appearance of Text-The PEN Position-Drawing with the Graphics Pen-Additional Graphics Pen Options-Setting a Background Pattern-Drawing Shapes-The SCROLL Statement- Unifying Graphics Commands with PICTURE$-Graphics Images and the Clipboard-The Appointment Calendar Program, Version 2 Chapter 8 Windows 287 The Output Window Revisited-The WINDOW Statement- Creating Custom Dialog Boxes- Interacting with Custom Dialog Boxes-Dialog Interrupts-Summary Chapter 9 Custom Pull-Down Menus 325 The MENU Statement-The MENU Function-The Menu Interrupt-The Terminal Program Revisited-The Check Writing Program Revisited-The Appointment Calendar Program, Version 3 -Summary Index 375

Reading notes: Table of contents fragment; no product names, prices, or dates are printed in the supplied copy

Languages
English
PDF page 7

vii Preface Apple's Macintosh is unique in the history of microcomputers. It is the first machine designed to be easily used by the novice. Apple achieved this by incorporating several special devices and concepts. Programs and data files are represented pictorially, and they are selected and manipulated through use of the Macintosh mouse. Apple defined standard procedures for the user to accomplish such basic computer activities as selecting data, modifying data, and invoking program functions. Because these procedures are standardized, most Macintosh applications programs can incorporate them, and anyone familiar with Macintosh operations can easily use almost any applications program on the machine. Therein lies the true power of Macintosh. Those long and unwieldy manuals, a different one for each applications program, can finally be eliminated. The Macintosh user interface, although comfortable and easy to use, represents an extra burden for software developers: it is very difficult to program with. This book is intended to help simplify that task and clear up many of the mysteries surrounding the way the Macintosh works. It discusses such Macintosh techniques as •windowing • dialog boxes • pull-down menus • using the mouse •graphics and incorporates many sample programs. This book will show you how to write Macintosh applications using Microsoft's BASIC programming language. This is an excellent language with which to begin your study of the Macintosh. The fundamental components of the language are simple to learn and use. More important, the language does a fine job of providing programming structures that allow access to the Macintosh user interface mechanisms. Thus, while learning this language, you will automatically be learning how Mac works. This book is not a reference work; it is a tutorial. I see no point in filling a book with hundreds of pages that list each BASIC keyword in alphabetical order when Microsoft's manual provides the same information in that very format. Rather, what I have done here is to separate the various features of the language by function. Thus, each chapter of this book concentrates on a different aspect of the overall language. When you read about a particular language feature, all of the

Reading notes: Source text ends mid-sentence, suggesting truncation at the page boundary.

Printed product names
Apple's Macintosh · Macintosh · Microsoft's BASIC
Languages
English
PDF page 8

viii statements and functions pertinent to that feature are also presented. This makes the book a lot easier to work with and enjoy. Once you have gained experience with the language, you can use the many tables and figures in this book for reference. You can then use the Microsoft manual to look up a specific keyword or statement alphabetically. If you are new to the BASIC language, do not panic. There is detailed information on the fundamental concepts of this popular language in Chapter 2. (The experienced BASIC programmer may want to skim over this chapter.) In Chapter 3, I cover language extensions that help give structure to your programs. Interrupt and error processing techniques are also covered here. Chapter 4 deals with various techniques for accessing data files, the serial communications port, and the Macintosh Clipboard. Chapter 5 is about graphics and focuses on those statements in Microsoft BASIC that can be used on other computers as well as the Macintosh. In Chapter 6, you will learn how to deal with the Macintosh's ubiquitous mouse. Graphics are revisited in Chapter 7, where you will discover the many powerful graphics functions that are unique to the Macintosh. Text fonts and type styles, filled graphics shapes and patterns, and line drawing techniques are all covered in this chapter. Chapter 8 is about windows and dialog boxes - how to create and use them. You will learn how to build custom dialog boxes to make your programs look just like professional Macintosh applications. Finally, Chapter 9 covers pull-down menus. Here you will learn how to add your own menus to the menu bar and how to remove existing ones. Throughout the book I have included a great many sample programs. These start out simple and get more and more complex as the book progresses. I return to many of the simpler programs in later chapters, continually refining them and making them more powerful as new language features are added. This closely follows the way programs are written by professional programmers. Such programs usually start out representing nothing more than a basic idea that might work nicely on a computer. Through continual refinement and the adding of new features, the program eventually becomes a full-fledged application useable by you or other microcomputer owners. David C. Willen

Languages
English
PDF page 9

Ix Acknowledgments I would like to thank Peter Mann for his generous and invaluable assistance during the development of this book. Thanks go also to James V. McCusker for his many Macintosh insights. Most important, I must thank the Howard W. Sams Company for their · tireless dedication to accuracy and quality. They have made this book possible.

Languages
English
PDF page 10

The image shows a plain green sheet with a thin cyan vertical line near the left edge and a faint fold or border line near the right edge, with no visible artwork or text.

Reading notes: No visible text found on the scan; transcript and printed fields are left empty. The faint vertical lines near the left and right edges may be paper folds or scanner borders rather than printed content.

PDF page 11

Chapter 1 Introduction

A chapter opener page with a green 'Chapter 1' label and a large 'Introduction' heading beside a vertical rule, above a green-and-white framed illustration of a hatched three-dimensional cube on a light surface.

Reading notes: Faint, blurred ghost text from the reverse side of the page is visible in the left and center margins but is not legible and was not transcribed.

Languages
English