Dashcode User Guide
Total Page:16
File Type:pdf, Size:1020Kb
Dashcode User Guide Leopard WWDC Helvetica and Times are registered Apple Computer, Inc. trademarks of Heidelberger © 2006 Apple Computer, Inc. Druckmaschinen AG, available from All rights reserved. Linotype Library GmbH. Java and all Java-based trademarks are No part of this publication may be trademarks or registered trademarks of Sun reproduced, stored in a retrieval system, or Microsystems, Inc. in the U.S. and other transmitted, in any form or by any means, countries. mechanical, electronic, photocopying, recording, or otherwise, without prior Simultaneously published in the United written permission of Apple Computer, Inc., States and Canada. with the following exceptions: Any person Even though Apple has reviewed this document, APPLE MAKES NO WARRANTY OR is hereby authorized to store documentation REPRESENTATION, EITHER EXPRESS OR on a single computer for personal use only IMPLIED, WITH RESPECT TO THIS and to print copies of documentation for DOCUMENT, ITS QUALITY, ACCURACY, MERCHANTABILITY, OR FITNESS FOR A personal use provided that the PARTICULAR PURPOSE. AS A RESULT, THIS documentation contains Apple’s copyright DOCUMENT IS PROVIDED “AS IS,” AND YOU, THE READER, ARE ASSUMING THE notice. ENTIRE RISK AS TO ITS QUALITY AND ACCURACY. The Apple logo is a trademark of Apple IN NO EVENT WILL APPLE BE LIABLE FOR Computer, Inc. DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES Use of the “keyboard” Apple logo RESULTING FROM ANY DEFECT OR (Option-Shift-K) for commercial purposes INACCURACY IN THIS DOCUMENT, even if without the prior written consent of Apple advised of the possibility of such damages. may constitute trademark infringement and THE WARRANTY AND REMEDIES SET FORTH ABOVE ARE EXCLUSIVE AND IN unfair competition in violation of federal LIEU OF ALL OTHERS, ORAL OR WRITTEN, and state laws. EXPRESS OR IMPLIED. No Apple dealer, agent, or employee is authorized to make any No licenses, express or implied, are granted modification, extension, or addition to this with respect to any of the technology warranty. described in this document. Apple retains Some states do not allow the exclusion or limitation of implied warranties or liability for all intellectual property rights associated incidental or consequential damages, so the with the technology described in this above limitation or exclusion may not apply to you. This warranty gives you specific legal document. This document is intended to rights, and you may also have other rights which assist application developers to develop vary from state to state. applications only for Apple-labeled or Apple-licensed computers. Every effort has been made to ensure that the information in this document is accurate. Apple is not responsible for typographical errors. Apple Computer, Inc. 1 Infinite Loop Cupertino, CA 95014 408-996-1010 Apple, the Apple logo, iCal, iLife, iMovie, iPhoto, Mac, Mac OS, Monaco, Quartz, and QuickTime are trademarks of Apple Computer, Inc., registered in the United States and other countries. eMac, Finder, Photocasting, and Safari are trademarks of Apple Computer, Inc. Adobe, Acrobat, and PostScript are trademarks or registered trademarks of Adobe Systems Incorporated in the U.S. and/or other countries. Contents Introduction Introduction to Dashcode User Guide 7 Who Should Read This Document? 7 Organization of This Document 7 See Also 8 Chapter 1 Creating a Widget with Dashcode 9 Introducing Dashcode 9 Choosing a Template 11 Laying Out Your Widget 12 Authoring Source Code 14 Setting Attributes 15 Previewing the Default Image 16 Design the Widget Icon 18 Test and Share 18 Testing Your Widget 19 Sharing Your Widget 21 Chapter 2 Widget Projects 23 Creating a New Widget Project 23 The Custom Template 24 The Countdown Template 24 The RSS Template 25 The Podcast Template 25 The Photocast Template 26 The Daily Feed Template 27 The Quartz Composer Template 27 The Gauge Template 27 Importing a Widget 28 Opening a Widget 28 Viewing a Project’s Contents 29 Searching Within a Project 29 Saving a Widget Project 30 Deploying a Widget 31 3 Leopard WWDC | © 2006 Apple Computer, Inc. All Rights Reserved. CONTENTS Chapter 3 Creation Tools 33 The Navigator 33 The Canvas 35 The Library Window 35 The Inspector 37 Arranging Elements 42 Disabling the Canvas 43 The Attributes Pane 43 The Default Image Preview 44 The Widget Icon Editor 46 Chapter 4 Source Code Tools 47 Viewing and Editing Code 47 Testing and Debugging 50 The Run Log and Tracing 50 Pausing Execution 52 Breakpoints 53 The Code Evaluator 54 Appendix A Dashcode Parts Reference 55 Scroll Area 55 Gauge 56 Indicator 56 Level Indicators 56 Quartz Composer 57 QuickTime 57 Canvas 57 Appendix B Dashcode 0.9 Beta Release Notes 59 Known Issues 59 Document Revision History 61 4 Leopard WWDC | © 2006 Apple Computer, Inc. All Rights Reserved. Figures and Listings Chapter 1 Creating a Widget with Dashcode 9 Figure 1-1 A widget project in Dashcode 10 Figure 1-2 The template chooser, shown when Dashcode first opens 11 Figure 1-3 The Library window 13 Figure 1-4 The Inspector window 13 Figure 1-5 The Behaviors inspector 14 Figure 1-6 The Behaviors inspector and the source code editor 15 Figure 1-7 The attributes pane 16 Figure 1-8 The default image preview 17 Figure 1-9 Excluding an item from the Default Image using the Attributes inspector 17 Figure 1-10 The widget icon editor 18 Figure 1-11 The run log 19 Figure 1-12 The Stackframe & Variables table 20 Figure 1-13 The code evaluator 20 Chapter 2 Widget Projects 23 Figure 2-1 Properties for the Countdown template 24 Figure 2-2 Properties for the RSS template 25 Figure 2-3 Properties for the Podcast template 25 Figure 2-4 Properties for the Photocast template 26 Figure 2-5 The Daily Feed template’s properties 27 Figure 2-6 A widget opened within Dashcode 28 Figure 2-7 The Files list 29 Figure 2-8 Search results within a project window 30 Figure 2-9 The General preferences 31 Chapter 3 Creation Tools 33 Figure 3-1 The navigator 34 Figure 3-2 The canvas 35 Figure 3-3 The Library window with Parts selected 36 Figure 3-4 The Library window with Photos selected 37 Figure 3-5 The Attributes inspector 38 Figure 3-6 The Attributes inspector for a QuickTime movie 38 Figure 3-7 The Fill & Stroke inspector 39 Figure 3-8 The Metrics inspector 40 5 Leopard WWDC | © 2006 Apple Computer, Inc. All Rights Reserved. FIGURES AND LISTINGS Figure 3-9 The Text inspector 41 Figure 3-10 The Behaviors inspector 42 Figure 3-11 The attributes pane 43 Figure 3-12 The default image preview 45 Figure 3-13 The widget icon editor 46 Chapter 4 Source Code Tools 47 Figure 4-1 The source code editor 48 Figure 4-2 The General preferences 48 Figure 4-3 The Editing preferences 49 Figure 4-4 The Formatting preferences 49 Figure 4-5 The Code Sense preferences 50 Figure 4-6 The run log 51 Figure 4-7 A run log with tracing turned on 51 Figure 4-8 A paused widget in Dashcode 52 Figure 4-9 The source code editor with a breakpoint set 53 Figure 4-10 The Breakpoints window 54 Figure 4-11 The code evaluator 54 Appendix A Dashcode Parts Reference 55 Listing A-1 Changing a scroll area’s contents 55 Listing A-2 Changing a gauge’s value 56 Listing A-3 Changing an indicator’s value 56 Listing A-4 Changing a level indicator’s value 56 6 Leopard WWDC | © 2006 Apple Computer, Inc. All Rights Reserved. INTRODUCTION Introduction to Dashcode User Guide Important: This is a preliminary document for an API or technology in development. Although this document has been reviewed for technical accuracy, it is not final. Apple Computer is supplying this information to help you plan for the adoption of the technologies and programming interfaces described herein. This information is subject to change, and software implemented according to this document should be tested with final operating system software and final documentation. Newer versions of this document may be provided with future seeds of the API or technology. For information about updates to this and other developer documentation, view the New & Updated sidebars in subsequent seeds of the Reference Library. This document provides an overview of the Dashcode widget creation environment. It details how to create, test, and share a Dashboard widget using Dashcode's widget-focused feature set. Who Should Read This Document? Dashcode User Guide is for: ■ Web content creators looking to use Dashcode to provide a Dashboard widget that compliments a web site ■ Mac OS X developers using Dashcode to add a Dashboard widget as a feature for their application ■ Dashboard widget developers looking to speed up widget creation using Dashcode ■ Any casual developer interested in experimenting with widget creation It will give you an understanding of the structure and basic requirements for a widget and the techniques needed to get your widget up and running using Dashcode. Organization of This Document This document contains the following chapters: ■ “Creating a Widget with Dashcode” (page 9) shows you the major features of Dashcode and walks you through creating and testing a widget in Dashcode. Who Should Read This Document? 7 Leopard WWDC | © 2006 Apple Computer, Inc. All Rights Reserved. INTRODUCTION Introduction to Dashcode User Guide ■ “Widget Projects” (page 23) discusses different project-wide features and ways of starting a widget in Dashcode. ■ “Creation Tools” (page 33) details all of the layout-level tools provided by Dashcode, including the canvas and inspector. ■ “Source Code Tools” (page 47) details the code-level tools provided by Dashcode, including testing and debugging tools. Dashcode includes a number of custom elements, called parts, that you can use on a widget’s interface.