Search PalmPower's 487 Palm-related article archive 
Home
EasyPrint
News details Click here for the RSS feed's XML code. This is not a browser URL.
Articles-only Click here for the RSS feed's XML code. This is not a browser URL.
Hello World! (continued)

Before we look at the code, let's take a look at what our application looks like on the PalmPilot. We'll also learn some of the Palm OS terminology.

Screens are called "Forms"
Figure A shows the "hello" application running. There's a menu bar, a single line saying hello, and a single button. This display is a single form: a bunch of user-interface things, called "controls", which are displayed together. This main form contains three controls: the menu bar, a text label (saying "hello world") and a button. Most of the user-interface pieces you're already familiar with are controls (i.e., fields for text entry, checkboxes, buttons, drop-down menus, and so forth) even a list like the Memo Pad's list of memos is a control.

FIGURE A

This is the "Hello World" application.

You define the form using these controls - saying how large each control is, where it's placed on the form, and any other parameters that apply to that control. For buttons, you'd define the text on them, for text fields you'd define how many lines of text, whether it should auto-capitalize the first character, etc. Each control has an ID number. When the user presses a button, internally the program is told something like "button 22 was pressed."

Start - do stuff - stop
Typically, programs do a bit of start-up processing, and a bit of clean-up at exit. The rest of the time is a series of wait for event, process that event, wait for next event loops. This is the "event loop". Most applications should spend almost their entire lives inside the event loop.

Start-up processing tells Palm OS which form to use first, along with whatever particular setup the application itself needs. Exit processing closes any open forms and returns to Palm OS.

Many programs maintain some "state information" between times when they are used - for example, what they were last doing, and any preferences or options the user has set. This information would be loaded during start-up and saved during exit. By keeping state information and returning to where it was before, it appears as if each program is still running.

The application's heartbeat: the event loop
The event loop asks Palm OS for the next event. Usually there are no events (at least at nano-second computer time), so Palm OS waits until the next one occurs. Almost everything causes events: touching a control, the clock ticking inside, asking the OS to do something, and so forth.

The OS queues events, giving them to the program one at a time when the event loop asks for the next event. While processing (also called "handling") events, programs often do more system calls to Palm OS which causes additional calls to be queued.

With each handled event, the program does a little more work. Finally, after marching its way through enough events, the program has done its job for now, displaying the address list or a memo, or in our case, displaying "hello world.".


« Previous  ·  1  ·  2  ·  3  ·  4  ·  5  ·  6  ·  Next »
Other articles you might like
Home > Phones and PDAs > Palm and Treo > Programming (24 articles)
   How PDA software is born
   Program with Simplicity
   Kinectivity 2.0 brings enterprise application developers new tools
Get Weekly Email Updates
Subscribe to our regular weekly email newsletter. It's packed with tips, reviews, deep analysis, and the latest news.
 
Other PalmPower Articles
Palm gets up to date with new Tungsten family of handhelds
Create handwritten email with riteMail
Presenter-to-Go puts PowerPoint presentations on your Palm OS handheld
Looking for the cutting edge
Gain remote access to databases and PLCs
PalmSource Open House showcases what's new in the Palm community
Analysis: handheld market share
More from the ZATZ journals
Computing Unplugged: The iPad defenders have spoken
David Gewirtz Online: CNN commentary and analysis
DominoPower: Application development, William Shatner, and the origin of the universe
OutlookPower: More about disappearing text
-- Advertisement --

BLOGGING AND PODCASTING WITH ONE EASY-TO-USE TOOL
Now you can publish your thoughts, opinions, and comments in your own blog or podcast.<p />

  • Supports multiple authors and multiple blogs or podcasts.
  • Generate and publish RSS feeds for iTunes and other directories.
  • Post photos, images or animations.
  • Get feedback and have conversations with visitors to your site. <p />

Personalize your blog or podcast with your own unique domain name -- or integrate it with your existing site by setting it up as a subdomain.

Tap here and get blogging or podcasting within minutes.

-- Advertisement --

Sent Items Organizer
When you need to file your sent email into their proper folders based on keywords or who it's to. It's also perfect for shared mailboxes.

It also adds a "Send And File" toolbar button while you're composing (similar to the way Lotus Notes used to work) for quick and easy filing.

Find out more!

ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2010, ZATZ Publishing. All rights reserved worldwide.
Editor's Login