UPDATES AND CORRECTIONS JANUARY 2002

Similar documents
How are fonts installed?

The Matrix Mixer. Yamaha 01X and Yamaha 01V96 Digital Audio Mixing Desks. User Manual

The Window Manager defines and supports a set of standard window elements through which the user can manipulate windows:

NetMeeting 3.01 Features

AHEAD application manual

Creating Vector Shapes Week 2 Assignment 1. Illustrator Defaults

Adobe InDesign CS6 Tutorial

MDW Hi-Res Parametric EQ Plug-In Guide

Installing the driver software USB Audio Driver Installation Manual (Mac)

Check the contents of the package

Pippin Launch. version 001. Abstract: This document describes the Pippin Launch file used for multiple-application interfaces.

Editor/Plug-In Editor Manual

2.1. Project Information and Protection Global Settings Working with Tags... 15

Drag Manager Programmer s Guide

The new layer will be part of the template because we want it to appear alongside the nav bar on every page.

Creating an ArborCAD filter from Excel.

Pro Tools LE 6.0 (Macintosh OS X Only)

User's Guide Album Express 7

Livescribe Connect User Guide. Draft P-2 May 23, 2011

Motic Images Plus 3.0 ML Software. Windows OS User Manual

1. Multimedia authoring is the process of creating a multimedia production:

GIMP WEB 2.0 BUTTONS

Corel Draw 11. What is Vector Graphics?

ProVisionaire Control V1.0

This document should only be used with the Apple Macintosh version of Splosh.

Max and Graphics 1. The LCD is the main drawing environment for max. It is based on the underlying Macintosh graphic routines called QuickDraw.

How to lay out a web page with CSS

Quark: tech notes - Troubleshooting: System Failures and Unexpected Quits in QuarkXPress (Mac OS)

The viewer makes it easy to view and collaborate on virtually any file, including Microsoft Office documents, PDFs, CAD drawings, and image files.

Welcome to Mac OS X, the world s most advanced operating system. This book helps you start using Mac OS X. First install the software, then discover h

HYPERSTUDIO TOOLS. THE GRAPHIC TOOL Use this tool to select graphics to edit. SPRAY PAINT CAN Scatter lots of tiny dots with this tool.

ZOOM Ambisonics Player

Exercise 2M. Managing Session Data and Media Files - Music. Objectives

How to draw and create shapes

Step by Step How to Manual

Kidspiration 3 Basics Website:

ALL ABOUT COMPUTERS 3

SFC Visualization (V8.0 SP1) SIMATIC. Process Control System PCS 7 SFC Visualization (V8.0 SP1) What's new in SFV? 1. SFC Visualization (SFV)

Version 2.x Customers Version is a FREE update for ScreenFlow 2.x and will not require a purchase.

Digital Audio. Amplitude Analogue signal

BR-800 Rhythm Editor Manual

Adobe Photoshop Sh S.K. Sublania and Sh. Naresh Chand

2 SELECTING AND ALIGNING

AppleWorks 5 Installation Manual. Includes information about new features FOR MAC OS

Using Inspiration 7 I. How Inspiration Looks SYMBOL PALETTE

Fiery Network Controller for DocuColor 5065 SERVER & CONTROLLER SOLUTIONS. Utilities

Contents. Version 1.5 and later. Introduction Panel Descriptions Sending Still Images to the VR-4HD... 12

Using BOSS TONE STUDIO for SY-300

Installing energyxt2.5. Mac. Double-click energyxt2.5 disk image file. Drag the energyxt2.5 folder to your "Applica- tions" folder / your desktop.

ABook Reader Instruction Manual

FM 4/100 USB Software for OSX

Programming with Microsoft Visual Basic.NET. Array. What have we learnt in last lesson? What is Array?

ANSWER KEY. Chapter 1. Introduction to Computers

As you convert your QuickDraw application to one that uses only Quartz, there are two primary issues you ll face with respect to PICT data:

DinoXcope User Manual

Drawing shapes and lines

1 Getting started with Processing

WaveLab 8 WaveLab Elements 8

SampleCell Editor Addendum

