Palm OS Programming for Dummies

Table of Contents

    Introduction            1

                     About This Book    2

                     Conventions Used in This Book            2

                     What You're Not to Read                     2

                     Foolish Assumptions   3

                         Target languages and their tools     3

                         Hardware     3

                     How This Book Is Organized     4

                         Part I: Tools of the Trade            4

                         Part II: Building Blocks 4

                         Part III: Targeted Applications       4

                         Part IV: Flying on Instruments  4

                         Part V: The Part of Tens                     4

                         Appendix: About the CD         5

                     Icons Used in this Book 5

                     Where to Go from Here 6

Part 1: Tools of the Trade

        Chapter 1: In the Palm of Your Hand            9

                     Determining the Kinds of Applications You Develop       9

                         Small is okay     10

                         A little memory is better than none at all                 10

                         Faster than a tortoise, slower than a hare    11

                         Data display overrides data input                     12

                         A very small powerhouse 13

                         A single thread of execution      13

                         The Connected Organizer     13

                         Not too pricey    14

                         Last but not least 14

                     Developing Applications                     14

                         Laying out the GUI                     15

                         Adding form handling and navigation     17

                         Implementing menu behavior       18

                         Adding launch code handlers        19

                         Supporting conduit for desktop HotSync       20

                Chapter 2: Discovering the CodeWarrior Within            21

                     Installing the Warrior   22

                     Windows installation   23

                     What about the Mac7  24

                     Creating an Application                     24

                     Launching CodeWarrior                     25

                     Creating a new project 27

                     Editing the project's resources      29

                     Creating and editing the project's menus 35

                     Writing the C Code for the Project    39

                     Making the Application 41

                     Loading and Running with POSE           42

                     Loading and Running on a Palm Device 44

                Chapter 3: Natural Resources            45

                     Understanding Resources                     45

                     Using Constructor  47

                         Starting Constructor  47

                         Constructor's project window 47

                         Common Constructor tasks                     50

                         The Property Inspector window        51

                     Using the Form Editor 52

                         Catalog window 52

                         Form Layout window        54

                         Hierarchy window                     54

                         Form editing tasks                     55

                     Using the Menu Bars and Menu Editors    57

                         Menu Bar Editor window        57

                         Menu Bar Editor tasks             58

                         Menu Editor window        60

                         Menu Editor tasks                     61

                     Strings and Things   62

                         String Editor window        63

                         String Editor tasks                     64

                     Alerts                     65

                         Alert Layout window        65

                         Alert Editor tasks                     66

                     Icons and Bitmaps 68

                         Bitmap Editor window        69

                Chapter 4: Better Editing            71

                     Getting Around the Source Code Editor Window       71

                     Getting Customized    72

                         Balancing punctuation  73

                         Shifting text left and right       73

                     IDE Syntax coloring 74

                        Preferences Panel 74

                         General settings 74

                         Editor settings   75

                         Debugger settings                     76

                     Navigating in a File 77

                     Using the Find dialog box                     77

                     Going to selected text  78

                     Going to a routine   78

                     Going to a particular line                     78

                     Using a marker       78

Chapter 5: Emulation is the Sincerest Form of Flattery            81

                     POSEing with Your Applications     82

                         Setting IDE Preferences   83

                         Installing POSE 83

                         Launching POSE 84

                     Loading an Application into POSE    84

                         Loading without using the Debugger                     85

                         Loading with the Debugger      85

                         Quitting POSE  86

                     Debugging Serial & Network Applications     86

                     Using the Palm Simulator for Macintosh   87

                         Simulating versus emulating      87

                     Striking a POSE      88

Chapter 6: Do You GNU? 91

                     Freeing Yourself from the Corporation 91

                     Grabbing the Freebies  92

                         Establishing a baseline        92

                         Filling in the blanks                     93

                     Going Retro with GNU 94

                     Defining resources 94

                     Writing code           99

                     Making the makefile  103

                     Loading and running   104

Part II: Building Blocks          107

