Overview of Toolset
As Figure 1 shows, the MobileBuilder integrated development environment (IDE) offers most of the features that developers have come to expect from advanced tools: a component toolbar, a graphical form editor, a project manager, and a property editor. Tools such as these allow the developer to quickly develop code using a graphical user interface—code that in this case runs on a wide variety of platforms.
Figure 1 The MobileBuilder IDE.
While the actual code logic can be compiled for a number of operating platforms, we still must deal with the realities of cross-platform development. One of these realities is that a Windows GUI will probably bear little or no resemblance to one developed for PalmOS, given the differences in screen sizes and data input (keyboard versus stylus). Within MobileBuilder, this problem can be overcome by creating separate projects for each platform's application. In a perfect situation, all of the files (including header, library, resource, and source files) can be reused, while only the form files are changed.
When creating a new project, you're prompted from the beginning to choose a target platform (see Figure 2). Default options on the New Project screen are DOS, DPMI, Palm, Win16, Win32, and WinCE.
Figure 2 Creating a new project.
Selecting Palm as the target and entering a project with the title of SampleApp, for example, generates the shell of a very simple application for the PalmOS. This consists of an empty PalmOS screen with the name Form1 and two source files: Form1.c contains the event map for Form1; SampleApp.c contains the event map for the overall application. Of course, the next question that begs to be answered is: "What the heck is an event map?"
If you're familiar with even-driven programming under any platform—and specifically, if you have experience using Visual C++ for Windows development—you'll become comfortable with MobileBuilder development in a matter of minutes. Components can be dragged off the toolbar and onto a form. From there, double-clicking a component generates event-handling code for that component's default event. For instance, double-clicking a TButton component named Button1 after adding it to a form generates an OnButton1CtlSelect() method. A call to a default handler (named, ironically, DefaultHandler()) is generated by the development tool, followed by a comment with the words add custom code here. From there, it's up to you to write C code to handle the event as you see fit. To handle other events generated by that component, simply select the Events tab in the project editor on the left side of the screen (refer to Figure 1) and select from that component's available events.
While the above capabilities are certainly convenient, MobileBuilder goes a step further by providing its CodeAssistant tool (see Figure 3). CodeAssistant allows the developer to "connect" events from one component to actions on another component. For instance, when a user selects a refresh button, list box contents could be regenerated—all without writing a single line of code. CodeAssistant also supports the handling of application-level events such as AppEnter and AppExit.
Figure 3 The MobileBuilder CodeAssistant.