Echo Digital Audio Corporation AudioFire 2 AudioFire 4 AudioFire 8 AudioFire 12 Release for Mac OS X

Using BOSS TONE STUDIO for ME-80

Generalised User Interface for Embedded Applications using an LCD screen and keypad.

The American University in Cairo. Academic Computing Services. Word prepared by. Soumaia Ahmed Al Ayyat

Apogee Quartet. QuickStart Guide

MCS3 USB Software for OSX

Adobe InDesign CS6 Tutorial

How to create a prototype

GETTING AROUND STAGE:

PLEASE NOTE THAT LECTURE NOTES ARE IN TRANSITION TO VERSION 8

utworks MidSequer Version , 04 July 2016 Documentation updated 2 October 2016 MidSequer by utworks is a 16-track MIDI sequencer for Android.

A Step-by-step guide to creating a Professional PowerPoint Presentation

The American University in Cairo. Academic Computing Services. Excel prepared by. Maha Amer

Inserting multimedia objects in Dreamweaver

Standard Toolbar. Main Toolbar. Page Sorter. Action Toolbar

Chapter 1 HMSL on the Macintosh

1. Open up PRO-DESKTOP from your programmes menu. Then click on the file menu > new> design.

Step 1: Create A New Photoshop Document

Chapter 25. Build Creations with Your Photos

Paint/Draw Tools. Foreground color. Free-form select. Select. Eraser/Color Eraser. Fill Color. Color Picker. Magnify. Pencil. Brush.

Quick Start Guide

Xcode Release Notes. Apple offers a number of resources where you can get Xcode development support:

WaveLab 8 WaveLab Elements 8

Basic Concepts. Launching MultiAd Creator. To Create an Alias. file://c:\documents and Settings\Gary Horrie\Local Settings\Temp\~hh81F9.

Laboratory 5: Collaborative Text Editing

Echo Digital Audio Corporation AudioFire 2 AudioFire 4 AudioFire 8 AudioFire 12 Release 4.6 for Mac OS X

Introduction Understanding The Basics Introducing ACID Pro 3.0 Making Music with ACID Setting Up the Hardware Installing and Registering ACID

MINI-CAD HEADER CAD VERSION 9

Computer Booklet. 1st preparatory. Computer Department. Name :.. Class :..

How to create interactive documents

OptimiData. JPEG2000 Software Development Kit for C/C++ Reference Manual. Version 1.6. from

The MVC Design Pattern

Mac OS X keyboard shortcuts Learn about common Mac OS X keyboard shortcuts.

Printer Driver. User Guide. Macintosh

Libraries. Multi-Touch. Aero Peek. Sema Foundation 10 Classes 2 nd Exam Review ICT Department 5/22/ Lesson - 15

Table of Contents. iii

4. A mail box 9) What is an embedded system? 1. A program that comes wrapped in a box 2. A program that is permanent part of a computer 3.

Figure 1: NC > 2 Axis menu > Options

MCompressor. Presets button. Left arrow button. Right arrow button. Randomize button. Save button. Panic button. Settings button

How to Construct. Accessible Talking Books MAC

AT-LP2D-USB Turntable. Software Guide

Transcription:

CARBON PROGRAMMING UPDATES AND CORRECTIONS JANUARY 2002 CONTENTS Errata First Printing 2 Demonstration Program Bug Fixes and Additions 9 1

ERRATA FIRST PRINTING If your copy of Carbon Programming is from the first printing, the following corrections are relevant. Chapter 1, Page 22 The table on this page has been corrupted. This is the version supplied by the author: Attributes Type ID Handle Preload Lock Purgeable MENU 128 123C WIND 128 NULL PICT 128 NULL PICT 129 NULL Chapter 3, Page 96 The note appearing on this page should not be there. (It is a duplication of the note appearing on page 105.) Chapter 4, Fig 4 One window (bottom right) has been deleted from Fig 4. This is the version supplied by the author: Floating window. Floating window. size box. resize control. kwindowfloatproc kwindowfloatgrowproc vertical zoom box. zoom button. vertical zoom box, size box. zoom button, resize control. kwindowfloatvertzoomproc kwindowfloatvertzoomgrowproc Floating window horizontal zoom box. zoom button. horizontal zoom box, size box. zoom button, resize control. kwindowfloathorizzoomproc kwindowfloathorizzoomgrowproc full zoom box. zoom button. Floating window full zoom box, size box. zoom button, resize control. kwindowfloatfullzoomproc kwindowfloatfullzoomgrowproc FIG 4 - WINDOW TYPES FOR FLOATING WINDOWS (TITLE BAR AT TOP) 2