Chapter 7: Living in a Small World 107

                     Squeezing Information into a Tiny Box 107

                     Squeezing into Very Small Memory 110

                         Knowing the limitations    110

                         Dealing with limited memory 111

                     Getting Text in       112

                     Sipping Juice          113

                         Waiting a little while            113

                         Doing periodic and frequent updates                     114

            Chapter 8: Its All in the Events            117

                     Getting Events       118

                         The little engine that could            119

                         Starting the application   120

                     Going with the Flow 122

                         Running the loop                     122

                         Winding down 129

                     Grasping the Big Picture                     130

                         System events 131

                         Menu events   133

                         Application events                     133

                         Form events 134

                Chapter 9: A Form for All Seasons            137

                     Remembering the PIN Example       138

                     Making Forms Work 138

                         Loading the form on launch      139

                         Loading a different form             146

                         Getting the form displayed     147

                     Juggling Forms and Menus                     150

                         Riding herd on the little ones     151

                         Bedeviling the details           155

                         Saving preferences                     162

                     Alerting Developments                     162

                         Telling the user some information                     163

                         Getting feedback from the user   163

                         Making personalized alerts                     163

                     The Gray Area of Dialogs         164

                Chapter 10: Controls Freak 167

                     Gathering the Resources                     167

                     Controlling Your Destiny                     169

                         Control's UI structure       169

                         A controlling example                     171

                     Text: Getting It in and Out and All About                     173

                         Field             173

                         Label            179

                         Scrollbar       180

                     Making Lists and Checking Them Twice           182

                     Setting the Table      188

                     Making a Meal with Leftovers      199

                         Gadget goes to Hawaii          199

                         Graffiti Shift Indicator       201

        Chapter 11: Manager's Corner            203

                     Featuring Alarms    204

                         Finding features 204

                         Alarming developments  205

                     The Sound of File Strings          209

                         Sounding off 209

                         Filing information                     210

                         Stringing along 211

                     Timing System Stuff 212

                         Doing time   212

                         Controlling system stuff             213

Part III: Targeted Applications     219

        Chapter 12: Out to Launch            221

                     Understanding Launch Codes           221

                     Preparing for Launch 223

                     Cracking the Codes   223

                         Listing the codes                     224

                         Flagging the details                     225

                         Switching the codes                     226

                     Dealing with Common Codes           230

                         Handling alarms 230

                         Handling Find 230

                         Handling exchanges                     231

                         Working with Preferences   232

                         Handling HotSync                     232

                         Handling other big changes in the Palm device           232

                     Making Codes For Fun and Profit     233

                Chapter 13: Storing Information            235

                     Improving Your Memory                     236

                         Getting a dynamic memory        237

                         Using dynamic memory        238

                     Making Memories That Last              243

                         Opening a database                     244

                         Creating a database                     246

                         Dealing with records         250

                         Wrapping up database use 258

                         Knowing where to do what, and when                     259

                     Categorizing Records 260

                         Grasping categories                     260

                         Initializing categories     261

                         Handling categories in an overview form                     261

                         Handling categories in a detail form 263

            Chapter 14: Conduits to the Desktop            265

                     The Big Picture of Conduits      265

                         Running the conduits       266

                         Three SDKs and a baby             266

                     Making Conduits in Java                     267

                         Planning the synchronization 267

                         Abstracting the Palm OS records                     268

                         Mapping desktop IDs to Palm OS IDs               273

                         Synchronizing records via a conduit         274

                     Handling HotSync in Your Application  290

                     Getting Your Conduit Installed       292

                         Installing a conduit during development                     292

                         Making a conduit installer        294

                     Conduits in C++ for MacOS and Windows      294

                Part IV: Flying On Instruments      295

            Chapter 15: Dynamic Forms and Menus            297

                     Giving Form to an Idea 297

                         Understanding the options         298

                         Knowing the limitations    298

                         Making a form 298

                     Getting Dynamic with Elements      300

                         Designing data for dynamic forms 301

                         Creating elements dynamically 304

                         Responding to events           307

                         Extracting user-entered information                     308

                         Removing dynamic form elements 310

                     Using Multiple Menus                     311

                Chapter 16: Bugs on the Windshield            313

                     Knowing Your Bugs  313

                         Programming defensively   314

                     Debugging with CodeWarrior   319

                         Setting a breakpoint                     321

                         Examining and changing variable values           321

                         Stepping in, stepping out 322

                     Debugging with gdb   323

                     Understanding Devices                     325

                         Using POSE and debug ROMS  325

                         Using POSE with actual device ROM images          326

                         Using the real McCoy        326

                         Using the Macintosh simulator      326

