 |
| |  |
Home In This Issue Email a Friend EasyPrint
 | |
|
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.".
[ Prev | Next ]
|
|
-- 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 --
NEW! SAFEGUARD SEND OUTLOOK ADD-IN
Prevent mistakes when sending. This add-in prompts you when certain keywords are used, when email is sent outside your company, and more. It gives senders a chance to think before hitting Send -- perfect for confidentiality reasons. Sperry Software now has 36 professional add-ins...there's one for you!
Click here to find the add-in that's right for you. |
Copyright © 1998-2008, ZATZ Publishing. All rights reserved worldwide.
|