Chapter 5 This figure was supplied by the author, but is missing from Chapter 5. It should have appeared at the top of page 215. struct RoutineDescriptor unsigned short gomixedmodetrap; SInt8 version; RDFlagsType routinedescriptorflags; unsigned long reserved1; UInt8 reserved2; UInt8 selectorinfo; short routinecount; RoutineRecord routinerecords[1]; ; // Mixed-mode A-Trap. // The individual routines. typedef struct RoutineDescriptor RoutineDescriptor; struct RoutineRecord ProcInfoType procinfo; // Calling conventions. SInt8 reserved1; ISAType ISA; // Instruction Set Architecture. RoutineFlagsType routineflags; ProcPtr procdescriptor; // Where is the thing we are calling? unsigned long reserved2; unsigned long selector; ; typedef struct RoutineRecord RoutineRecord; typedef RoutineRecord *RoutineRecordPtr, **RoutineRecordHandle; FIG 1 -THE ROUTINE DESCRIPTOR STRUCTURE AND A ROUTINE STRUCTURE 3

Chapter 8, Fig 2 The bottom (sheet) dialog and figure title is missing. This is the figure supplied by the author: MODAL DIALOG MOVABLE MODAL DIALOG MODELESS DIALOG WINDOW-MODAL (SHEET) DIALOG Chapter 11, Fig 7 FIG 2 - TYPES OF DIALOGS The author supplied the correct Fig 7. This was replaced in the book by a duplication of Fig 11. Here is the correct Fig 7 as supplied by the author: white black dkgray gray ltgray RECTANGLES DRAWN WITH BIT PATTERNS PRE-DEFINED AS QUICKDRAW GLOBAL VARIABLES RECTANGLES DRAWN WITH OTHER BIT PATTERNS IN THE SYTEM RESOURCE FILE FIG 7 - RECTANGLES DRAWN USING BIT PATTERNS IN THE SYSTEM RESOURCE FILE 4

Chapter 12, Fig 5 This figure has been corrupted. This is the figure as supplied by the author: POINT POINT PEN SIZE 20 BY 40 PIXELS Chapter 12, Fig 6 FIG 5 - A LINE DRAWN BY LineTo OR Line This figure has been corrupted. This is the figure as supplied by the author: RECTANGLE AS DRAWN BY FrameRect WITH 20 BY 40 GRAPHICS PEN RECTANGLE AS DEFINED BY Rect. (SHOWN FOR ILLUSTRATIVE PURPOSES ONLY.) OVAL AS DRAWN BY FrameOval WITH 30 BY 10 GRAPHICS PEN RECTANGLE AS DEFINED BY Rect. (SHOWN FOR ILLUSTRATIVE PURPOSES ONLY.) A RECTANGLE DRAWN BY FrameRect BOUNDING RECTANGLE ROUNDED RECTANGLE BOUNDING RADIUS ARC AN OVAL DRAWN BY FrameOval DIAMETER OF CURVATURE BOUNDING RADIUS BOUNDING RECTANGLE A ROUNDED RECTANGLE DRAW BY FrameRoundRect AN ARC DRAWN BY FrameArc A POLYGON DRAWN BY FramePoly FIG 6 - FRAMED SHAPES DRAWN WITH QUICKDRAW FRAMED SHAPE DRAWING FUNCTIONS Chapter 12, Fig 7 This figure has been truncated at left. This is the figure as supplied by the author: BOUNDING RADIUS WEDGE BOUNDING RECTANGLE BOUNDING RADIUS A WEDGE A PAINTED OR FILLED POLYGON A PAINTED OR FILLED REGION Chapter 18, Fig 4 FIG 7 - A WEDGE, A PAINTED OR FILLED POLYGON, AND A PAINTED OR FILLED REGION This figure has been corrupted. This is the figure as supplied by the author: 5

