This post is inspired by a poster on the OnBoardC user group-sorry for the messy graphics, but I haven’t got Visio handy right now.
Anyways, some behaviours(like screen taps, button presses) can not be triggered by API calls. However, one needs to simulate them sometimes-doing this is easy if you understand a bit more about the Palm OS.
The Palm OS itself is based on an event queue. Events are added to the top of the queue when generated, and are taken out at the bottom in order to feed the event handling routines:
The events are stored in a data structure called EventType. The event type stays the same for every kind of event-this is made possible by a C construct called union. More on unions can be found in books, for now, it is enough to treat the union as a block of arbitary data embedded into the structure:
From the outside, each event looks the same-just like each of the fish in the comic below looks (almost) equal from the eye of the MS Event:
Adding an event to the queue is very easy-all you need is the Event manager(syntax description by PalmSource). Basically, you create an EventType, set the appropriate fields(think of it as if it were a structure) and add it to the Palm OS event loop.
Usual tricks performed with this call are powering off Palm OS handhelds, simulating screen taps and returning to the launcher.