A Simple Application
Creating a small application before tackling a more complex one is a good way to gain familiarity with a new coding challenge. First, we tell you what our little application does and show you the code for it. After that we do a code walkthrough and point out important elements.
What the Application Does
Our Hello World application displays the words “Hello World” and provides a button to press. Pressing the button displays an alert, as shown in Figure 4.1, which is dismissed by tapping OK. There are two menus, each with one menu item (see Figure 4.2). As this is a very simple application, you just get a beep when you choose either menu item.

Figure 4-1. Dialog shown after tapping the button

Figure 4-2. The menus of Hello World
The Hello World Source Code
Now that you have an idea of what the application can do, look at Example 4.1 to see the code that produces it. Once you have looked through it for yourself, we will discuss it.
Example 4-1. The Hello World Source Code
#include <Pilot.h> #ifdef _ _GNUC_ _ #include "Callback.h" #endif #include "HelloWorldRsc.h" static Err StartApplication(void) { FrmGotoForm(HelloWorldForm); return 0; } static void StopApplication(void) { } static Boolean MyFormHandleEvent(EventPtr event) { Boolean handled = false; #ifdef _ _GNUC_ _ CALLBACK_PROLOGUE ...Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access