REQUIRED APPLE EVENTS OPEN APPLICATION RE-OPEN APPLICATION OPEN DOCUMENTS PRINT DOCUMENTS QUIT APPLICATION donewcommand Call donewdocwindow (If responding to a Re-Open Apple Event, call donewdocwindow only if no windows are currently open.) donewdocwindow Open new window. Allocate space for, and initialise, a document structure, and attach the document structure to window. dorevertcommand Get file name from front window's title. Create and display a Nav Sevices Discard Changes alert. When the user addresses the alert, if the OK button is clicked: 1. Call doreadfile to read in the file. 2. Change the window's document structure to flag the window as "not touched". doopencommand Create and display Nav Services Open dialog. If appropriate, specify the file types to display. When the user addresses the dialog, call doopenfile. doopenfile Call donewdocwindow to open new window. Set window title. Open file's data fork for read and write. Call doreadfile to read in file data. doreadfile Get file reference number. Set file mark at start. Get file length and allocate buffer. Read in the data. Display the data as appropriate. Note: On Mac OS X, when more than one document with unsaved changes is open and the user chooses the Quit command or a Quit Application Apple event is received, a Review Changes alert should be presented. doclosecommand should be called if the user clicks the Review Changes button in that alert. doclosecommand Get front window. If front window is "touched", create and display a Nav Services Save Change alert. When the user addresses the alert: 1. If the Save button is clicked, call dosavecommand, then proceed to 2. 2. If the Don't Save button is clicked, close the file, flush the volume, and release memory associated with the file's data. If the front window is not "touched", close the file, flush the volume, and release memory associated with the file's data. dowritefile Find the temporary folder on the file's volume, or create it if necessary. Create a temporary file in the temporary folder and open its data fork. Call dowritedata to write the data to the data fork of the temporary file. Close the temporary file and the existing file. Swap the data in the existing and temporary files. Delete the temporary file, re-open the existing file. Call docopyappnameresource to copy the missing application name string to the resource fork. dosavecommand Get front window. If the window has a file, call dowritefile. If the window does not have a file, call dosaveascommand. dosaveusingfsspec If the user is not replacing an existing file, create a new file, specifying creator and file type. Copy file reference number and FSSpec to window's document structure and set window's title. Open the file's data fork. Call dowritefile. dowritedata Get data address and size. Set file mark at start. Write data to file. Adjust file size. Find the volume the file is on and flush the volume. Change window's document structure to flag window as "not touched". dosaveascommand Get front window. Create and display a Nav ServicesSave Location dialog. When the user addresses the dialog, and clicks the Save Button, determine whether to save using an FSSpec or an FSRef. If saving using an FSSpec, call dosaveusingfsspec. If saving using an FSRef, call dosaveusingfref. dosaveusingfsref If the user is replacing an existing file, delete the file being replaced. Create a new file with the Unicode name, and set creator and file type. Copy FSSpec obtained on file creation to window's document structure and set window's title. Open the file's data fork. Call dowritefile. docopyappname Resource Create and open the file's resource fork. Call docopyresource, specifying the application's missing application name 'STR' resource as the resource to copy. Close the resource fork. docopyresource Set source resource file, get resource, detach resource, set destination resource file and write resource to destination. FIG 4 - GENERAL FILE MENU, QUIT ITEM, AND REQUIRED APPLE EVENTS HANDLING STRATEGY 6