Part V: The Part of Tens          327

Chapter 17: Ten Things to Remember about Palm Devices            329

                     It's a Small World 329

                     My Memory Is All But Gone            329

                     Puny Palm Power  330

                     Speed Is of the Essence                     330

                     Finding Your Way Around         330

                     Graffiti Is Not Vandalism                     331

                     Information Display Versus Information Entry            331

                     Emulate the Built in Applications   331

                     Simplicity Is the Mother of a Sane Application  332

                     The Desktop Is Your Friend           332

Chapter 18: Ten Other Development Environments         333

                     Developing Directly on the Palm device 333

                         PocketC       333

                         Quartus Forth 334

                     Visual Forms-Based Tools                     334

                         CASLide      334

                         PalmFactory   334

                         Pendragon Forms                     334

                         Satellite Forms 334

                         Visual Form Designer       335

                     The Rest of the Story                     335

                         ASDK          335

                         cBasPad       335

                         Jump            335

                         Pascal for the Pilot                     335

                         Pocket Smalltalk                     336

Chapter 19: Ten Stupid Mistakes to Avoid 337

                     Building Interfaces 337

                         Alerts           337

                         Alerts and buttons                     337

                         Button identification   337

                         Dynamically created elements                     338

                         The keyDownEvent 338

                         Label names 338

                     Communicating       338

                         Launch codes  338

                         Sockets         339

                     Programming Tips  339

                     Alarms                   339

                     Databases              339

                     Hosts                     339

                     Pointers                  339

                     Powering off           340

                Chapter 20: Way More Than Ten Web Links  341

                         The Mother Load   341

                             3Com           341

                             Metrowerks 341

                             GNU            342

                             RoadCoders 342

                         Groups and Lists                     342

                             News Groups 342

                             User Groups   342

                             Mailing Lists   342

                         Interesting Sites 343

                             GNU Pilot SDK                     343

                             IDG Books Worldwide   343

                             PalmPilotGear 343

                             PalmZone     343

                             Wes Cherry's PilRC           343

                Appendix: About the CD            345

                     System Requirements 345

                     How to Use the CD Using

                      Microsoft Windows      346

                     How to Use the CD Using the Mac OS                     347

                     What You'll Find   347

                         Sample files  347

                         Adobe Acrobat Reader          348

                         CASL for the Pilot demo by John Feras            348

                         CodeWarrior Lite                     348

                         Return Character Converter by Tama Software Ltd   348

                         Microsoft Internet Explorer 5.0 348

                         Pilot-GCC Win32                     349

                         PilRC Version 2.3 by Wes Cherry 349

                         The Java 2 SDK, Standard Edition, V 1.2.1             349

                         Shareware and Freeware      349

                     If You've Got Problems (Of the CD Kind)     350

            Index                351

Bonus Chapters on the CD in Adobe Acrobat format:

Breakfast Serial I/O (10 pages)

                     Getting to the port on time

                     Shipping data in and out

                     Serial communications, the next generation

Blinking Light I/O (19 pages)

                     Beaming basics

                     Supporting beaming of data

                     Supporting beaming of records

TCP/IP — Letters You Should Know (14 pages)

                     Succumbing to sockets

                     Looking up names

                     Binding and listening

                     Pushing data through the pipe