Home > Programmer's Guide > Programming Fundamentals > Palm OS® Programming
Philosophy
Computing Power
Palm OS® handhelds are designed for collecting informations, consultation of documents, or management of personal information. The applications which you will develop with HB++ will mainly fall into these categories. Any use requiring complex processing (scientific computation, multi-media processing of data, management of large data bases, compilation) are to be avoided as they will provide poor performance.
Certain applications require the access to data stored in complex formats (images, worksheets, formatted documents). The conversion of the data into a format useable by the Palm OS® handheld must be carried out by the desktop computer during synchronization. In fact, any complex treatment able to be carried out during synchronization with the desktop PC should be made at this time.
Databases
As opposed to what their name seems to indicate, the Palm OS® databases are not databases, but the equivalent of files on desktop PCs. They are stored in memory, which means that their contents are not destroyed when the handheld is re-initialized. There are two types of databases: those containing resources (code, forms, controls, strings), and those containing records. A database is identified by a name, a type, and a CreatorID (see following section):
The record databases can contain several records: it is thus very easy to use them to store a table. You access a record by specifying its index ranging between 0 and the number of records - 1. Moreover, each record has a header containing following information:
The resources databases are able to contain several resources. Each one of these resources is identified by a type (for example, " code" for code segment), and the resources of the same type are distinguished by an identifier. You can therefore access a resource by specifying its type and ID.
Resources and records cannot exceed 64 KB. It is for this reason, for example, that a large application must be distributed between several segments of code.
CreatorIDs
The CreatorID attribute is used to identify with which application a record database is affiliated, and to distinguish between several applications contained in resources databases. Record databases having the same CreatorID as a resource database will be regarded as affiliated with the corresponding application. In the Info dialog box of the Palm OS® launcher, only the application will be displayed, and the deletion or the transmission of the application will systematically involve that of the dependent databases.
For this reason it should imperatively be prevented that two applications have same CreatorID: the deletion of the one will cause the deletion of the databases of the other.
The CreatorID consists of 4 characters. Values made up of 4 small letters are reserved by Palm OS® and should not be used. To avoid the conflicts between your applications and those created by other developers, PalmSource® offers an online service to register CreatorIDs at the address http://dev.palmos.com/creatorid. You can thus find out if the CreatorID that you intend for your application is used by another program, and to prevent other programmers from using values used by your applications.
Launch Codes
An application is launched when a launch code is received. The launch codes are a way for the Palm OS® and the application (or two applications) to communicate. For example, an application is generally launched when a user selects its icon in the Launcher window. When this happens, the system generates a launch code (sysAppLaunchCmdNormalLaunch in the Palm SDK, NormalLaunch for HB++) telling the application to launch and allowing it to display forms on screen.
Only NormalLaunch, GotoItem, ReturnFromPanel and CustomLaunch display the user interface. The others launch codes tell the application that it must carry out some actions but not necessarily become the current application, in other words, become visible on screen. A good example of this is the launch code used for the global find function. The global find function allows the user to search through all the databases for a given record.
In this case, it would be very wasteful to do a full launch - including loading the user interface - of each application only to access the application's databases in search of that item. Using a launch code avoids this overhead.