Chapter 24, Fig 1, Fig 2, and Fig 3 Although referred to in the text, all supplied figures were omitted from this chapter. Here are the figures as supplied by the author: BASIC SOUND CAPABILITY BUILT-IN MICROPHONE SPEECH MANAGER INTERNAL SPEAKER SOUND INPUT MANAGER SOUND MANAGER STEREO OUTPUT JACK ENHANCED SOUND CAPABILITY EXTERNAL MICROPHONE EXTERNAL SPEAKERS HIGH QUALITY SOUND CAPABILITY digital audio data SCSI PORT DEVICE DRIVER MIDI MANAGER audio DIGITAL SOUND CARD DIGITAL SOUND COMPACT DISK MIDI CONVERTER MIDI CONVERTER MIDI (the Musical Instrument Digital Interface) is a standard protocol for sending audio data and commands to digital devices. A user can connect any MIDI devices (such as synthesizers, drum machines, or lighting controllers) to a Macintosh computer through a MIDI interface. MIDI-CONTROLLED INSTRUMENT FIG 1 - SOUND CAPABILITIES OF MACINTOSH COMPUTERS APPLICATION Expand compressed data into audio samples Convert the samples from 11 khz to 22kHz Mix the samples with any other sounds that are playing Send the mixed samples to the available audio hardware AUDIO HARDWARE SOUND MANAGER SOURCE EXPANSION COMPONENT RATE CONVERSION COMPONENT APPLE MIXER OUTPUT DEVICE COMPONENT (APPLE SOUND CHIP DRIVER) 11kHz compressed sound 'snd ' resource Decompressed audio samples 22 khz audio samples 22 khz decompressed sound FIG 2 - A TYPICAL SOUND COMPONENT CHAIN 7

General FIG 3 - SOUND RECORDING DIALOG MAC OS 8/9 In addition to the above, there are a great many words (constant, data type, and function names, etc.) in the Demonstration Program Comments sections of all chapters which should have appeared in the monospaced font. The author apologizes to purchasers for the errors in the first printing of Carbon Programming. These errors arose because the author was not availed of the opportunity to review and correct a pre-printing copy before the presses rolled. 8

DEMONSTRATION PROGRAM BUG FIXES AND ADDITIONS Demonstration Program Menus1 When a sub-menu item is chosen in the (hierarchical) Font menu, the method used to determine the item number of the menu item to which the sub-menu is attached is to walk the menu items looking for a match between the font name returned by GetFontName and each menu item's text. (See the for loop and the call to EqualString.) When a match is found, that menu item is assigned a "dash" mark. This method breaks on Mac OS X when certain Mac OS X fonts (e.g., American TypeWriter) are chosen. The reason for this is that, in the case of certain Mac OS X fonts, the menu item text does not necessarily equate to the font name returned by GetFontName. The consequence of this is that the "dash" mark will not be drawn against the relevant item. The following replacement for the dofontmenu function finds the menu item by walking the menu items and comparing the menu reference obtained at the first line of the dofontmenu function with the menu reference of each item's sub-menu, as obtained by the call to GetMenuItemHierarchicalMenu. When a match is found, that menu item is assigned the "dash" mark. void dofontmenu(menuid menuid,menuitemindex menuitem) MenuRef menuref, fontmenuref, submenuref; OSStatus oserror; FMFontFamily fontfamily; FMFontStyle fontstyle; Str255 fontname, stylename; SInt16 a, numberoffontmenuitems; menuref = GetMenuRef(menuID); oserror = GetFontFamilyFromMenuSelection(menuRef,menuItem,&fontFamily,&fontStyle); if(oserror == noerr) TextFont(fontFamily); TextFace(fontStyle); if(menuid == mfont) CheckMenuItem(menuRef,gCurrentFontMenuItem,false); gcurrentfontmenuitem = menuitem; CheckMenuItem(menuRef,gCurrentFontMenuItem,true); if(gcurrentfontsubmenuref!= NULL) CheckMenuItem(gCurrentFontSubMenuRef,gCurrentFontSubMenuItem,false); GetMenuItemText(menuRef,menuItem,fontName); drawitemstring(fontname); else if(gcurrentfontsubmenuref!= NULL) CheckMenuItem(gCurrentFontSubMenuRef,gCurrentFontSubMenuItem,false); gcurrentfontsubmenuref = menuref; gcurrentfontsubmenuitem = menuitem; CheckMenuItem(gCurrentFontSubMenuRef,gCurrentFontSubMenuItem,true); fontmenuref = GetMenuRef(mFont); CheckMenuItem(fontMenuRef,gCurrentFontMenuItem,false); 9

