O'Reilly logo

Palm Programming: The Developer's Guide by Julie McKeehan, Neil Rhodes

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 4. Structure of an Application

The overall flow and content of a Palm OS application is the subject of this chapter. You will learn:

  • The standard code routines found in every Palm application

  • All about the application’s lifecycle—its starting, running, and closing

  • How the application processes each event and hands it off to the appropriate manager

  • How memory is organized on a Palm device; how the application can use it

  • All the times that an application needs to be available to the system and how these instances are handled in the code

Terminology

Like every operating system and coding interaction, the Palm OS has it own set of necessary terminology for you to learn. Much of it may already be familiar to you from other applications you have written. We suggest that you skim through this list and concentrate on the items that are new to you. New and unique terminology is listed first.

Form

An application window (what many people would think of as a view) that usually covers the entire screen. A form optionally contains controls, text areas, and menus. In a Palm OS application, there is only one active form allowed at a time. Chapter 5, covers forms in detail.

Window

A rectangular area in which things like dialogs, forms, and menus are drawn by the application. The Window Manager makes sure that windows properly display relative to each other (for example, it has the ability to restore the old contents when a window is closed). Note in a rather Shakespearian twist of logic that all forms are windows, even though all windows are not forms.

Database

A collection of persistent memory chunks. There are two kinds: resource and record databases.

Resource

A piece of data stored in a resource database. Each resource is identified by a resource type and number. A Palm application is a collection of resources. Section 5.1 covers resources in more detail.

Record

A data structure identified by a unique record ID. Applications typically store data in record databases.

Event

A data structure that describes things that happen in an application. Events can be low-level hardware events like a pen down, pen up, or hardware key press. They can also be higher-level events like a character entered, a menu item selected, or a software button pressed.

The Palm OS is an event-driven system. Only one application is open at a time. When that application is running, it runs an event loop that retrieves events and continues to handle them until the user starts another application.

Main event loop

The main loop of execution in an application, which repeatedly retrieves events and then acts on them.

Launch code

A parameter passed to an application that specifies what the application should do when that particular launch code is executed. An application typically handles more than one launch code. This is the communication method used between the OS and an application and between applications.

Menu

Menus are stored in resources grouped together into menubars and are displayed when the user taps the menu area. See Chapter 7, for more details.

Menubar

A collection of menus stored in a resource. Each form can have a menubar associated with it.

Dialog

A window containing controls that require the user to make a decision. In other words, the dialog must be dismissed (usually by tapping on one of its buttons) before the application can continue.

Alert

A warning or information dialog that needs to be dismissed by the user.

These brief descriptions cover the most important terminology. In the following section, we look at the basic elements of a very small Palm OS application.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required