palm os programming

569 1.5K 0
palm os programming

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

www.it-ebooks.info 201 West 103rd Street, Indianapolis, Indiana 46290 Palm OS Programming Glenn Bachmann 00 413x fm 10/2/02 4:10 PM Page i www.it-ebooks.info Palm OS Programming Copyright  2003 by Sams Publishing 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. Although every precaution has been taken in the prepara- tion of this book, the publisher and author assume no responsibil- ity for errors or omissions. Nor is any liability assumed for damages resulting from the use of the information contained herein. International Standard Book Number: 0-672-32413-X Library of Congress Catalog Card Number: 2002100932 Printed in the United States of America First Printing: October 2002 05 04 03 02 4 3 21 Trademarks All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized. Sams Publishing 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. Warning and Disclaimer Every effort has been made to make this book as complete and as accurate as possible, but no warranty or fitness is implied. The information provided is on an “as is” basis. The authors and the publisher shall have neither liability nor responsibility to any person or entity with respect to any loss or damages arising from the information contained in this book. Associate Publisher Michael Stephens Acquisitions Editor Michelle Newcomb Development Editor Mark Renfrow Managing Editor Charlotte Clapp Project Editor Matthew Purcell Copy Editor Kezia Endsley Indexer Larry Sweazy Proofreader Abby Vanhuss Suzanne Thomas Technical Editor Jeff Pajor Team Coordinator Lynne Williams Interior Designer Gary Adair Cover Designer Alan Clements Page Layout Michelle Mitchell Graphics Steve Adams Tammy Graham Oliver Jackson Laura Robbins 00 413x fm 10/2/02 4:10 PM Page ii www.it-ebooks.info Contents at a Glance Introduction 1 Part I Getting Started with Palm Programming 5 1 Introduction to Palm Programming and CodeWarrior 7 2 Anatomy of a Palm Application 17 3 Rapid Development Using POSE, the Palm OS Emulator 43 4 Debugging Techniques for Palm Applications 55 5 Creating and Managing Resources 67 Part II Programming the Palm User Interface 75 6 Interacting with the User: Forms 77 7 Form Elements 97 8 Button Controls 103 9 Labels and Fields 121 10 Giving the Users a Choice: Lists and Pop-up Triggers 131 11 Tables 153 12 Menus 177 13 Drawing Graphics 193 14 Handling Pen Events 213 15 Adding Color to Palm Applications 225 Part III Memory, Databases, and Files 237 16 Palm OS Memory Management 239 17 Understanding Palm OS Databases 245 18 Palm Databases and Record Management 255 19 Categories 273 20 Expansion Memory Cards and the Virtual File System 299 Part IV Communications 329 21 Serial Communications 331 22 Infrared Communications: OBEX and Exchange Manager 349 23 Using the Infrared Library 365 00 413x fm 10/2/02 4:10 PM Page iii www.it-ebooks.info 24 A Survey of Wireless Options for Palm Developers 377 25 Palm.NET and Web Clipping 387 26 Using TCP/IP and Net.lib 403 Part V Advanced Topics 423 27 Overview of Conduits 425 28 Programming Palm OS Conduits 431 29 Shared Libraries: Extending the Palm OS 461 30 Other Advanced Project Types: Multi-Segment and Static Libraries 481 31 Saving Program State: Application Preferences 489 32 Palm OS 5 and ARM: Looking into the Future 495 Index 503 00 413x fm 10/2/02 4:10 PM Page iv www.it-ebooks.info Table of Contents Introduction 1 Part I Getting Started with Palm Programming 5 1 Introduction to Palm Programming and CodeWarrior 7 The Palm Computing Platform 9 What Is a Palm Application? 10 How Are Palm Applications Written? 11 CodeWarrior and Development Tool Choices 12 PRC-Tools 12 Falch.net 13 AppForge 13 NS Basic 13 Satellite Forms 13 What Tool Is Best for You? 13 Tools Used in This Book 14 The Palm SDK 15 Summary 15 2 Anatomy of a Palm Application 17 PilotMain and the Smallest Palm Program Ever 17 Launch Codes 18 Checking the Palm OS Version 19 The Main Form 21 Events 22 The Main Form Handler 25 Hello Palm! 26 The Source Code 27 Creating a CodeWarrior Project for “Hello Palm” 37 Creating a GCC Project for “Hello Palm” 39 Building and Running “Hello Palm” 40 Summary 41 00 413x fm 10/2/02 4:10 PM Page v www.it-ebooks.info 3 Rapid Development Using POSE, the Palm OS Emulator 43 Where to Get POSE 44 ROM Images 44 Where to Get ROMs 45 The Different Kinds of ROMs 46 Skins 46 Creating, Loading, and Saving POSE Sessions 47 Installing Applications and Databases 49 Taking Screenshots 49 Creating a Bound Copy of POSE 50 Advanced POSE Techniques 50 POSE Warnings and Error Messages 51 Logging 51 Profiling 52 TCP/IP and Serial Communications Support 52 Gremlins 52 The OS 5 Simulator 53 Summary 54 4 Debugging Techniques for Palm Applications 55 Why Palm Debugging Is Different 56 Defensive Programming 56 Effective Debugging Techniques for the Palm 57 The Palm Error Manager 57 FrmCustomAlert 58 Logging 59 The CodeWarrior Debugger 60 A Debugging Session 60 Setting Breakpoints 61 Stepping Through Code 62 Debugging to a Palm Device 62 Other Debugging Tools 63 Using Gremlins to Find Problems 63 Summary 64 5 Creating and Managing Resources 67 What Is a Palm Resource? 68 Why Use Constructor? 68 Why Use PilRC? 68 Palm OS Programmingvi 00 413x fm 10/2/02 4:10 PM Page vi www.it-ebooks.info Creating a Resource Project File 69 Creating Resources in Constructor 69 What’s a Resource Fork? 70 Version-Control Considerations in Constructor 71 A Constructor Example: “Hello Palm” Revisited 71 A PilRC Example: “Hello Palm” Revisited 72 Summary 74 Part II Programming the Palm User Interface 75 6 Interacting with the User: Forms 77 The Palm User Interface 78 What Is a Form? 79 Examples of Forms in the Built-in Palm Applications 79 Programming with Forms 80 Alerts 81 Custom Forms 86 Using Forms to Capture User Input 90 More Complex Forms: Event Handlers 92 Summary 95 7 Form Elements 97 What Kinds of Form Elements Are Available? 98 Buttons 98 Input Fields 99 Labels 99 Lists 99 Triggers 100 Tables 101 Custom Gadgets 101 Summary 102 8 Button Controls 103 What Is a Control Object? 103 Types of Control Objects 104 What Is a Button? 105 Types of Buttons 105 Guidelines for the Use of Buttons 107 General Guidelines on Buttons 108 Contents vii 00 413x fm 10/2/02 4:10 PM Page vii www.it-ebooks.info Using Buttons in Your Application 108 A Simple Survey Application 108 Grouped Push Buttons 109 Repeating Buttons and the Arrow Increment 109 Initializing the Form 118 Trapping Control Events 119 Summary 120 9 Labels and Fields 121 Form Labels 122 Input Fields 122 Using Constructor to Create Labels and Fields 123 Using Labels and Fields in Your Application 125 Just What the Doctor Ordered 126 Summary 130 10 Giving the Users a Choice: Lists and Pop-up Triggers 131 Lists in the Palm Environment 132 Examples of Lists in Action on the Palm 132 Pop-up Lists 132 Guidelines for Using Lists in an Application 133 Creating List Resources 133 Usable 134 Visible Items 134 List Items 134 Creating Pop-up List Resources 135 Adding List and Pop-up List Handling to Your Application 136 More Complex Handling—Drawing Your Own List 137 More Complex Handling—Trapping List Events 138 Pop-up List Handling 138 A Shopping List Revisited 138 Summary 151 11 Tables 153 What Is a Table? 153 Table Functionality 154 When to Use Tables Instead of Lists 154 Adding Tables to Your Program 155 Table Initialization 156 Table View Management 157 00 413x fm 10/2/02 4:10 PM Page viii www.it-ebooks.info Table Data Mapping 159 Table Drawing 161 Putting It All Together: FishTable 164 Tables and Databases 175 Summary 176 12 Menus 177 What Is a Menu? 178 Menus in Action on the Palm 178 Menu Nomenclature 179 Guidelines for Menu Usage 180 Using Constructor to Create Menus 181 Handling Menu Events in Your Application 183 Summary 191 13 Drawing Graphics 193 The Palm Display 193 Screen Sizes 194 Color and Grayscale 194 Palm OS Graphics Primitives 195 Lines 195 Fill Patterns 196 Rectangles 196 Drawing Text 197 Bitmaps 197 The Palm OS Window Model 197 What Is a Window? 197 Creating a Window 198 Multiple Windows 199 PalmDraw: A Graphics-Drawing Demonstration Program 199 Setting Up for Multiple Windows 207 The Line-Drawing and Rectangle-Drawing Windows 208 The Text-Drawing Window 209 The Bitmap-Drawing Window 210 Summary 211 14 Handling Pen Events 213 What Is a Pen Event? 214 How Pen Events and Control Events Coexist 214 Pen Events and Graffiti 214 00 413x fm 10/2/02 4:10 PM Page ix www.it-ebooks.info [...]... Introduction to Palm Programming and CodeWarrior 2 Anatomy of a Palm Application 3 Rapid Development Using POSE, the Palm OS Emulator 4 Debugging Techniques for Palm Applications 5 Creating and Managing Resources www.it-ebooks.info www.it-ebooks.info 1 Introduction to Palm Programming and CodeWarrior IN THIS CHAPTER • The Palm Computing Platform • What Is a Palm Application? • How Are Palm Applications... figure it out themselves If you have ever wondered how to write Palm applications, or you have already piqued your curiosity by doing some investigation into the world of Palm programming, this book is for you In this book, you will find www.it-ebooks.info 2 Palm OS Programming • Tutorials on most aspects of Palm software development, from “Hello Palm all the way to advanced topics such as communications,... that Palm OS- based devices, including those from Palm, Handspring, Sony, and a growing number of other Palm OS licensees, have collectively dominated the market for PDAs Consequently, the Palm OS is receiving a lot of attention from software developers looking to create new software applications that provide computing power for the mobile user Although designed to be useful right out of the box, Palm OS. .. 396 www.it-ebooks.info xiii xiv Palm OS Programming Steps Involved in Creating a PQA 396 A Sample PQA: Palm Programming Information Kiosk 397 Summary 401 26 Using TCP/IP and Net.lib 403 The Palm OS Network Stack ... for the vast numbers of software developers who are new to the Palm OS Palm, Inc., has done an admirable job assembling all of the developer documentation and API listings for the programming community, but those are references, to be opened when you already know the functions you need to use The problem is that developers new to Palm programming do not already know the right functions to use, nor... required in order to create those software applications In order to get you started with Palm programming, this chapter provides: • A brief overview of the Palm computing platform and how it came about • What it’s like to program for the Palm in C and C++ • What tools are available for Palm software developers After Chapter 1, we will immediately get into the meat of how to write Palm applications, so this... how to write Palm applications, so this chapter provides a good foundation to build on for the rest of the book The Palm Computing Platform Although only a few years ago a Palm OS- based device literally meant a Palmbranded device, Palm, Inc has been very active in licensing the Palm OS to other hardware manufacturers, encouraging the creation of a diverse set of devices that are suited for different... able to take it It is a tribute to Palm s branding efforts that the term Palm Pilot” has almost become a catch-all term for any PDA, whether it runs the Palm operating system or not, just as the term “Xerox” as come to mean general purpose photocopying, not just on Xerox-branded equipment But the reality is not far from that: Today most PDA models do in fact run the Palm operating system, and the number... Introduction to Palm Programming and CodeWarrior scanners, wireless modems, keyboards, and telephony, a strength of the Palm platform is that there is a common base set of characteristics found in all devices A quick survey of the devices supporting the Palm OS yields the following: The Palm computing platform has five main pieces, including: • A standard hardware design • An interface for extending the Palm. .. using add-on hardware components • The Palm Operating System • Data synchronization to and from host systems using HotSync • The Palm SDK and associated tools that enable programmers to develop applications It is important to note that all the devices listed here run one common operating system: Palm Inc.’s Palm OS Knowing this, you can reasonably expect that your Palm application will run on a wide variety . Getting Started with Palm Programming 5 1 Introduction to Palm Programming and CodeWarrior 7 2 Anatomy of a Palm Application 17 3 Rapid Development Using POSE, the Palm OS Emulator 43 4 Debugging. 1 Part I Getting Started with Palm Programming 5 1 Introduction to Palm Programming and CodeWarrior 7 The Palm Computing Platform 9 What Is a Palm Application? 10 How Are Palm Applications Written? . Tools and Programming Environment 429 Other Conduit Development Options 430 Summary 430 Palm OS Programmingxiv 00 413x fm 10/2/02 4:10 PM Page xiv www.it-ebooks.info 28 Programming Palm OS Conduits

Ngày đăng: 01/08/2014, 16:45

Mục lục

    Copyright © 2003 by Sams Publishing

    Contents at a Glance

    We Want to Hear from You!

    Introduction Why Read This Book?

    Who Should Read This Book?

    PART I Getting Started with Palm Programming

    CHAPTER 1 Introduction to Palm Programming and CodeWarrior

    The Palm Computing Platform

    What Is a Palm Application?

    How Are Palm Applications Written?

Tài liệu cùng người dùng

Tài liệu liên quan