numberoffontmenuitems = CountMenuItems(fontMenuRef); for(a=1;a<=numberoffontmenuitems;a++) GetMenuItemHierarchicalMenu(fontMenuRef,a,&subMenuRef); //// MAIN CHANGE if(submenuref == menuref) gcurrentfontmenuitem = a; break; SetItemMark(fontMenuRef,gCurrentFontMenuItem,'-'); GetMenuItemText(fontMenuRef,a,fontName); drawitemstring(fontname); GetMenuItemText(menuRef,menuItem,styleName); DrawString("\p "); DrawString(styleName); else ExitToShell(); Demonstration Program PreQuickDraw On Mac OS X 10.0 and later, if "Set Pixel Depth 8 (256 Colours)" is chosen from the Demonstration menu, subsequent choices of the other menu items in the Demonstration menu will not change the pixel depth. Accordingly: Add this global variable: Boolean grunningonx = false; In the main function, add the indicated lines to disable the "Set Pixel Depth 8 (256 Colours)" menu item if the program is running on Mac OS X: Gestalt(gestaltMenuMgrAttr,&response); if(response & gestaltmenumgraqualayoutmask) menuref = GetMenuRef(mFile); if(menuref!= NULL) DeleteMenuItem(menuRef,iQuit); DeleteMenuItem(menuRef,iQuit - 1); DisableMenuItem(menuRef,0); menunuref = GetMenuRef(mDemonstration); DisableMenuItem(menuRef,iSetDepth8); grunningonx = true; On Mac OS X 10.0 and later, this section in the function dodisplayinformation is irrelevant and should be deleted: MoveTo(10,320); DrawString("\pOn Mac OS X, drag window after pixel depth and screen resolution changes to"); DrawString("\p ensure that"); MoveTo(10,333); DrawString("\pbytes per row, pixel image bytes, and colour values are updated."); 10

On Mac OS X 10.0 and later, the color table aspects of the demonstration are not relevant. Accordingly, add the indicated lines to this section in the function dodisplayinformation: // if any entries in colour table, draw the colours MoveTo(250,20); DrawString("\pColour table:"); entries = (*colortablehdl)->ctsize; if(grunningonx) MoveTo(290,130); DrawString("\pNot relevant on Mac OS X"); else if(entries < 2) MoveTo(260,100); DrawString("\pOnly one (dummy) entry in the colour"); MoveTo(260,115); DrawString("\ptable. To cause the colour table to be"); MoveTo(260,130); DrawString("\pbuilt, set the monitor to bit depth 8"); MoveTo(260,145); DrawString("\p(256 colours), causing it to act like "); MoveTo(260,160); DrawString("\pan indexed device."); Demonstration Program Files (Carbon Events Version) To avoid potential crashes on Mac OS X, the function dosynchronisefiles should not be called during the application quitting sequence. Accordingly, in the source code file Files.c, in the function doidle, add the indicated line: void doidle(void) if(getwindowkind(frontwindow()) == kapplicationwindowkind) if(!gquittingapplication) dosynchronisefiles(); Aqua Human Interface Guidelines state that all windows should come forward when the Review Changes button in a Review Changes alert is clicked. Accordingly, in the source code file Files.c, in the function quitappeventhandler, add this local variable: ProcessSerialNumber processserialnumber; and also add the indicated lines: // if more than one touched window, create Review Changes alert, handle button clicks else if(touchedwindowscount > 1) itemhit = doreviewchangesalert(touchedwindowscount); if(itemhit == kalertstdalertokbutton) GetFrontProcess(&processSerialNumber); SetFrontProcess(&processSerialNumber); gquittingapplication = true; 11

On Mac OS 8/9 only, when the "Choose a Folder Dialog" item is chosen in the Demonstration menu, a folder is selected and the Choose button in the dialog is clicked, the folder name, volume reference number and parent directory ID are not drawn in the frontmost window. Accordingly, in the source code file ChooseAFolderDialog.c: Add this global variable: extern Boolean grunningonx; In the function dochooseafolderdialog, add the indicated lines: if(oserror == noerr) if(grunningonx) if((oserror = GetSheetWindowParent(FrontWindow(),&parentWindowRef)) == noerr) windowref = parentwindowref; else windowref = FrontWindow(); else windowref = FrontWindow(); GetIndString(message,rMiscStrings,sChooseAFolder); Demonstration Program Files (Classic Events Version) On Mac OS X, the application will crash during the quitting application sequence when Save Changes sheets are present. To eliminate this, prevent the function dosynchronisefiles from being called when the quitting application sequence is in progress. In the source code file Files.c, in the function eventloop, add the indicated lines: while(!gdone) if(waitnextevent(everyevent,&eventstructure,180,null)) doevents(&eventstructure); else if(!gquittingapplication) dosynchronisefiles(); if(grunningonx && gquittingapplication) On Mac OS 8/9 only, when the "Choose a Folder Dialog" item is chosen in the Demonstration menu, a folder is chosen and the Choose button in the dialog is clicked, the folder name, volume reference number, and parent directory ID are not drawn in the frontmost window. Accordingly, in the source code file ChooseAFolderDialog.c, make the same changes indicated for the Carbon Events version of this demonstration program (see above). 12

Demonstration Program DateTimeNumbers (Carbon Events Version) Two mouse clicks, rather than one, are required to change the active edit text control. Accordingly, in the function windoweventhandler, add the indicated line: case keventclassmouse: ConvertEventRefToEventRecord(eventRef,&eventRecord); switch(eventkind) case keventmousedown: if(isdialogevent(&eventrecord)) if(dialogselect(&eventrecord,&gdialogref,&itemhit)) if(itemhit == ibuttonenter) doacceptnewrecord(); doclearallfields(); else if(itemhit == ibuttonclear) doclearallfields(); // event class mouse result = noerr; doadjustcursor(getdialogwindow(gdialogref)); break; break; Demonstration Program Lists (Carbon Events and Classic Events Versions) When these programs are compiled using CodeWarrior Pro 7 (but, curiously, not Pro 6), the custom list definition function is never called, as a result of which the icons fail to display in the list that utilises the custom list definition function. In the source code file WindowList.c, in the function docreateiconlist, add the indicated line: listrect.right = listrect.right - kscrollbarwidth; listdefspec.deftype = klistdefprocptr; listdefspec.u.userproc = listdefinitionfunctionupp; Demonstration Program Miscellany (Carbon Events and Classic Events Versions) Mac OS X 10.1 supports help tags for menu items. Accordingly, to assign help tags to the items in the Demonstration menu: Add these five strings to the existing strings in the 'STR#' resource with ID 129: Notification demonstration Determinate progress indicator demonstration Colour Picker demonstration Multiple monitors drawing demonstration Help tags demonstration In the header file Miscellany.h, add this function prototype: void dohelptagmenu (void); In the source code file Miscellany.c, in the function main, add this line after the call to the function dohelptagwindow: dohelptagmenu(); 13

Add this function at the bottom of the source code file HelpTag.c: // dohelptagmenu void dohelptagmenu(void) Rect hotrect; HMHelpContentRec helpcontent; MenuRef menuref; memset(&helpcontent,0,sizeof(helpcontent)); HMSetTagDelay(500); helpcontent.version = kmachelpversion; helpcontent.tagside = khmoutsiderightcenteraligned; menuref = GetMenuRef(mDemonstration); helpcontent.content[khmminimumcontentindex].contenttype = khmstringrescontent; helpcontent.content[khmminimumcontentindex].u.tagstringres.hmmresid = 129; helpcontent.content[khmminimumcontentindex].u.tagstringres.hmmindex = 5; HMSetMenuItemHelpContent(menuRef,1,&helpContent); helpcontent.content[khmminimumcontentindex].u.tagstringres.hmmindex = 6; HMSetMenuItemHelpContent(menuRef,2,&helpContent); helpcontent.content[khmminimumcontentindex].u.tagstringres.hmmindex = 7; HMSetMenuItemHelpContent(menuRef,3,&helpContent); helpcontent.content[khmminimumcontentindex].u.tagstringres.hmmindex = 8; HMSetMenuItemHelpContent(menuRef,4,&helpContent); helpcontent.content[khmminimumcontentindex].u.tagstringres.hmmindex = 9; HMSetMenuItemHelpContent(menuRef,5,&helpContent); 14